-
-
Notifications
You must be signed in to change notification settings - Fork 1.6k
[Python] Added dramatiq integration getting started #11015
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from all commits
Commits
Show all changes
5 commits
Select commit
Hold shift + click to select a range
39c7fd4
Added dramatiq integration getting started
antonpirker 8d7194a
Apply suggestions from code review
antonpirker 872e60b
Credit to original maintainer
antonpirker d1c3708
Update docs/platforms/python/integrations/dramatiq/index.mdx
antonpirker 795d11b
Merge branch 'master' into antonpirker/python/dramatiq
antonpirker File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,80 @@ | ||
--- | ||
title: Dramatiq | ||
description: "Learn how to import and use the Dramatiq integration." | ||
--- | ||
|
||
The Dramatiq integration adds support for the | ||
[Dramatiq](https://dramatiq.io/) background tasks library. | ||
|
||
<Alert level="info"> | ||
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. | ||
</Alert> | ||
|
||
## Install | ||
|
||
To get started, install `sentry-sdk` from PyPI. | ||
|
||
```bash | ||
pip install --upgrade sentry-sdk | ||
``` | ||
|
||
## Configure | ||
|
||
Add `DramatiqIntegration()` to your `integrations` list: | ||
|
||
<SignInNote /> | ||
|
||
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/). | ||
|
||
Select which Sentry features you'd like to install in addition to Error Monitoring to get the corresponding installation and configuration instructions below. | ||
|
||
<OnboardingOptionButtons | ||
options={["error-monitoring", "performance", "profiling"]} | ||
/> | ||
|
||
```python {"onboardingOptions": {"performance": "6-8", "profiling": "9-12"}} | ||
import sentry_sdk | ||
from sentry_sdk.integrations.dramatiq import DramatiqIntegration | ||
|
||
sentry_sdk.init( | ||
dsn="___PUBLIC_DSN___", | ||
# 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(), | ||
], | ||
) | ||
``` | ||
|
||
## 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 | ||
|
||
- Dramatiq: 1.13+ | ||
- Python: 3.6+ | ||
|
||
<Include name="python-use-older-sdk-for-legacy-support.mdx" /> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.