You've already forked opentelemetry-go
mirror of
https://github.com/open-telemetry/opentelemetry-go.git
synced 2025-11-27 22:49:15 +02:00
traceIDRatioSampler: use rightmost bits (#3557)
* use bottom bits * add changelog entry Co-authored-by: Chester Cheung <cheung.zhy.csu@gmail.com>
This commit is contained in:
@@ -24,6 +24,9 @@ This project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.htm
|
||||
- Add `Producer` interface and `Reader.RegisterProducer(Producer)` to `go.opentelemetry.io/otel/sdk/metric` to enable external metric Producers. (#3524)
|
||||
- Add `NewMetricProducer` to `go.opentelemetry.io/otel/bridge/opencensus`, which can be used to pass OpenCensus metrics to an OpenTelemetry Reader. (#3541)
|
||||
- Global logger uses an atomic value instead of a mutex. (#3545)
|
||||
- `traceIDRatioSampler` (given by `TraceIDRatioBased(float64)`) now uses the rightmost bits for sampling decisions,
|
||||
fixing random sampling when using ID generators like `xray.IDGenerator`
|
||||
and increasing parity with other language implementations. (#3557)
|
||||
|
||||
### Deprecated
|
||||
|
||||
|
||||
@@ -81,7 +81,7 @@ type traceIDRatioSampler struct {
|
||||
|
||||
func (ts traceIDRatioSampler) ShouldSample(p SamplingParameters) SamplingResult {
|
||||
psc := trace.SpanContextFromContext(p.ParentContext)
|
||||
x := binary.BigEndian.Uint64(p.TraceID[0:8]) >> 1
|
||||
x := binary.BigEndian.Uint64(p.TraceID[8:16]) >> 1
|
||||
if x < ts.traceIDUpperBound {
|
||||
return SamplingResult{
|
||||
Decision: RecordAndSample,
|
||||
|
||||
Reference in New Issue
Block a user