ARQ
The ARQ integration adds support for the ARQ Job Queue System.
Install
Install sentry-sdk
from PyPI with the arq
extra.
Copied
pip install --upgrade "sentry-sdk[arq]"
Configure
Job definition in demo.py
:
Copied
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
:
Copied
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+
Help improve this content
Our documentation is open source and available on GitHub. Your contributions are welcome, whether fixing a typo (drat!) to suggesting an update ("yeah, this would be better").
Our documentation is open source and available on GitHub. Your contributions are welcome, whether fixing a typo (drat!) to suggesting an update ("yeah, this would be better").
- Package:
- pypi:sentry-sdk
- Version:
- 1.17.0
- Repository:
- https://github.com/getsentry/sentry-python