Skip to content
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): Propagate sample_rand to transaction's baggage #4040

Open
wants to merge 1 commit into
base: szokeasaurusrex/sample_rand-2
Choose a base branch
from

Conversation

szokeasaurusrex
Copy link
Member

@szokeasaurusrex szokeasaurusrex commented Feb 11, 2025

continue_trace now propagates incoming sample_rand values to the transaction's baggage. Also, in the case where sample_rand is missing from the incoming trace and needs to be backfilled, this change introduces a mechanism for the backfilled value from the scope's propagation context to be propagated to the transaction's baggage.

The transaction still does not use the sample_rand for making sampling decisions; this PR only enables propagation. A future PR will add support for reading the incoming/backfilled sample_rand and for using this value to make sampling decisions.

Depends on:

Ref #3998


Thank you for contributing to sentry-python! Please add tests to validate your changes, and lint your code using tox -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.

Copy link

codecov bot commented Feb 11, 2025

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 80.36%. Comparing base (d486a8f) to head (b400fb1).

✅ All tests successful. No failed tests found.

Additional details and impacted files
@@                        Coverage Diff                        @@
##           szokeasaurusrex/sample_rand-2    #4040      +/-   ##
=================================================================
+ Coverage                          80.30%   80.36%   +0.06%     
=================================================================
  Files                                140      140              
  Lines                              15545    15554       +9     
  Branches                            2635     2637       +2     
=================================================================
+ Hits                               12483    12500      +17     
+ Misses                              2225     2210      -15     
- Partials                             837      844       +7     
Files with missing lines Coverage Δ
sentry_sdk/scope.py 85.57% <100.00%> (+0.03%) ⬆️
sentry_sdk/tracing.py 77.82% <100.00%> (ø)
sentry_sdk/tracing_utils.py 85.60% <100.00%> (+0.24%) ⬆️

... and 4 files with indirect coverage changes

@szokeasaurusrex szokeasaurusrex force-pushed the szokeasaurusrex/sample_rand-2 branch from 14a70da to 0a0de06 Compare February 11, 2025 19:21
@szokeasaurusrex szokeasaurusrex force-pushed the szokeasaurusrex/sample_rand-3 branch from 92cd6fb to bea45b9 Compare February 11, 2025 19:21
@szokeasaurusrex szokeasaurusrex force-pushed the szokeasaurusrex/sample_rand-2 branch from 0a0de06 to 21bb038 Compare February 11, 2025 19:29
@szokeasaurusrex szokeasaurusrex force-pushed the szokeasaurusrex/sample_rand-3 branch from bea45b9 to 6363759 Compare February 11, 2025 19:30
@szokeasaurusrex szokeasaurusrex force-pushed the szokeasaurusrex/sample_rand-2 branch from 21bb038 to 836d5b1 Compare February 11, 2025 19:39
@szokeasaurusrex szokeasaurusrex force-pushed the szokeasaurusrex/sample_rand-3 branch 3 times, most recently from 154662a to af64b16 Compare February 12, 2025 08:41
@szokeasaurusrex szokeasaurusrex force-pushed the szokeasaurusrex/sample_rand-2 branch from 836d5b1 to cbfc36a Compare February 12, 2025 11:43
@szokeasaurusrex szokeasaurusrex force-pushed the szokeasaurusrex/sample_rand-3 branch from af64b16 to 01334d7 Compare February 12, 2025 11:48
@szokeasaurusrex szokeasaurusrex force-pushed the szokeasaurusrex/sample_rand-2 branch from cbfc36a to 6f66ce8 Compare February 12, 2025 11:56
@szokeasaurusrex szokeasaurusrex force-pushed the szokeasaurusrex/sample_rand-3 branch from 01334d7 to 7ec8e08 Compare February 12, 2025 11:57
@szokeasaurusrex szokeasaurusrex marked this pull request as ready for review February 12, 2025 12:18
@szokeasaurusrex szokeasaurusrex force-pushed the szokeasaurusrex/sample_rand-2 branch from 6f66ce8 to fec92c5 Compare February 13, 2025 15:35
`continue_trace` now propagates incoming `sample_rand` values to the transaction's baggage. Also, in the case where `sample_rand` is missing from the incoming trace and needs to be backfilled, this change introduces a mechanism for the backfilled value from the scope's propagation context to be propagated to the transaction's baggage.

The transaction still does not use the `sample_rand` for making sampling decisions; this PR only enables propagation. A future PR will add support for reading the incoming/backfilled `sample_rand` and for using this value to make sampling decisions.

Ref #3998
@szokeasaurusrex szokeasaurusrex force-pushed the szokeasaurusrex/sample_rand-2 branch from fec92c5 to d486a8f Compare February 13, 2025 15:38
@szokeasaurusrex szokeasaurusrex force-pushed the szokeasaurusrex/sample_rand-3 branch from 7ec8e08 to b400fb1 Compare February 13, 2025 15:38
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant