Dramatiq
Learn how to import and use the Dramatiq integration.
The Dramatiq integration adds support for the Dramatiq background tasks library.
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, so we can take over maintenance.
To get started, install sentry-sdk
from PyPI.
pip install --upgrade sentry-sdk
Add DramatiqIntegration()
to your integrations
list:
In addition to capturing errors, you can monitor interactions between multiple services or applications by enabling tracing. You can also collect and analyze performance profiles from real users with profiling.
Select which Sentry features you'd like to install in addition to Error Monitoring to get the corresponding installation and configuration instructions below.
import sentry_sdk
from sentry_sdk.integrations.dramatiq import DramatiqIntegration
sentry_sdk.init(
dsn="https://examplePublicKey@o0.ingest.sentry.io/0",
# Set traces_sample_rate to 1.0 to capture 100%
# of transactions for tracing.
traces_sample_rate=1.0,
# Set profiles_sample_rate to 1.0 to profile 100%
# of sampled transactions.
# We recommend adjusting this value in production.
profiles_sample_rate=1.0,
integrations=[
DramatiqIntegration(),
],
)
Trigger an error in your code to verify that the integration is sending events to Sentry.
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.
- 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.
Our documentation is open source and available on GitHub. Your contributions are welcome, whether fixing a typo (drat!) or suggesting an update ("yeah, this would be better").