-
Notifications
You must be signed in to change notification settings - Fork 129
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 a provider for consistent parent based probability sampler #1005
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
👍
Not sure why, but I am seeing this, am I pointing to a wrong branch?
|
|
||
@Override | ||
public String getName() { | ||
return "consistent_parent_based_probability"; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
samplers in java sdk use a different naming scheme https://github.com/open-telemetry/opentelemetry-java/blob/main/sdk-extensions/autoconfigure/README.md#sampler
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Would consistent_parentbased_probability
work?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
how about
consistent_always_on
consistent_always_off
consistent_probability
consistent_rate_limit
parentbased_consistent_always_on
parentbased_consistent_always_off
parentbased_consistent_probability
parentbased_consistent_rate_limit
(don't need to add them all in this PR, but trying to understand the naming pattern)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sounds good, updated to parentbased_consistent_probability
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
could you also rename the sampler provider class to match the name
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
updated
That is fine, only code owners can merge. |
|
||
@Override | ||
public Sampler createSampler(ConfigProperties config) { | ||
double samplingProbability = config.getDouble("otel.traces.sampler.arg", 1.0d); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Would you want to force the samplingProbability
into the interval [0.0, 1.0]? If out of the range, an exception will be thrown by the statement below.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ConsistentProbabilityBasedSampler is already throwing an IllegalArgumentException if it's not within the range.
if (samplingProbability < 0.0 || samplingProbability > 1.0) {
throw new IllegalArgumentException("Sampling probability must be in range [0.0, 1.0]!");
}
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Exactly my point. I just wondered if this is the behavior you want.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sorry, I misread your comment.
Yes and I believe that was @oertl's intention as well.
TraceIdRatioBasedSampler in java sdk also has the same behaviour.
We could default to 1.0, but I think failing here would probably be more explicit.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good.
Description:
Adding a ConfigurableSamplerProvider for parent based probability sampler to autoconfigure to use in auto instrumentation.
Existing Issue(s):
Discussed in here
#999
Testing:
Tested it by using it in a java application with auto instrumentation on.
Documentation:
Outstanding items:
It's only adding a provider for one sampler that I need, but I am happy to discuss if we should add them all.