# Dramatiq | Sentry for Python

The Dramatiq integration adds support for the [Dramatiq](https://dramatiq.io/) background tasks library.

The Dramatiq integration only reports errors. Tracing is not yet supported. If you want to have more instrumentation, you need to do [custom instrumentation](https://docs.sentry.io/platforms/python/tracing/instrumentation/custom-instrumentation.md).

This is the successor of the original `DramatiqIntegration` that can be found here: <https://github.com/jacobsvante/sentry-dramatiq>

The original maintainer has [donated the integration to Sentry](https://github.com/getsentry/sentry-python/issues/3387), so we can take over maintenance.

## [Install](https://docs.sentry.io/platforms/python/integrations/dramatiq.md#install)

To get started, install `sentry-sdk` from PyPI.

```bash
pip install "sentry-sdk"
```

## [Configure](https://docs.sentry.io/platforms/python/integrations/dramatiq.md#configure)

Add `DramatiqIntegration()` to your `integrations` list:

```python
import sentry_sdk
from sentry_sdk.integrations.dramatiq import DramatiqIntegration

sentry_sdk.init(
    dsn="https://examplePublicKey@o0.ingest.sentry.io/0",
    # Add data like request headers and IP for users, if applicable;
    # see https://docs.sentry.io/platforms/python/data-management/data-collected/ for more info
    send_default_pii=True,
    integrations=[
        DramatiqIntegration(),
    ],
)
```

## [Verify](https://docs.sentry.io/platforms/python/integrations/dramatiq.md#verify)

Trigger an error in your code to verify that the integration is sending events to Sentry.

```python
import dramatiq

import sentry_sdk
sentry_sdk.init(...)  # same as above

@dramatiq.actor(max_retries=0)
def dummy_actor(x, y):
    return x / y

dummy_actor.send(5, 0)
```

Running this will create an error event (`ZeroDivisionError`) that you should be able to see in [sentry.io](https://sentry.io).

## [Supported Versions](https://docs.sentry.io/platforms/python/integrations/dramatiq.md#supported-versions)

* Dramatiq: 1.13+
* Python: 3.6+

The versions above apply for Sentry Python SDK version `2.0+`, which drops support for some legacy Python and framework versions. If you're looking to use Sentry with older Python or framework versions, consider using an SDK version from the `1.x` major line of releases.
