fix(sampling): Attribute backpressure as unsampling reason more accurately#6445
Open
sentrivana wants to merge 2 commits into
Open
fix(sampling): Attribute backpressure as unsampling reason more accurately#6445sentrivana wants to merge 2 commits into
backpressure as unsampling reason more accurately#6445sentrivana wants to merge 2 commits into
Conversation
backpressure as unsampling reason for more spans
Contributor
Codecov Results 📊✅ 67 passed | Total: 67 | Pass Rate: 100% | Execution Time: 7.51s 📊 Comparison with Base Branch
✨ No test changes detected All tests are passing successfully. ❌ Patch coverage is 16.67%. Project has 14860 uncovered lines. Files with missing lines (1)
Coverage diff@@ Coverage Diff @@
## main #PR +/-##
==========================================
+ Coverage 35.12% 35.12% —%
==========================================
Files 190 190 —
Lines 22901 22905 +4
Branches 7854 7856 +2
==========================================
+ Hits 8044 8045 +1
- Misses 14857 14860 +3
- Partials 715 715 —Generated by Codecov Action |
backpressure as unsampling reason for more spansbackpressure as unsampling reason more accurately
alexander-alderman-webb
approved these changes
May 29, 2026
Contributor
alexander-alderman-webb
left a comment
There was a problem hiding this comment.
Cool code!
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
Context
If backpressure handling is active, it lowers the effective sample rate.
There are different outcomes for when a span is unsampled due to
sample_rateorbackpressure.Behavior
Before this change, if under backpressure, we'd only report
backpressureas the reason for unsampling if the monitor lowered the effective sample rate to a falsy value. Which only covers a small portion of unsample decisions made due to backpressure. The rest would be reported as a genericsample_ratedrop, potentially leading to confusing reporting. If someone e.g. has atraces_sample_rateof1.0, they might see spans being dropped because ofsample_rate, which is hard to justify.In this PR, we try to do a better job at determining whether backpressure was actually the reason a span was dropped and emit the corresponding outcome.
The idea is, for an unsampled span:
sample_randwould've been higher than the original, non-backpressuresample_rate, the span would've been unsampled regardless of backpressure handling, so the outcome should besample_ratesample_randactually would've been lower than the originalsample_ratehad thesample_ratenot been lowered, the span would've been sampled. In that case backpressure handling is the direct cause and the outcome should bebackpressureIssues
Reminders
uv run ruff.feat:,fix:,ref:,meta:)