Skip to content

Commit 8619b36

Browse files
docs(bottle): Document failed_request_status_codes (#11515)
* docs(bottle): Document `failed_request_status_codes` * Update wording
1 parent 4dd1938 commit 8619b36

File tree

1 file changed

+17
-0
lines changed
  • docs/platforms/python/integrations/bottle

1 file changed

+17
-0
lines changed

docs/platforms/python/integrations/bottle/index.mdx

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -67,6 +67,7 @@ sentry_sdk.init(
6767
integrations=[
6868
BottleIntegration(
6969
transaction_style="endpoint",
70+
failed_request_status_codes={*range(500, 600)},
7071
),
7172
],
7273
)
@@ -90,6 +91,22 @@ def myendpoint():
9091
- If you set `transaction_style="endpoint"`, the transaction name will be `"myendpoint"`, since that is the route handler function's name.
9192
- If you set `transaction_style="url"`, the transaction name will be `"/myurl/<foo>"`, since that is the URL path.
9293

94+
95+
### `failed_request_status_codes`
96+
97+
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.
98+
99+
Examples of valid values for `failed_request_status_codes`:
100+
101+
- `{500}` will only report `HTTPResponse` with status 500.
102+
- `{400, *range(500, 600)}` will report `HTTPResponse` with status 400 as well as those in the 5xx range.
103+
- `set()` (the empty set) will not report any `HTTPResponse` to Sentry.
104+
105+
The default is `{*range(500, 600)}`, meaning that any `HTTPResponse` with a status in the 5xx range is reported to Sentry.
106+
107+
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()`.
108+
109+
93110
## Supported Versions
94111

95112
- Bottle: 0.12.13+

0 commit comments

Comments
 (0)