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

Set level based on status code for HTTP client breadcrumbs #4004

Open
wants to merge 7 commits into
base: master
Choose a base branch
from

Conversation

sentrivana
Copy link
Contributor

@sentrivana sentrivana commented Jan 29, 2025

  • add logic to maybe_create_breadcrumbs_from_span to set the level of the breadcrumb to warning for the client error range (4xx) and to error for server errors (5xx)
  • add functionality to the simple HTTP server that we use in some tests to respond with a specific error code
    • we were (and are) still "using" responses in multiple places, but they're not actually active (the activate decorator is missing) and we're making actual requests outside -- we should clean this up
    • we also can't use responses for stdlib/requests tests since they patch something that we patch
  • add httpx, stdlib, requests, aiohttp tests for the new behavior
    • restrict the requests tests to 3.7+ since in 3.6, the span is finished before the HTTP status is set for some reason...

Closes #4000

Copy link

codecov bot commented Jan 31, 2025

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 80.22%. Comparing base (8c25c73) to head (fd6cb87).

✅ All tests successful. No failed tests found.

Additional details and impacted files
@@            Coverage Diff             @@
##           master    #4004      +/-   ##
==========================================
+ Coverage   80.16%   80.22%   +0.05%     
==========================================
  Files         139      139              
  Lines       15397    15406       +9     
  Branches     2597     2601       +4     
==========================================
+ Hits        12343    12359      +16     
+ Misses       2210     2202       -8     
- Partials      844      845       +1     
Files with missing lines Coverage Δ
sentry_sdk/tracing_utils.py 84.42% <100.00%> (+0.39%) ⬆️

... and 5 files with indirect coverage changes

@sentrivana sentrivana marked this pull request as ready for review January 31, 2025 12:10
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.

Set HTTP client breadcrumbs log level based on status code
1 participant