-
-
Notifications
You must be signed in to change notification settings - Fork 1.4k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Docs for new ARQ integration (#6363)
- Loading branch information
Showing
1 changed file
with
73 additions
and
0 deletions.
There are no files selected for viewing
This file contains 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,73 @@ | ||
--- | ||
title: ARQ | ||
description: "Learn about using Sentry with ARQ." | ||
--- | ||
|
||
The ARQ integration adds support for the [ARQ Job Queue System](https://arq-docs.helpmanual.io/). | ||
|
||
## Install | ||
|
||
Install `sentry-sdk` from PyPI with the `arq` extra. | ||
|
||
```bash | ||
pip install --upgrade "sentry-sdk[arq]" | ||
``` | ||
|
||
## Configure | ||
|
||
Job definition in `demo.py`: | ||
|
||
```python | ||
import sentry_sdk | ||
from sentry_sdk.integrations.arq import ArqIntegration | ||
|
||
|
||
sentry_sdk.init( | ||
dsn="...", | ||
integrations=[ | ||
ArqIntegration(), | ||
], | ||
traces_sample_rate=1.0, | ||
) | ||
|
||
|
||
async def add_numbers(ctx, a, b): | ||
return a + b | ||
|
||
|
||
class WorkerSettings: | ||
functions = [add_numbers] | ||
``` | ||
|
||
Running the jobs in `run.py`: | ||
|
||
```python | ||
import asyncio | ||
import sentry_sdk | ||
from sentry_sdk.integrations.arq import ArqIntegration | ||
from sentry_sdk.tracing import TRANSACTION_SOURCE_COMPONENT | ||
|
||
|
||
async def main(): | ||
sentry_sdk.init( | ||
dsn="...", | ||
integrations=[ | ||
ArqIntegration(), | ||
], | ||
traces_sample_rate=1.0, | ||
) | ||
|
||
redis = await create_pool(RedisSettings()) | ||
|
||
with sentry_sdk.start_transaction(name="testing_arq_jobs", source=TRANSACTION_SOURCE_COMPONENT): | ||
r = await redis.enqueue_job("download_content", 1, 2) | ||
|
||
|
||
if __name__ == "__main__": | ||
asyncio.run(main()) | ||
``` | ||
|
||
## Supported Versions | ||
|
||
- ARQ: 0.23+ | ||
- Python: 3.7+ |
25ceb77
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Successfully deployed to the following URLs:
sentry-docs – ./
docs.sentry.io
sentry-docs-git-master.sentry.dev
sentry-docs.sentry.dev