Ensure DD_TRACE_SAMPLE_RATE enables full RuleSampler #1416
Merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
DD_TRACE_SAMPLE_RATE
controls the global sampling rate of traces inddtrace
. This settings was introduced as a newer feature, compared to our default, agent-driven, RateByServiceSampler.Because
DD_TRACE_SAMPLE_RATE
is implemented using the new RuleSampler (instead of RateByServiceSampler), it has different semantics that affect backend behaviour: RuleSampler sets two new tags (_dd.rule_psr
and_dd.limit_psr
) that report application-side sampling rates to the backend for throughput extrapolation (if we sent 10 spans/sec, with a sampling rate of 0.1, the application actually generated 100 spans/sec).This PR addresses the fact that setting a sampling rate to the new environment variable
DD_TRACE_SAMPLE_RATE
was not sending the required sampling tags.This PR keeps intact the behaviour for users that do not enable the new
RuleSampler
, either throughDD_TRACE_SAMPLE_RATE
or programmatic configuration.