Fix sampling decision precedence#1335
Merged
Merged
Conversation
st0012
commented
Mar 13, 2021
Contributor
- When traces_sampler is set, the sentry-trace's sampling decision should be put into sampling context to let the user make explicit decision. Currently it forces the transaction to be sampled, which is wrong.
- The value of traces_sample_rate should have a lower priority than the traces_sampler and the value of parent_sampled.
st0012
force-pushed
the
fix-transaction-sampling
branch
from
March 23, 2021 01:33
434d5ab to
f07cf86
Compare
lobsterkatie
left a comment
Member
There was a problem hiding this comment.
Overall looks good.
There are a few tests I think we should add, to show that precedence is working:
"when traces_sampler is provided"context:it "prioritizes traces_sampler over traces_sample_rate", where the sampler always says yes and the rate is 0, and/or the sampler always says no and the rate is 1it "prioritizes traces_sampler over inherited decision"(similar idea)
"when traces_sampler is not set"context:it "prioritizes inherited decision over traces_sample_rate"(again, similar idea)
st0012
force-pushed
the
fix-transaction-sampling
branch
2 times, most recently
from
March 25, 2021 08:03
2fb6e03 to
fce5fe9
Compare
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## master #1335 +/- ##
==========================================
+ Coverage 98.08% 98.70% +0.61%
==========================================
Files 208 113 -95
Lines 9176 5386 -3790
==========================================
- Hits 9000 5316 -3684
+ Misses 176 70 -106 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
Contributor
Author
|
@lobsterkatie I also added another commit to correct |
st0012
force-pushed
the
fix-transaction-sampling
branch
from
March 26, 2021 10:22
87eb67a to
d01ae1b
Compare
1. When traces_sampler is set, the sentry-trace's sampling decision should be put into sampling context to let user make explicit decision. Currently it forces the transaction to be sampled, which is wrong. 2. The value of traces_sample_rate should have a lower priority than the traces_sampler and the value of parent_sampled.
When calling this method, a sampling_context should always be provided. And in most cases, the sampling_context should be assembled in Hub#start_transaction.
st0012
force-pushed
the
fix-transaction-sampling
branch
from
March 31, 2021 08:30
d01ae1b to
06e62dc
Compare
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.