Skip to content

Commit

Permalink
docs: Update FastAPI/Starlette failed_request_status_codes docs (#1…
Browse files Browse the repository at this point in the history
…1435)

We have slightly changed the `failed_request_status_codes` API for FastAPI and Starlette in getsentry/sentry-python#3563. The old API is still supported, but it is deprecated, so the docs should only document the new API.
  • Loading branch information
szokeasaurusrex authored Oct 4, 2024
1 parent db77e2d commit 02ba09c
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 15 deletions.
16 changes: 8 additions & 8 deletions docs/platforms/python/integrations/fastapi/index.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -81,12 +81,12 @@ sentry_sdk.init(
integrations=[
StarletteIntegration(
transaction_style="endpoint",
failed_request_status_codes=[403, range(500, 599)],
failed_request_status_codes={403, *range(500, 599)},
http_methods_to_capture=("GET",),
),
FastApiIntegration(
transaction_style="endpoint",
failed_request_status_codes=[403, range(500, 599)],
failed_request_status_codes={403, *range(500, 599)},
http_methods_to_capture=("GET",),
),
]
Expand Down Expand Up @@ -132,16 +132,16 @@ You can pass the following keyword arguments to `StarletteIntegration()` and `Fa

- `failed_request_status_codes`:

A list of integers or containers (objects that allow membership checks via `in`)
of integers that will determine which status codes should be reported to Sentry.
A `set` of integers that will determine which status codes should be reported to Sentry.

Examples of valid `failed_request_status_codes`:

- `[500]` will only send events on HTTP 500.
- `[400, range(500, 599)]` will send events on HTTP 400 as well as the 500-599 range.
- `[500, 503]` will send events on HTTP 500 and 503.
- `{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, 599)]`.
The default is `{*range(500, 600)}`, meaning that all 5xx status codes are reported to Sentry.

- `http_methods_to_capture`:

Expand Down
14 changes: 7 additions & 7 deletions docs/platforms/python/integrations/starlette/index.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ sentry_sdk.init(
integrations=[
StarletteIntegration(
transaction_style="endpoint",
failed_request_status_codes=[403, range(500, 599)],
failed_request_status_codes={403, *range(500, 599)},
middleware_spans=False,
http_methods_to_capture=("GET",),
)
Expand Down Expand Up @@ -89,16 +89,16 @@ You can pass the following keyword arguments to `StarletteIntegration()`:

- `failed_request_status_codes`:

A list of integers or containers (objects that allow membership checks via `in`)
of integers that will determine which status codes should be reported to Sentry.
A `set` of integers that will determine which status codes should be reported to Sentry.

Examples of valid `failed_request_status_codes`:

- `[500]` will only send events on HTTP 500.
- `[400, range(500, 599)]` will send events on HTTP 400 as well as the 500-599 range.
- `[500, 503]` will send events on HTTP 500 and 503.
- `{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, 599)]`.
The default is `{*range(500, 600)}`, meaning that all 5xx status codes are reported to Sentry.

- `middleware_spans`:

Expand Down

0 comments on commit 02ba09c

Please sign in to comment.