Skip to content

Commit a068299

Browse files
docs(python): Mention async setup in getting started (#12871)
1 parent 3d72b71 commit a068299

File tree

1 file changed

+14
-0
lines changed

1 file changed

+14
-0
lines changed

docs/platforms/python/index.mdx

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -59,6 +59,20 @@ sentry_sdk.init(
5959
)
6060
```
6161

62+
However, in async applications, you need to call `sentry_sdk.init()` inside an `async` function to ensure async code is instrumented properly. We recommend calling `sentry_sdk.init()` at the beginning of the first `async` function you call, as demonstrated in the example below.
63+
64+
```python
65+
import asyncio
66+
import sentry_sdk
67+
68+
async def main():
69+
sentry_sdk.init(
70+
... # same as above
71+
)
72+
73+
asyncio.run(main())
74+
```
75+
6276
## Verify
6377

6478
Add this intentional error to your application to test that everything is working right away.

0 commit comments

Comments
 (0)