-
Notifications
You must be signed in to change notification settings - Fork 523
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
feat(tracing): Use sample_rand
for sampling decisions
#4044
base: szokeasaurusrex/sample_rand-3
Are you sure you want to change the base?
feat(tracing): Use sample_rand
for sampling decisions
#4044
Conversation
Codecov ReportAll modified and coverable lines are covered by tests ✅
✅ All tests successful. No failed tests found. Additional details and impacted files@@ Coverage Diff @@
## szokeasaurusrex/sample_rand-3 #4044 +/- ##
=================================================================
+ Coverage 80.30% 80.31% +0.01%
=================================================================
Files 139 139
Lines 15452 15462 +10
Branches 2613 2615 +2
=================================================================
+ Hits 12409 12419 +10
+ Misses 2203 2202 -1
- Partials 840 841 +1
|
c3d6d12
to
5a906f6
Compare
af64b16
to
01334d7
Compare
5a906f6
to
548396d
Compare
01334d7
to
7ec8e08
Compare
c4abdc9
to
5f57723
Compare
if baggage_sample_rand is not None: | ||
self._sample_rand = baggage_sample_rand | ||
else: | ||
self._sample_rand = Random(self.trace_id).random() |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
In what cases will we have to generate a new _sample_rand
here?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Whenever we are starting a new trace, i.e. if we call start_transaction
without calling continue_trace
first and without manually passing in baggage
Use the `sample_rand` value from an incoming trace to make sampling decisions, rather than generating a random value. When we are the head SDK starting a new trace, save our randomly-generated value as the `sample_rand`, and also change the random generation logic so that the `sample_rand` is computed deterministically based on the `trace_id`. Closes #3998
5f57723
to
b66c955
Compare
7ec8e08
to
b400fb1
Compare
Use the
sample_rand
value from an incoming trace to make sampling decisions, rather than generating a random value. When we are the head SDK starting a new trace, save our randomly-generated value as thesample_rand
, and also change the random generation logic so that thesample_rand
is computed deterministically based on thetrace_id
.Depends on:
sample_rand
onPropagationContext
#4038Closes #3998
Thank you for contributing to
sentry-python
! Please add tests to validate your changes, and lint your code usingtox -e linters
.Running the test suite on your PR might require maintainer approval. The AWS Lambda tests additionally require a maintainer to add a special label, and they will fail until this label is added.