Skip to content

Commit

Permalink
docs(bottle): Document failed_request_status_codes (#11515)
Browse files Browse the repository at this point in the history
* docs(bottle): Document `failed_request_status_codes`

* Update wording
  • Loading branch information
szokeasaurusrex authored Oct 14, 2024
1 parent 4dd1938 commit 8619b36
Showing 1 changed file with 17 additions and 0 deletions.
17 changes: 17 additions & 0 deletions docs/platforms/python/integrations/bottle/index.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,7 @@ sentry_sdk.init(
integrations=[
BottleIntegration(
transaction_style="endpoint",
failed_request_status_codes={*range(500, 600)},
),
],
)
Expand All @@ -90,6 +91,22 @@ def myendpoint():
- If you set `transaction_style="endpoint"`, the transaction name will be `"myendpoint"`, since that is the route handler function's name.
- If you set `transaction_style="url"`, the transaction name will be `"/myurl/<foo>"`, since that is the URL path.


### `failed_request_status_codes`

A `set` of integers that will determine when an [`HTTPResponse`](https://bottlepy.org/docs/dev/api.html#bottle.HTTPResponse), which is raised or returned by the request handler, should be reported to Sentry. The `HTTPResponse` is reported to Sentry if its status code is contained in the `failed_request_status_codes` set.

Examples of valid values for `failed_request_status_codes`:

- `{500}` will only report `HTTPResponse` with status 500.
- `{400, *range(500, 600)}` will report `HTTPResponse` with status 400 as well as those in the 5xx range.
- `set()` (the empty set) will not report any `HTTPResponse` to Sentry.

The default is `{*range(500, 600)}`, meaning that any `HTTPResponse` with a status in the 5xx range is reported to Sentry.

Regardless of how `failed_request_status_codes` is configured, any non-`HTTPResponse` exceptions raised by the handler are reported to Sentry. For example, if your request handler raises an unhandled `AttributeError`, the `AttributeError` gets reported to Sentry, even if you have set `failed_request_status_codes=set()`.


## Supported Versions

- Bottle: 0.12.13+
Expand Down

0 comments on commit 8619b36

Please sign in to comment.