Skip to content

Commit 6aecffd

Browse files
authored
Added usage
Some code snippets on how to use the new integrations.
1 parent e5fea3b commit 6aecffd

File tree

1 file changed

+38
-1
lines changed

1 file changed

+38
-1
lines changed

CHANGELOG.md

Lines changed: 38 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,45 @@
44

55
### Various fixes & improvements
66

7-
- Update to FastAPI (#1513) by @antonpirker
87
- feat(starlette): add Starlette integration (#1441) by @sl0thentr0py
8+
9+
**Important:** Remove manual usage of `SentryAsgiMiddleware`! This is now done by the Starlette integration.
10+
11+
Usage:
12+
13+
```python
14+
from starlette.applications import Starlette
15+
16+
from sentry_sdk.integrations.starlette import StarletteIntegration
17+
18+
sentry_sdk.init(
19+
dsn="...",
20+
integrations=[StarletteIntegration()],
21+
)
22+
23+
app = Starlette(debug=True, routes=[...])
24+
```
25+
- feat(fastapi): add FastAPI integration (#829) by @antonpirker
26+
27+
**Important:** Remove manual usage of `SentryAsgiMiddleware`! This is now done by the FastAPI integration.
28+
29+
Usage:
30+
31+
```python
32+
from fastapi import FastAPI
33+
34+
from sentry_sdk.integrations.starlette import StarletteIntegration
35+
from sentry_sdk.integrations.fastapi import FastApiIntegration
36+
37+
sentry_sdk.init(
38+
dsn="...",
39+
integrations=[StarletteIntegration(), FastApiIntegration()],
40+
)
41+
42+
app = FastAPI()
43+
```
44+
45+
Yes, you have to add both, the `StarletteIntegration` **AND** the `FastApiIntegration`!
946
- fix: avoid sending empty Baggage header (#1507) by @intgr
1047
- fix: properly freeze Baggage object (#1508) by @intgr
1148
- docs: fix simple typo, collecter -> collector (#1505) by @timgates42

0 commit comments

Comments
 (0)