1
0
mirror of https://github.com/open-telemetry/opentelemetry-go.git synced 2025-11-25 22:41:46 +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:
Daniel Metz
2022-12-30 11:06:06 -08:00
committed by GitHub
parent 69e44a337b
commit 9d633d2ed5
2 changed files with 4 additions and 1 deletions

View File

@@ -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,