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(aiohttp): Add failed_request_status_codes #3551

Merged

Conversation

szokeasaurusrex
Copy link
Member

@szokeasaurusrex szokeasaurusrex commented Sep 20, 2024

failed_request_status_codes allows users to specify the status codes, whose corresponding HTTPException types, should be reported to Sentry. By default, these include 5xx statuses, which is a change from the previous default behavior, where no HTTPExceptions would be reported to Sentry.

The status codes are only captured as errors if they are returned by raising an HTTPException. If a response with one of the failed_request_status_codes is returned, we would not report this to Sentry, as there is no exception object we can send and no easy way to create one.

Closes #3535

Copy link

codecov bot commented Sep 20, 2024

Codecov Report

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

Project coverage is 84.31%. Comparing base (8060a64) to head (e5edc23).
Report is 1 commits behind head on master.

✅ All tests successful. No failed tests found.

Files with missing lines Patch % Lines
sentry_sdk/integrations/aiohttp.py 85.71% 0 Missing and 1 partial ⚠️
Additional details and impacted files
@@           Coverage Diff           @@
##           master    #3551   +/-   ##
=======================================
  Coverage   84.30%   84.31%           
=======================================
  Files         133      133           
  Lines       13885    13890    +5     
  Branches     2929     2930    +1     
=======================================
+ Hits        11706    11711    +5     
  Misses       1438     1438           
  Partials      741      741           
Files with missing lines Coverage Δ
sentry_sdk/integrations/aiohttp.py 85.11% <85.71%> (+0.45%) ⬆️

@szokeasaurusrex szokeasaurusrex force-pushed the szokeasaurusrex/aiohttp-failed_request_status_codes branch from 2adb74e to 3ad9fa9 Compare September 20, 2024 12:40
@szokeasaurusrex szokeasaurusrex marked this pull request as ready for review September 20, 2024 12:53
@szokeasaurusrex szokeasaurusrex marked this pull request as draft September 20, 2024 13:45
@szokeasaurusrex szokeasaurusrex force-pushed the szokeasaurusrex/aiohttp-failed_request_status_codes branch from 3ad9fa9 to 4558c9a Compare September 20, 2024 15:45
@szokeasaurusrex szokeasaurusrex changed the base branch from master to szokeasaurusrex/aiohttp-bugfix September 20, 2024 15:45
@szokeasaurusrex szokeasaurusrex marked this pull request as ready for review September 20, 2024 15:45
Base automatically changed from szokeasaurusrex/aiohttp-bugfix to master September 23, 2024 08:11
`failed_request_status_codes` allows users to specify the status codes, whose corresponding `HTTPException` types, should be reported to Sentry. By default, these include 5xx statuses, which is a change from the previous default behavior, where no `HTTPException`s would be reported to Sentry.

Closes #3535
@szokeasaurusrex szokeasaurusrex force-pushed the szokeasaurusrex/aiohttp-failed_request_status_codes branch from 4558c9a to 87e4a7e Compare September 23, 2024 09:19
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.

LGTM

Please also add to the docs.

We should also think about what to do with the old-style failed_request_status_codes format that Starlette/FastAPI is using. We can deprecate it in favor of using a set and then do the switch with the new major.

@szokeasaurusrex szokeasaurusrex merged commit 7e4992a into master Sep 23, 2024
125 checks passed
@szokeasaurusrex szokeasaurusrex deleted the szokeasaurusrex/aiohttp-failed_request_status_codes branch September 23, 2024 15:04
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.

AioHttp failed_request_status_codes
2 participants