Description
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 support OTEL_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.