Skip to content

Commit 8b97b0b

Browse files
antonpirkervivianyentransentrivana
authored
[Python] Added dramatiq integration getting started (#11015)
Python SDK has a new integration for the Dramatiq background tasks library. --------- Co-authored-by: vivianyentran <[email protected]> Co-authored-by: Ivana Kellyer <[email protected]>
1 parent 46e1603 commit 8b97b0b

File tree

2 files changed

+91
-11
lines changed

2 files changed

+91
-11
lines changed
Lines changed: 80 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,80 @@
1+
---
2+
title: Dramatiq
3+
description: "Learn how to import and use the Dramatiq integration."
4+
---
5+
6+
The Dramatiq integration adds support for the
7+
[Dramatiq](https://dramatiq.io/) background tasks library.
8+
9+
<Alert level="info">
10+
This is the successor of the original `DramatiqIntegration` that can be found here: https://github.com/jacobsvante/sentry-dramatiq
11+
12+
The original maintainer has [donated the integration to Sentry](https://github.com/getsentry/sentry-python/issues/3387), so we can take over maintenance.
13+
</Alert>
14+
15+
## Install
16+
17+
To get started, install `sentry-sdk` from PyPI.
18+
19+
```bash
20+
pip install --upgrade sentry-sdk
21+
```
22+
23+
## Configure
24+
25+
Add `DramatiqIntegration()` to your `integrations` list:
26+
27+
<SignInNote />
28+
29+
In addition to capturing errors, you can monitor interactions between multiple services or applications by [enabling tracing](/concepts/key-terms/tracing/). You can also collect and analyze performance profiles from real users with [profiling](/product/explore/profiling/).
30+
31+
Select which Sentry features you'd like to install in addition to Error Monitoring to get the corresponding installation and configuration instructions below.
32+
33+
<OnboardingOptionButtons
34+
options={["error-monitoring", "performance", "profiling"]}
35+
/>
36+
37+
```python {"onboardingOptions": {"performance": "6-8", "profiling": "9-12"}}
38+
import sentry_sdk
39+
from sentry_sdk.integrations.dramatiq import DramatiqIntegration
40+
41+
sentry_sdk.init(
42+
dsn="___PUBLIC_DSN___",
43+
# Set traces_sample_rate to 1.0 to capture 100%
44+
# of transactions for tracing.
45+
traces_sample_rate=1.0,
46+
# Set profiles_sample_rate to 1.0 to profile 100%
47+
# of sampled transactions.
48+
# We recommend adjusting this value in production.
49+
profiles_sample_rate=1.0,
50+
integrations=[
51+
DramatiqIntegration(),
52+
],
53+
)
54+
```
55+
56+
## Verify
57+
58+
Trigger an error in your code to verify that the integration is sending events to Sentry.
59+
60+
```python
61+
import dramatiq
62+
63+
import sentry_sdk
64+
sentry_sdk.init(...) # same as above
65+
66+
@dramatiq.actor(max_retries=0)
67+
def dummy_actor(x, y):
68+
return x / y
69+
70+
dummy_actor.send(5, 0)
71+
```
72+
73+
Running this will create an error event (`ZeroDivisionError`) that you should be able to see in [sentry.io](https://sentry.io).
74+
75+
## Supported Versions
76+
77+
- Dramatiq: 1.13+
78+
- Python: 3.6+
79+
80+
<Include name="python-use-older-sdk-for-legacy-support.mdx" />

docs/platforms/python/integrations/index.mdx

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -45,17 +45,17 @@ The Sentry SDK uses integrations to hook into the functionality of popular libra
4545
| <LinkWithPlatformIcon platform="openai" label="OpenAI" url="/platforms/python/integrations/openai" /> ||
4646

4747
### Data Processing
48-
49-
| | **Auto-enabled** |
50-
| ---------------------------------------------------------------------------------------------------------------------- | :--------------: |
51-
| <LinkWithPlatformIcon platform="python.airflow" label="Apache Airflow" url="/platforms/python/integrations/airflow" /> | |
52-
| <LinkWithPlatformIcon platform="python.beam" label="Apache Beam" url="/platforms/python/integrations/beam" /> | |
53-
| <LinkWithPlatformIcon platform="python.spark" label="Apache Spark" url="/platforms/python/integrations/spark" /> | |
54-
| <LinkWithPlatformIcon platform="python.arq" label="ARQ" url="/platforms/python/integrations/arq" /> ||
55-
| <LinkWithPlatformIcon platform="python.celery" label="Celery" url="/platforms/python/integrations/celery" /> | |
56-
| <LinkWithPlatformIcon platform="python.huey" label="huey" url="/platforms/python/integrations/huey" /> ||
57-
| <LinkWithPlatformIcon platform="python.rq" label="RQ" url="/platforms/python/integrations/rq" /> ||
58-
| <LinkWithPlatformIcon platform="python.ray" label="Ray" url="/platforms/python/integrations/ray" /> | |
48+
| **Auto-enabled** |
49+
| ------------------------------------------------------------------------------------------------------------------------ | :--------------: |
50+
| <LinkWithPlatformIcon platform="python.airflow" label="Apache Airflow" url="/platforms/python/integrations/airflow" /> | |
51+
| <LinkWithPlatformIcon platform="python.beam" label="Apache Beam" url="/platforms/python/integrations/beam" /> | |
52+
| <LinkWithPlatformIcon platform="python.spark" label="Apache Spark" url="/platforms/python/integrations/spark" /> | |
53+
| <LinkWithPlatformIcon platform="python.arq" label="ARQ" url="/platforms/python/integrations/arq" /> | |
54+
| <LinkWithPlatformIcon platform="python.celery" label="Celery" url="/platforms/python/integrations/celery" /> ||
55+
| <LinkWithPlatformIcon platform="python.dramatiq" label="Dramatiq" url="/platforms/python/integrations/dramatiq" /> | |
56+
| <LinkWithPlatformIcon platform="python.huey" label="huey" url="/platforms/python/integrations/huey" /> ||
57+
| <LinkWithPlatformIcon platform="python.rq" label="RQ" url="/platforms/python/integrations/rq" /> ||
58+
| <LinkWithPlatformIcon platform="python.ray" label="Ray" url="/platforms/python/integrations/ray" /> | |
5959

6060
### Cloud Computing
6161

0 commit comments

Comments
 (0)