Runtime Adjustment of OpenTelemetry Probability Sampler: Unclear Mechanism
25.5K reputation · 10 Jun 2021, 06:17 UTC
Problem
OpenTelemetry auto‑instrumentation libraries default to a probability sampler (often 10% for Java, 5% for Python) to limit trace volume. The SDK exposes a sampler configuration API, but changing the sampler at runtime requires code changes or a restart; no cross‑language, environment‑variable override is defined in the core spec.
Vendor exporters (Jaeger, Honeycomb, etc.) provide proprietary ways to adjust sampling rates via config files or environment variables, but these mechanisms are not portable and do not integrate with the core OpenTelemetry API. Custom samplers can be implemented, yet their interaction with auto‑instrumentation and context propagation remains undocumented.
Given this lack of a unified dynamic sampling interface, teams are uncertain how to adjust sampling rates in production without redeploying or losing trace continuity.
Questions
- Is there a standardized, cross‑language method to modify the probability sampler at runtime in OpenTelemetry?
- Can auto‑instrumentation libraries be configured via bootstrap files or environment variables to override the default sampler without code changes?
- How does a custom sampler integrate with context propagation when used alongside auto‑instrumentation, and what are the implications for trace consistency?