Investigate a sampler customizer for OpenTelemetry
- Dominant language
- Java
- Stars
- 1.2k
- Forks
- 487
- Avg merge
- 4d 5h
- Merged PRs (30d)
- 13
Description
**Is your feature request related to a problem? Please describe.**
PR #2259 replaced HTrace with OpenTelemetry. One of the features that was lost (would have been lost if HTrace had been upgraded also) is the ability to be very granular with the sampler configuration. It may be possible to inject a sampler customizer into the autoconfigured OpenTelemetry implementation to gain back some granularity.
See https://github.com/open-telemetry/opentelemetry-java/blob/main/sdk-extensions/autoconfigure-spi/src/main/java/io/opentelemetry/sdk/autoconfigure/spi/AutoConfigurationCustomizer.java#L45
**Describe the solution you'd like**
Ideally, we'd be able to specify a parent-based sampler, so if a parent context is sampled, then the current span's context will also be sampled. For client-side tracing, especially with the shell, it should be possible to use a sampler customizer that allows us to toggle the sampling at the root span so we can ensure specific actions in the shell are traced on-demand, as was possible with earlier versions of HTrace. It would also be nice if we could easily customize root span sampling in server-side dynamically, being able to turn sampling on or off, or change its sampling rate without restarting a server.
**Describe alternatives you've considered**
Instead of relying on an autoconfiguration sampling customizer, the normal way to control sampling is by using a the OpenTelemetry SDK to build OpenTelemetry instances with a specific TracerProvider that has a Sampler configured when initialized. However, that requires us to really take ownership over an OpenTelemetry instrumentation library and its features, and we wouldn't be able to as easily rely on the autoconfiguration one, which has a lot of out-of-the-box features with minimal effort.
Alternatively, we just rely on [the autoconfiguration sampler's normal configuration without any customization](https://github.com/open-telemetry/opentelemetry-java/tree/main/sdk-extensions/autoconfigure#sampler)
**Additional context**
See https://github.com/apache/accumulo/pull/2259#issuecomment-964502910
Contributor guide
Research direction
Start by reviewing PR #2259 and the linked OpenTelemetry AutoConfigurationCustomizer reference. Investigate whether Accumulo can inject a sampler customizer while retaining autoconfiguration, including parent-based sampling and dynamic root-span control. Done should be a defined, feasible approach or a documented reason the requested customization is not practical.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- java
- Domain
- observability-sre
- Issue type
- Feature
- Difficulty
- 5/5
- Estimated time
- Over a week
- Activity status
- Stale
- Clarity
- Needs clarification
- Newbie friendliness
- 25/100