Skip to content

Commit bc5b16f

Browse files
szokeasaurusrexgetsantry[bot]shanamatthews
authored
Sanic performance options documentation (#8201)
* Sanic performance options documentation * style(lint): Auto commit lint changes * Apply suggestions from code review Co-authored-by: Shana Matthews <[email protected]> --------- Co-authored-by: getsantry[bot] <66042841+getsantry[bot]@users.noreply.github.com> Co-authored-by: Shana Matthews <[email protected]>
1 parent f1b77d1 commit bc5b16f

File tree

1 file changed

+27
-0
lines changed
  • src/platforms/python/common/integrations/sanic

1 file changed

+27
-0
lines changed

src/platforms/python/common/integrations/sanic/index.mdx

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,33 @@ sentry_sdk.init(
4141
app = Sanic(__name__)
4242
```
4343

44+
### Configuration options
45+
46+
If you're using performance monitoring, you can configure the Sanic integration to not send transactions for requests that resulted in certain HTTP statuses using the `unsampled_statuses` option.
47+
48+
By default, the Sanic integration generates transactions for all requests, except requests that result in a 404 HTTP status. To generate transactions for all HTTP statuses, including 404, or change which HTTP statuses don't generate transactions, you can manually instantiate the Sanic integration when initializing the Sentry SDK, like so:
49+
50+
```python
51+
from sanic import Sanic
52+
import sentry_sdk
53+
from sentry_sdk.integrations.sanic import SanicIntegration
54+
55+
sentry_sdk.init(
56+
dsn="___PUBLIC_DSN___",
57+
58+
# Configure the Sanic integration so that we
59+
# generate transactions for all HTTP statuses,
60+
# including 404
61+
integrations=[SanicIntegration(unsampled_statuses=None)]
62+
63+
# Set traces_sample_rate to 1.0 to capture 100%
64+
# of transactions for performance monitoring.
65+
traces_sample_rate=1.0,
66+
)
67+
```
68+
69+
To specify a different set of HTTP statuses for which no transactions should be generated, set `unsampled_statuses` to a set containing the HTTP statuses that don't generate transactions. For example, if you wish to have no transactions for requests resulting in a 200 or 404 HTTP status, use `SanicIntegration(unsampled_statuses={200, 400})`.
70+
4471
## Verify
4572

4673
```python

0 commit comments

Comments
 (0)