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

fix(httpx): Prevent Sentry baggage duplication #3728

Merged
merged 5 commits into from
Nov 21, 2024

Conversation

szokeasaurusrex
Copy link
Member

Sentry baggage will get added to an HTTPX request multiple times if the same request is repeated. To prevent this from occurring, we can strip any existing Sentry baggage before adding Sentry baggage to the request.

Fixes #3709

Sentry baggage will get added to an HTTPX request multiple times if the same request is repeated. To prevent this from occurring, we can strip any existing Sentry baggage before adding Sentry baggage to the request.

Fixes #3709
Copy link

codecov bot commented Nov 4, 2024

Codecov Report

Attention: Patch coverage is 91.66667% with 1 line in your changes missing coverage. Please review.

Project coverage is 79.89%. Comparing base (e9ec6c1) to head (3181f46).
Report is 1 commits behind head on master.

✅ All tests successful. No failed tests found.

Files with missing lines Patch % Lines
sentry_sdk/integrations/httpx.py 88.88% 1 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##           master    #3728      +/-   ##
==========================================
- Coverage   79.89%   79.89%   -0.01%     
==========================================
  Files         137      137              
  Lines       15373    15382       +9     
  Branches     2609     2610       +1     
==========================================
+ Hits        12282    12289       +7     
- Misses       2221     2222       +1     
- Partials      870      871       +1     
Files with missing lines Coverage Δ
sentry_sdk/tracing_utils.py 84.03% <100.00%> (+0.13%) ⬆️
sentry_sdk/integrations/httpx.py 92.10% <88.88%> (-0.76%) ⬇️

... and 1 file with indirect coverage changes

Copy link
Contributor

@sentrivana sentrivana left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Found a typo. Overall looks good to me. Can we also add an httpx test specifically for the scenario where we were accumulating baggage?

sentry_sdk/integrations/httpx.py Outdated Show resolved Hide resolved
@antonpirker antonpirker enabled auto-merge (squash) November 21, 2024 10:21
@antonpirker antonpirker self-assigned this Nov 21, 2024
@antonpirker antonpirker merged commit bd50c38 into master Nov 21, 2024
136 checks passed
@antonpirker antonpirker deleted the szokeasaurusrex/fix-baggage-httpx branch November 21, 2024 12:00
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
3 participants