[samplers/probability] Implements a traceIdRatio sampler#8714
[samplers/probability] Implements a traceIdRatio sampler#8714yuanyuanzhao3 wants to merge 9 commits intoopen-telemetry:mainfrom
Conversation
…s to the threshold based sampling algorithm. Made-with: Cursor
…dRatio based sampler.
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #8714 +/- ##
======================================
Coverage 82.2% 82.2%
======================================
Files 183 186 +3
Lines 13812 13921 +109
======================================
+ Hits 11354 11449 +95
- Misses 2054 2068 +14
Partials 404 404
🚀 New features to boost your workflow:
|
…ndomness (explicit or from traceid with random tracestate flag) exists.
…h` key resulting in an empty otts. This happens when `th` was the only subkey in `ot` in the incoming tracestate. However, the incoming traceid or tracestate lacks randomness, so we end up erasing `th`.
…ses and fixing lints.
|
@jmacd as FYI. |
| if fraction < probabilityZeroThreshold { | ||
| return sdktrace.NeverSample() | ||
| } | ||
|
|
There was a problem hiding this comment.
For the record, this code is identical to https://github.com/open-telemetry/opentelemetry-collector-contrib/blob/1a616d98873ca26622ef6d4698c2e7d1ddd7a25f/pkg/sampling/probability.go#L33, a variation on https://opentelemetry.io/docs/specs/otel/trace/tracestate-probability-sampling/#converting-floating-point-probability-to-threshold-value.
I think so as well. I'm under the impression that this is a temporary home while the sampler is being developed and battle-hardened. Eventually it'll graduate to the core SDK. @dashpole who suggested this place:
|
Co-authored-by: Joshua MacDonald <jmacd@users.noreply.github.com>
…ailures in codespell and markdown lint checks Made-with: Cursor
Description
Implements a TraceIdRatioBased sampler in
go.opentelemetry.io/contrib/samplers/probability/traceidratiothat conforms to the OpenTelemetry specification's threshold-based sampling algorithm.Features
thhandling: Encodes and propagates the sampling threshold in the W3Cottracestate vendor key for consistent downstream samplingTraceFlags.IsRandom()andWithRandom()(opentelemetry-go#8012) for proper indication ofthvalue for extrapolated metrics supportDependencies
This module temporarily uses
replacedirectives to pin to the opentelemetry-go commit that includesIsRandom/WithRandom(opentelemetry-go#8012, merge commit2ffde5a42). These replaces should be removed once opentelemetry-go releases a version that includes those APIs.Related
Co-Author
Joshua MacDonald jmacd@users.noreply.github.com