---
title: "arq"
description: "Learn about using Sentry with arq."
url: https://docs.sentry.io/platforms/python/integrations/arq/
---

# arq | Sentry for Python

The arq integration adds support for the [arq job queue system](https://arq-docs.helpmanual.io/).

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

Install `sentry-sdk` from PyPI:

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

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

If you have the `arq` package in your dependencies, the arq integration will be enabled automatically when you initialize the Sentry SDK.

Error Monitoring\[ ]Tracing\[ ]Profiling\[ ]Logs

```python
import sentry_sdk

sentry_sdk.init(
    dsn="___PUBLIC_DSN___",
    # 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,
    # ___PRODUCT_OPTION_START___ performance
    # Set traces_sample_rate to 1.0 to capture 100%
    # of transactions for tracing.
    traces_sample_rate=1.0,
    # ___PRODUCT_OPTION_END___ performance
    # ___PRODUCT_OPTION_START___ profiling
    # To collect profiles for all profile sessions,
    # set `profile_session_sample_rate` to 1.0.
    profile_session_sample_rate=1.0,
    # Profiles will be automatically collected while
    # there is an active span.
    profile_lifecycle="trace",
    # ___PRODUCT_OPTION_END___ profiling
    # ___PRODUCT_OPTION_START___ logs

    # Enable logs to be sent to Sentry
    enable_logs=True,
    # ___PRODUCT_OPTION_END___ logs
)
```

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

### [Enqueuing the jobs in `run.py`:](https://docs.sentry.io/platforms/python/integrations/arq.md#enqueuing-the-jobs-in-runpy)

```python
import asyncio

from arq import create_pool
from arq.connections import RedisSettings

async def main():
    sentry_sdk.init(...)  # same as above
    redis = await create_pool(RedisSettings())

    with sentry_sdk.start_transaction(name="testing_sentry"):
        r = await redis.enqueue_job("add_numbers", 1, 2)

asyncio.run(main())
```

When you run `run.py` it will create a transaction called `testing_sentry` in the Performance section of [sentry.io](https://sentry.io), and create a span for enqueuing the job.

It takes a couple of moments for the data to appear in [sentry.io](https://sentry.io).

### [Job definition in `demo.py`:](https://docs.sentry.io/platforms/python/integrations/arq.md#job-definition-in-demopy)

```python
import sentry_sdk
from sentry_sdk.integrations.arq import ArqIntegration

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

async def add_numbers(ctx, a, b):
    1/0 # raises an error!
    return a + b

class WorkerSettings:
    functions = [add_numbers]
```

When you run a worker with `arq demo.WorkerSettings` it will create a transaction called `add_numbers` in the Performance section of [sentry.io](https://sentry.io), and will also create and issue in Sentry and connect it to the transaction.

It takes a couple of moments for the data to appear in [sentry.io](https://sentry.io).

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

* ARQ: 0.23+
* Python: 3.7+
