fix(ddtrace/tracer): keep correct trace+span sampling with propagated sampling decision#3856
Merged
dd-mergequeue[bot] merged 4 commits intoAug 19, 2025
Merged
Conversation
darccio
force-pushed
the
dario.castane/incident-41436/apmapi-1545
branch
from
August 7, 2025 14:17
f94ed33 to
3dc5c38
Compare
hannahkm
reviewed
Aug 7, 2025
BenchmarksBenchmark execution time: 2025-08-19 08:29:53 Comparing candidate commit c8fdff5 in PR branch Found 0 performance improvements and 0 performance regressions! Performance is the same for 24 metrics, 0 unstable metrics. |
darccio
marked this pull request as draft
August 7, 2025 14:26
darccio
force-pushed
the
dario.castane/incident-41436/apmapi-1545
branch
9 times, most recently
from
August 7, 2025 20:11
21bc8cb to
608490a
Compare
darccio
marked this pull request as ready for review
August 7, 2025 20:38
hannahkm
reviewed
Aug 7, 2025
hannahkm
reviewed
Aug 7, 2025
genesor
reviewed
Aug 8, 2025
hannahkm
approved these changes
Aug 8, 2025
mtoffl01
reviewed
Aug 11, 2025
darccio
force-pushed
the
dario.castane/incident-41436/apmapi-1545
branch
from
August 14, 2025 15:08
608490a to
18f6913
Compare
darccio
pushed a commit
that referenced
this pull request
Aug 19, 2025
… sampling decision
…ity to decide if a span can be resampled
darccio
force-pushed
the
dario.castane/incident-41436/apmapi-1545
branch
from
August 19, 2025 08:15
ea94a70 to
c8fdff5
Compare
Member
Author
|
/merge |
|
View all feedbacks in Devflow UI.
The expected merge time in
|
7 tasks
darccio
pushed a commit
that referenced
this pull request
Aug 19, 2025
7 tasks
7 tasks
6 tasks
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?
Locks trace if sampling priority is set on context propagation.
It also fixes the precedence of global trace rate over trace sampling rules by making sure trace sampling rules are checked before than the global trace rate, as explained here:
Note for future travelers: our internal logic for sampling works on the basis that a span can be re-sampled during the lifespan of a local span, as we allow sampling rules over tags and we support a bunch of cases where it's also allowed. It's not allowed to re-sample a propagated sampling priority in a downstream service (it'd render head-based sampling not reliable). Thus making the need to lock the trace from the root span if it already has a sampling decision in it.
Motivation
Fixes DataDog/system-tests#5014.
Reviewer's Checklist
./scripts/lint.shlocally.Unsure? Have a question? Request a review!