Skip to content

Resolve the discrepancy on tracestate ot.th generation when randomness (trace id or rv) is absent #5035

@yuanyuanzhao3

Description

@yuanyuanzhao3

What are you trying to achieve?**

This issue is to clarify the behavior of the ProbabilitySampler when a TraceID does not have the "Random Trace ID Flag" set and no explicit rv (Random Value) is present in the tracestate.

What did you expect to see?

The specification of ProbabilitySampler should be rectified to not include ot.th if randomness indication is absent.

The Problem

As discussed in the OpenTelemetry-Go repository, there is a discrepancy between the current SDK specification and the intended statistical requirements for proper span metrics extrapolation.

Currently, the ProbabilitySampler SDK specification does not explicitly mandate erasing the threshold (th) when randomness cannot be verified. If a sampler propagates a th value for a non-random TraceID, downstream consumers (like the spanmetricsconnector) may incorrectly apply extrapolation logic (sampling_method=extrapolated), leading to skewed or statistically invalid metrics.

Proposed Change

The specification should be updated to require that the ProbabilitySampler:

  1. Presume TraceID randomness by default unless an explicit rv value is provided in the tracestate.
  2. Explicitly erase/omit the th value from the tracestate if:
    • The TraceID lacks the W3C Random Trace ID Flag.
    • AND no rv value is present in the incoming tracestate.

This ensures that downstream systems has clarity on the statistical nature of the sampled spans and take appropriate action such as treating these spans as simple counts (sampling_method=counted) rather than representative samples.

Additional Context

Metadata

Metadata

Assignees

Labels

spec:traceRelated to the specification/trace directory

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions