-
Notifications
You must be signed in to change notification settings - Fork 2.8k
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
Support for OTEL_TRACES_SAMPLER #37301
Comments
Thanks for the feedback! We are routing this to the appropriate team for follow-up. cc @jeremydvoss @lzchen. |
@CaerusKaru thanks for your feature request, the team will take a look and respond as soon as possible. |
A workaround for this is to reset the sampler for the from opentelemetry import trace
from opentelemetry.sdk.trace import sampling
trace.get_tracer_provider.sampler = sampling._get_from_env_or_default() |
You are using |
Yes, that's correct. |
The reason we don't support configuration of the sampler used in the |
OpenTelemetry has three categories of sampling, but they all boil down to the same thing: on, off, and maybe. In the specification, there are further subdivisions, for ParentBased. In the sampler you linked above (which I am now very familiar with after hammering at this over several days), this is acknowledged: the sampler exits early if the sampler arg is I don't see how this would impact at all the performance in the UX, as the probabilistic model is unaffected. To the UX, it's still either getting everything, nothing, or following the algorithm for sampling laid out already. |
That's totally fine. We would probably not include this as a configuration option for the distro since is more suited for out-of-the-box, simple configuration and the majority of users are expected to use the given built-in sampler. This is more of a product issue rather than a technical one. We would probably not include this as a configuration option for the distro since is more suited for out-of-the-box, simple configuration and the majority of users are expected to use the given built-in sampler. You are more than welcome to implement your own sampler and use piece-wise with the exporter. We would advise inheriting from the |
That doesn't feel like it's in the spirit of the library, though. The library explicitly supports |
Edit: either the above, or some update to the documentation explicitly calling out that |
Is your feature request related to a problem? Please describe.
The OpenTelemetry Python library has support for many default sampling schemes. Some of these allow for configuring sampling not based on a probabilistic rate, but instead on the context of the parent span. In an instance where most tracing should be ignored, except parent spans, this is incredibly useful to reduce noise. Our explicit example is an application instrumented for long polling, where we only want to capture data for inbound requests, where the trace context is retrieved from the queue. We don't want 99.99% of all traffic sampled, but we do want the inbound requests to be captured, assuming the context is properly set on those spans.
Describe the solution you'd like
Right now, this library assumes a probabilistic sampling, with explicit support for
OTEL_TRACES_SAMPLER_ARG
. This should be extended to also supportOTEL_TRACES_SAMPLER
, where the underlying logic can be shared in terms of setting up the context on the samples, but the decision on when/how to sample should be abstracted to the underlying library, allowing support of multiple sampler types.Describe alternatives you've considered
The only other way to achieve this is to literally rip out and replace the trace sampler from the library, pretty much doing what I said above, just without explicit support.
The text was updated successfully, but these errors were encountered: