fix(sampling): sentry-trace should take precedence over baggage#6863
Merged
Conversation
sentry-trace should take precedence over baggage
Contributor
Codecov Results 📊✅ 95930 passed | ⏭️ 6340 skipped | Total: 102270 | Pass Rate: 93.8% | Execution Time: 336m 27s 📊 Comparison with Base Branch
All tests are passing successfully. ✅ Patch coverage is 83.33%. Project has 2512 uncovered lines. Files with missing lines (1)
Coverage diff@@ Coverage Diff @@
## main #PR +/-##
==========================================
+ Coverage 89.65% 89.67% +0.02%
==========================================
Files 193 193 —
Lines 24324 24321 -3
Branches 8572 8572 —
==========================================
+ Hits 21807 21809 +2
- Misses 2517 2512 -5
- Partials 1395 1397 +2Generated by Codecov Action |
sentrivana
marked this pull request as ready for review
July 23, 2026 09:44
ericapisani
approved these changes
Jul 23, 2026
ericapisani
left a comment
Member
There was a problem hiding this comment.
LGTM, just noticed a small thing
Comment on lines
+1028
to
+1030
| "sentry-sample_rate": "0.75", | ||
| "sentry-sample_rand": "0.500000", | ||
| "sentry-sampled": "true", |
Member
There was a problem hiding this comment.
Why not add these to the initial definition of incoming_baggage above?
Contributor
Author
There was a problem hiding this comment.
Thanks for noticing! Copied this test from another one that only did this conditionally and missed this.
Fixed in ddc7386
alexander-alderman-webb
approved these changes
Jul 23, 2026
sentrivana
enabled auto-merge (squash)
July 23, 2026 14:21
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.
Description
We were making the wrong sampling decision in a specific case: when the incoming
sentry-traceended in-0, but the incoming baggage had a combination ofsentry-sample_rateandsentry-sample_randthat would've actually produced a positive sampling decision, we would prioritize the information from the baggage over the parent sampling decision fromsentry-trace.This PR aligns the behavior with the legacy codepath, where we'd set
parent_sampledas the newsample_rate.Issues
Reminders
uv run ruff.feat:,fix:,ref:,meta:)