getsentry/sentry-python (sentry-sdk)
### [`v2.15.0`](https://redirect.github.com/getsentry/sentry-python/blob/HEAD/CHANGELOG.md#2150)
[Compare Source](https://redirect.github.com/getsentry/sentry-python/compare/2.14.0...2.15.0)
##### Integrations
- Configure HTTP methods to capture in ASGI/WSGI middleware and frameworks ([#3531](https://redirect.github.com/getsentry/sentry-python/issues/3531)) by [@antonpirker](https://redirect.github.com/antonpirker)
We've added a new option to the Django, Flask, Starlette and FastAPI integrations called `http_methods_to_capture`. This is a configurable tuple of HTTP method verbs that should create a transaction in Sentry. The default is `("CONNECT", "DELETE", "GET", "PATCH", "POST", "PUT", "TRACE",)`. `OPTIONS` and `HEAD` are not included by default.
Here's how to use it (substitute Flask for your framework integration):
```python
sentry_sdk.init(
integrations=[
FlaskIntegration(
http_methods_to_capture=("GET", "POST"),
),
],
)
```
- Django: Allow ASGI to use `drf_request` in `DjangoRequestExtractor` ([#3572](https://redirect.github.com/getsentry/sentry-python/issues/3572)) by [@PakawiNz](https://redirect.github.com/PakawiNz)
- Django: Don't let `RawPostDataException` bubble up ([#3553](https://redirect.github.com/getsentry/sentry-python/issues/3553)) by [@sentrivana](https://redirect.github.com/sentrivana)
- Django: Add `sync_capable` to `SentryWrappingMiddleware` ([#3510](https://redirect.github.com/getsentry/sentry-python/issues/3510)) by [@szokeasaurusrex](https://redirect.github.com/szokeasaurusrex)
- AIOHTTP: Add `failed_request_status_codes` ([#3551](https://redirect.github.com/getsentry/sentry-python/issues/3551)) by [@szokeasaurusrex](https://redirect.github.com/szokeasaurusrex)
You can now define a set of integers that will determine which status codes
should be reported to Sentry.
```python
sentry_sdk.init(
integrations=[
AioHttpIntegration(
failed_request_status_codes={403, *range(500, 600)},
)
]
)
```
Examples of valid `failed_request_status_codes`:
- `{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.
The default is `{*range(500, 600)}`, meaning that all 5xx status codes are reported to Sentry.
- AIOHTTP: Delete test which depends on AIOHTTP behavior ([#3568](https://redirect.github.com/getsentry/sentry-python/issues/3568)) by [@szokeasaurusrex](https://redirect.github.com/szokeasaurusrex)
- AIOHTTP: Handle invalid responses ([#3554](https://redirect.github.com/getsentry/sentry-python/issues/3554)) by [@szokeasaurusrex](https://redirect.github.com/szokeasaurusrex)
- FastAPI/Starlette: Support new `failed_request_status_codes` ([#3563](https://redirect.github.com/getsentry/sentry-python/issues/3563)) by [@szokeasaurusrex](https://redirect.github.com/szokeasaurusrex)
The format of `failed_request_status_codes` has changed from a list
of integers and containers to a set:
```python
sentry_sdk.init(
integrations=StarletteIntegration(
failed_request_status_codes={403, *range(500, 600)},
),
)
```
The old way of defining `failed_request_status_codes` will continue to work
for the time being. Examples of valid new-style `failed_request_status_codes`:
- `{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.
The default is `{*range(500, 600)}`, meaning that all 5xx status codes are reported to Sentry.
- FastAPI/Starlette: Fix `failed_request_status_codes=[]` ([#3561](https://redirect.github.com/getsentry/sentry-python/issues/3561)) by [@szokeasaurusrex](https://redirect.github.com/szokeasaurusrex)
- FastAPI/Starlette: Remove invalid `failed_request_status_code` tests ([#3560](https://redirect.github.com/getsentry/sentry-python/issues/3560)) by [@szokeasaurusrex](https://redirect.github.com/szokeasaurusrex)
- FastAPI/Starlette: Refactor shared test parametrization ([#3562](https://redirect.github.com/getsentry/sentry-python/issues/3562)) by [@szokeasaurusrex](https://redirect.github.com/szokeasaurusrex)
##### Miscellaneous
- Deprecate `sentry_sdk.metrics` ([#3512](https://redirect.github.com/getsentry/sentry-python/issues/3512)) by [@szokeasaurusrex](https://redirect.github.com/szokeasaurusrex)
- Add `name` parameter to `start_span()` and deprecate `description` parameter ([#3524](https://redirect.github.com/getsentry/sentry-python/issues/3524) & [#3525](https://redirect.github.com/getsentry/sentry-python/issues/3525)) by [@antonpirker](https://redirect.github.com/antonpirker)
- Fix `add_query_source` with modules outside of project root ([#3313](https://redirect.github.com/getsentry/sentry-python/issues/3313)) by [@rominf](https://redirect.github.com/rominf)
- Test more integrations on 3.13 ([#3578](https://redirect.github.com/getsentry/sentry-python/issues/3578)) by [@sentrivana](https://redirect.github.com/sentrivana)
- Fix trailing whitespace ([#3579](https://redirect.github.com/getsentry/sentry-python/issues/3579)) by [@sentrivana](https://redirect.github.com/sentrivana)
- Improve `get_integration` typing ([#3550](https://redirect.github.com/getsentry/sentry-python/issues/3550)) by [@szokeasaurusrex](https://redirect.github.com/szokeasaurusrex)
- Make import-related tests stable ([#3548](https://redirect.github.com/getsentry/sentry-python/issues/3548)) by [@BYK](https://redirect.github.com/BYK)
- Fix breadcrumb sorting ([#3511](https://redirect.github.com/getsentry/sentry-python/issues/3511)) by [@sentrivana](https://redirect.github.com/sentrivana)
- Fix breadcrumb timestamp casting and its tests ([#3546](https://redirect.github.com/getsentry/sentry-python/issues/3546)) by [@BYK](https://redirect.github.com/BYK)
- Don't use deprecated `logger.warn` ([#3552](https://redirect.github.com/getsentry/sentry-python/issues/3552)) by [@sentrivana](https://redirect.github.com/sentrivana)
- Fix Cohere API change ([#3549](https://redirect.github.com/getsentry/sentry-python/issues/3549)) by [@BYK](https://redirect.github.com/BYK)
- Fix deprecation message ([#3536](https://redirect.github.com/getsentry/sentry-python/issues/3536)) by [@antonpirker](https://redirect.github.com/antonpirker)
- Remove experimental `explain_plan` feature. ([#3534](https://redirect.github.com/getsentry/sentry-python/issues/3534)) by [@antonpirker](https://redirect.github.com/antonpirker)
- X-fail one of the Lambda tests ([#3592](https://redirect.github.com/getsentry/sentry-python/issues/3592)) by [@antonpirker](https://redirect.github.com/antonpirker)
- Update Codecov config ([#3507](https://redirect.github.com/getsentry/sentry-python/issues/3507)) by [@antonpirker](https://redirect.github.com/antonpirker)
- Update `actions/upload-artifact` to `v4` with merge ([#3545](https://redirect.github.com/getsentry/sentry-python/issues/3545)) by [@joshuarli](https://redirect.github.com/joshuarli)
- Bump `actions/checkout` from `4.1.7` to `4.2.0` ([#3585](https://redirect.github.com/getsentry/sentry-python/issues/3585)) by [@dependabot](https://redirect.github.com/dependabot)
Configuration
📅 Schedule: Branch creation - "before 4:00am on Sunday" in timezone Asia/Tokyo, Automerge - At any time (no schedule defined).
🚦 Automerge: Disabled by config. Please merge this manually once you are satisfied.
♻ Rebasing: Whenever PR becomes conflicted, or you tick the rebase/retry checkbox.
👻 Immortal: This PR will be recreated if closed unmerged. Get config help if that's undesired.
[ ] If you want to rebase/retry this PR, check this box
This PR contains the following updates:
>=3.9.5
->>=3.10.8
>=0.0.5
->>=0.0.8
>=2.8.0
->>=2.9.2
>=0.16.1
->>=0.17.0
>=2.7.0
->>=2.15.0
>=4.12.0
->>=4.12.2
Release Notes
getsentry/sentry-python (sentry-sdk)
### [`v2.15.0`](https://redirect.github.com/getsentry/sentry-python/blob/HEAD/CHANGELOG.md#2150) [Compare Source](https://redirect.github.com/getsentry/sentry-python/compare/2.14.0...2.15.0) ##### Integrations - Configure HTTP methods to capture in ASGI/WSGI middleware and frameworks ([#3531](https://redirect.github.com/getsentry/sentry-python/issues/3531)) by [@antonpirker](https://redirect.github.com/antonpirker) We've added a new option to the Django, Flask, Starlette and FastAPI integrations called `http_methods_to_capture`. This is a configurable tuple of HTTP method verbs that should create a transaction in Sentry. The default is `("CONNECT", "DELETE", "GET", "PATCH", "POST", "PUT", "TRACE",)`. `OPTIONS` and `HEAD` are not included by default. Here's how to use it (substitute Flask for your framework integration): ```python sentry_sdk.init( integrations=[ FlaskIntegration( http_methods_to_capture=("GET", "POST"), ), ], ) ``` - Django: Allow ASGI to use `drf_request` in `DjangoRequestExtractor` ([#3572](https://redirect.github.com/getsentry/sentry-python/issues/3572)) by [@PakawiNz](https://redirect.github.com/PakawiNz) - Django: Don't let `RawPostDataException` bubble up ([#3553](https://redirect.github.com/getsentry/sentry-python/issues/3553)) by [@sentrivana](https://redirect.github.com/sentrivana) - Django: Add `sync_capable` to `SentryWrappingMiddleware` ([#3510](https://redirect.github.com/getsentry/sentry-python/issues/3510)) by [@szokeasaurusrex](https://redirect.github.com/szokeasaurusrex) - AIOHTTP: Add `failed_request_status_codes` ([#3551](https://redirect.github.com/getsentry/sentry-python/issues/3551)) by [@szokeasaurusrex](https://redirect.github.com/szokeasaurusrex) You can now define a set of integers that will determine which status codes should be reported to Sentry. ```python sentry_sdk.init( integrations=[ AioHttpIntegration( failed_request_status_codes={403, *range(500, 600)}, ) ] ) ``` Examples of valid `failed_request_status_codes`: - `{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. The default is `{*range(500, 600)}`, meaning that all 5xx status codes are reported to Sentry. - AIOHTTP: Delete test which depends on AIOHTTP behavior ([#3568](https://redirect.github.com/getsentry/sentry-python/issues/3568)) by [@szokeasaurusrex](https://redirect.github.com/szokeasaurusrex) - AIOHTTP: Handle invalid responses ([#3554](https://redirect.github.com/getsentry/sentry-python/issues/3554)) by [@szokeasaurusrex](https://redirect.github.com/szokeasaurusrex) - FastAPI/Starlette: Support new `failed_request_status_codes` ([#3563](https://redirect.github.com/getsentry/sentry-python/issues/3563)) by [@szokeasaurusrex](https://redirect.github.com/szokeasaurusrex) The format of `failed_request_status_codes` has changed from a list of integers and containers to a set: ```python sentry_sdk.init( integrations=StarletteIntegration( failed_request_status_codes={403, *range(500, 600)}, ), ) ``` The old way of defining `failed_request_status_codes` will continue to work for the time being. Examples of valid new-style `failed_request_status_codes`: - `{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. The default is `{*range(500, 600)}`, meaning that all 5xx status codes are reported to Sentry. - FastAPI/Starlette: Fix `failed_request_status_codes=[]` ([#3561](https://redirect.github.com/getsentry/sentry-python/issues/3561)) by [@szokeasaurusrex](https://redirect.github.com/szokeasaurusrex) - FastAPI/Starlette: Remove invalid `failed_request_status_code` tests ([#3560](https://redirect.github.com/getsentry/sentry-python/issues/3560)) by [@szokeasaurusrex](https://redirect.github.com/szokeasaurusrex) - FastAPI/Starlette: Refactor shared test parametrization ([#3562](https://redirect.github.com/getsentry/sentry-python/issues/3562)) by [@szokeasaurusrex](https://redirect.github.com/szokeasaurusrex) ##### Miscellaneous - Deprecate `sentry_sdk.metrics` ([#3512](https://redirect.github.com/getsentry/sentry-python/issues/3512)) by [@szokeasaurusrex](https://redirect.github.com/szokeasaurusrex) - Add `name` parameter to `start_span()` and deprecate `description` parameter ([#3524](https://redirect.github.com/getsentry/sentry-python/issues/3524) & [#3525](https://redirect.github.com/getsentry/sentry-python/issues/3525)) by [@antonpirker](https://redirect.github.com/antonpirker) - Fix `add_query_source` with modules outside of project root ([#3313](https://redirect.github.com/getsentry/sentry-python/issues/3313)) by [@rominf](https://redirect.github.com/rominf) - Test more integrations on 3.13 ([#3578](https://redirect.github.com/getsentry/sentry-python/issues/3578)) by [@sentrivana](https://redirect.github.com/sentrivana) - Fix trailing whitespace ([#3579](https://redirect.github.com/getsentry/sentry-python/issues/3579)) by [@sentrivana](https://redirect.github.com/sentrivana) - Improve `get_integration` typing ([#3550](https://redirect.github.com/getsentry/sentry-python/issues/3550)) by [@szokeasaurusrex](https://redirect.github.com/szokeasaurusrex) - Make import-related tests stable ([#3548](https://redirect.github.com/getsentry/sentry-python/issues/3548)) by [@BYK](https://redirect.github.com/BYK) - Fix breadcrumb sorting ([#3511](https://redirect.github.com/getsentry/sentry-python/issues/3511)) by [@sentrivana](https://redirect.github.com/sentrivana) - Fix breadcrumb timestamp casting and its tests ([#3546](https://redirect.github.com/getsentry/sentry-python/issues/3546)) by [@BYK](https://redirect.github.com/BYK) - Don't use deprecated `logger.warn` ([#3552](https://redirect.github.com/getsentry/sentry-python/issues/3552)) by [@sentrivana](https://redirect.github.com/sentrivana) - Fix Cohere API change ([#3549](https://redirect.github.com/getsentry/sentry-python/issues/3549)) by [@BYK](https://redirect.github.com/BYK) - Fix deprecation message ([#3536](https://redirect.github.com/getsentry/sentry-python/issues/3536)) by [@antonpirker](https://redirect.github.com/antonpirker) - Remove experimental `explain_plan` feature. ([#3534](https://redirect.github.com/getsentry/sentry-python/issues/3534)) by [@antonpirker](https://redirect.github.com/antonpirker) - X-fail one of the Lambda tests ([#3592](https://redirect.github.com/getsentry/sentry-python/issues/3592)) by [@antonpirker](https://redirect.github.com/antonpirker) - Update Codecov config ([#3507](https://redirect.github.com/getsentry/sentry-python/issues/3507)) by [@antonpirker](https://redirect.github.com/antonpirker) - Update `actions/upload-artifact` to `v4` with merge ([#3545](https://redirect.github.com/getsentry/sentry-python/issues/3545)) by [@joshuarli](https://redirect.github.com/joshuarli) - Bump `actions/checkout` from `4.1.7` to `4.2.0` ([#3585](https://redirect.github.com/getsentry/sentry-python/issues/3585)) by [@dependabot](https://redirect.github.com/dependabot)Configuration
📅 Schedule: Branch creation - "before 4:00am on Sunday" in timezone Asia/Tokyo, Automerge - At any time (no schedule defined).
🚦 Automerge: Disabled by config. Please merge this manually once you are satisfied.
♻ Rebasing: Whenever PR becomes conflicted, or you tick the rebase/retry checkbox.
👻 Immortal: This PR will be recreated if closed unmerged. Get config help if that's undesired.
This PR was generated by Mend Renovate. View the repository job log.