Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading