sentry-python icon indicating copy to clipboard operation
sentry-python copied to clipboard

Add `failed_request_status_codes` for more web frameworks

Open sentrivana opened this issue 1 year ago • 2 comments

We started supporting failed_request_status_code for Starlette/FastAPI in https://github.com/getsentry/sentry-python/pull/3008. We should add the option to other web frameworks as well.

  • [ ] Django
  • [ ] Flask
  • [x] FastAPI
  • [x] #3535
  • [x] #3576
  • [ ] Falcon
  • [ ] Pyramid
  • [ ] Quart
  • [ ] Sanic
  • [x] Starlette
  • [x] Litestar
  • [ ] Tornado

Note that this might be tricky since we don't alert based on status codes in some frameworks, but rather internal exceptions happening in request handlers.

Failed request status codes

failed_request_status_codes is a set of status codes. Examples:

  • {500} will only send events on HTTP 500.
  • {400, *range(500, 600)} will send events on HTTP 400 as well as the 5xx range.
  • {500, 503} will send events on HTTP 500 and 503.
  • set() (the empty set) will not send events for any HTTP status code.

sentrivana avatar Jun 05 '24 10:06 sentrivana

Having this feature for the Django integration would be very helpful to us, if possible

syserr0r avatar Jun 07 '24 09:06 syserr0r

Note that this might be tricky since we don't alert based on status codes in some frameworks, but rather internal exceptions happening in request handlers.

We will first implement this feature for any frameworks where we do alert based on status codes, before moving onto frameworks where we capture the exceptions

szokeasaurusrex avatar Sep 06 '24 12:09 szokeasaurusrex