You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: src/platforms/python/guides/quart/index.mdx
+34-13Lines changed: 34 additions & 13 deletions
Original file line number
Diff line number
Diff line change
@@ -3,18 +3,14 @@ title: Quart
3
3
description: "Learn about using Sentry with Quart."
4
4
---
5
5
6
-
The Quart integration adds support for the [Quart Web Framework](https://gitlab.com/pgjones/quart). We support Quart versions 0.16.1 and higher.
7
-
8
-
Requires `sentry-sdk` version `1.5.2` or higher.
9
-
10
-
A Python version of 3.7 or higher is also required.
6
+
The Quart integration adds support for the [Quart Web Framework](https://gitlab.com/pgjones/quart).
11
7
12
8
## Install
13
9
14
-
Install `sentry-sdk` from PyPI:
10
+
Install `sentry-sdk` from PyPI with the `quart` extra:
15
11
16
12
```bash
17
-
pip install --upgrade sentry-sdk
13
+
pip install --upgrade sentry-sdk[quart]
18
14
```
19
15
20
16
## Configure
@@ -24,25 +20,45 @@ To configure the SDK, initialize it with the integration before or after your ap
24
20
<SignInNote />
25
21
26
22
```python
23
+
from quart import Quart
24
+
27
25
import sentry_sdk
28
26
from sentry_sdk.integrations.quart import QuartIntegration
29
-
from quart import Quart
30
27
31
28
sentry_sdk.init(
32
29
dsn="___PUBLIC_DSN___",
33
-
integrations=[
34
-
QuartIntegration(),
35
-
],
36
-
37
30
# Set traces_sample_rate to 1.0 to capture 100%
38
31
# of transactions for performance monitoring.
39
-
# We recommend adjusting this value in production,
40
32
traces_sample_rate=1.0,
33
+
integrations=[
34
+
QuartIntegration(),
35
+
],
41
36
)
42
37
43
38
app = Quart(__name__)
44
39
```
45
40
41
+
# Verify
42
+
43
+
```python
44
+
from quart import Quart
45
+
46
+
sentry_sdk.init(...) # same as above
47
+
48
+
app = Quart(__name__)
49
+
50
+
@app.route("/")
51
+
asyncdefhello():
52
+
1/0# raises an error
53
+
return {"hello": "world"}
54
+
55
+
app.run()
56
+
```
57
+
58
+
When you point your browser to [http://localhost:5000/](http://localhost:5000/) a transaction in the Performance section of [sentry.io](https://sentry.io) will be created. Additionally, an error event will be sent to [sentry.io](https://sentry.io) and will be connected to the transaction.
59
+
60
+
It takes a couple of moments for the data to appear in [sentry.io](https://sentry.io).
61
+
46
62
## Behavior
47
63
48
64
- The Sentry Python SDK will install the Quart integration for all of your apps.
@@ -54,3 +70,8 @@ app = Quart(__name__)
54
70
- Each request has a separate scope. Changes to the scope within a view, for example setting a tag, will only apply to events sent as part of the request being handled.
55
71
56
72
- Logging with any logger will create breadcrumbs when the [Logging](/platforms/python/guides/logging/) integration is enabled (done by default).
0 commit comments