feat: add _dd.p.ksr propagated tag for Knuth sampling rate#180
Draft
feat: add _dd.p.ksr propagated tag for Knuth sampling rate#180
Conversation
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Expand assert! macro call to multi-line format required by rustfmt. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This was referenced Mar 11, 2026
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
What does this PR do?
Adds
_dd.p.ksr(Knuth Sampling Rate) as a propagated tag set when agent-based or rule-based sampling decisions are made. The tag is stored in spanmeta(string type) with up to 6 significant digits and no trailing zeros.Motivation
To enable consistent sampling across tracers and backend retention filters, the backend needs to know the sampling rate applied by the tracer. Without transmitting the tracer's rate via
_dd.p.ksr, backend resampling cannot correctly compute effective rates in multi-stage sampling scenarios.See RFC: "Transmit Knuth sampling rate to backend"
Additional Notes
Key files changed:
datadog-opentelemetry/src/core/constants.rs— AddedSAMPLING_KNUTH_RATE_TAG_KEYconstantdatadog-opentelemetry/src/sampling/datadog_sampler.rs— Addedformat_sampling_rate()helper and set ksr in agent/rule sampling pathsRelated PRs across tracers:
_dd.p.ksrformatting to use 6 significant digits without trailing zeros dd-trace-cpp#288🤖 Generated with Claude Code