Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add AlwaysParentSample sampler #455

Merged
merged 4 commits into from
Feb 3, 2020

Conversation

amrmahdi
Copy link
Contributor

@amrmahdi amrmahdi commented Jan 30, 2020

sdk/trace/sampling.go Outdated Show resolved Hide resolved
Co-Authored-By: Krzesimir Nowak <qdlacz@gmail.com>
@amrmahdi amrmahdi requested a review from krnowak January 31, 2020 18:02
Copy link
Contributor

@rghetia rghetia left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What should be the behavior if this is a root span? It is more of an issue in the spec since it doesn't define this. If the desired behavior for root is

  • always sample then it is same as probabilitySampler with probability of 1.
  • if do not sample then it is same as probabilitySampler with probability of 0.
  • if sample as certain probability x then it is same as probabilitySampler with x.

Essentially it is same as probabilitySampler.

The other thing is that AlwaysParentSampler is same as ProbabilitySampler with probability of 1. If there is a parent and then simply follow the decision on the parent. That is same as AlwaysParentSample (if we clarify what should be the behavior for root span for AlwaysParentSampler).

sdk/trace/sampling_test.go Outdated Show resolved Hide resolved
@amrmahdi
Copy link
Contributor Author

What should be the behavior if this is a root span? It is more of an issue in the spec since it doesn't define this. If the desired behavior for root is

  • always sample then it is same as probabilitySampler with probability of 1.
  • if do not sample then it is same as probabilitySampler with probability of 0.
  • if sample as certain probability x then it is same as probabilitySampler with x.

Essentially it is same as probabilitySampler.

The other thing is that AlwaysParentSampler is same as ProbabilitySampler with probability of 1. If there is a parent and then simply follow the decision on the parent. That is same as AlwaysParentSample (if we clarify what should be the behavior for root span for AlwaysParentSampler).

This is a good point. I believe it should be equivalent to ProbabilitySampler with 0. And then we can just wrap the ProbabilitySampler with 0 inside the AlwaysParentSampler and clarify it in the docs.

@rghetia
Copy link
Contributor

rghetia commented Jan 31, 2020

This is a good point. I believe it should be equivalent to ProbabilitySampler with 0. And then we can just wrap the ProbabilitySampler with 0 inside the AlwaysParentSampler and clarify it in the docs.

I agree on ProbabilitySampler with 0.
Actually, spec implicitly implies that on root span do not sample. From spec Returns RECORD_AND_SAMPLED if SampledFlag is set to true on parent SpanContext and NOT_RECORD otherwise.

@rghetia rghetia merged commit 6051c81 into open-telemetry:master Feb 3, 2020
@amrmahdi amrmahdi deleted the amrh/alwaysparentsampler branch February 3, 2020 18:24
@MrAlias MrAlias mentioned this pull request Feb 11, 2020
6 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants