From 2c1e0027e774d781f93a882280ab31c80eb13029 Mon Sep 17 00:00:00 2001 From: Dan Fuller Date: Fri, 2 Oct 2026 13:17:54 -0700 Subject: [PATCH] docs(python): Add RQ cron monitoring page Document the opt-in RqIntegration(monitor_cron_jobs=True) for jobs scheduled with rq cron, and link it from the RQ page and the Python crons page. Co-Authored-By: Claude Opus 5.5 --- .../python/integrations/rq/crons.mdx | 45 +++++++++++++++++++ .../python/integrations/rq/index.mdx | 4 ++ platform-includes/crons/setup/python.mdx | 2 + 3 files changed, 51 insertions(+) create mode 100644 docs/platforms/python/integrations/rq/crons.mdx diff --git a/docs/platforms/python/integrations/rq/crons.mdx b/docs/platforms/python/integrations/rq/crons.mdx new file mode 100644 index 0000000000000..6e7c693046d70 --- /dev/null +++ b/docs/platforms/python/integrations/rq/crons.mdx @@ -0,0 +1,45 @@ +--- +title: Crons +description: "Learn how to monitor RQ cron jobs with Sentry Crons." +--- + +The RQ integration can monitor jobs scheduled with [RQ's cron scheduler](https://python-rq.org/docs/cron/) (`rq cron`) using [Sentry Crons](/product/monitors-and-alerts/monitors/crons/). You get alerted when a job doesn't run on time, fails, or runs too long. + + + This is available from the next SDK release after `2.71.0`, and needs RQ 2.4 or newer. + + +## Configure + +Monitoring is off by default. Set `monitor_cron_jobs=True` on `RqIntegration` in your cron configuration file, which `rq cron` loads on startup: + +```python {filename:cron_config.py} +import sentry_sdk +from sentry_sdk.integrations.rq import RqIntegration +from rq import cron + +from myapp import send_newsletter + +sentry_sdk.init( + dsn="___PUBLIC_DSN___", + integrations=[ + RqIntegration(monitor_cron_jobs=True), + ], +) + +cron.register(send_newsletter, queue_name="email", cron="30 10 * * 2") +``` + +Your workers also need to initialize Sentry, as described on the RQ integration page. The scheduler sends a check-in when it enqueues a job, and the worker sends one when the job finishes or fails. + +Each cron job gets a monitor, created the first time the job runs. The monitor slug is the cron job's `name`, which defaults to the function's import path, like `myapp.send_newsletter`. + +The schedule comes from the cron job: + +- `cron`: a crontab schedule in UTC. Crontabs with a seconds field aren't monitored. +- `interval`: an interval schedule. Intervals must be whole minutes. + +## Supported Versions + +- RQ: 2.4+ +- Python: 3.9+ diff --git a/docs/platforms/python/integrations/rq/index.mdx b/docs/platforms/python/integrations/rq/index.mdx index 31556fde89f97..ee2f30658cb3c 100644 --- a/docs/platforms/python/integrations/rq/index.mdx +++ b/docs/platforms/python/integrations/rq/index.mdx @@ -190,6 +190,10 @@ If you run the RQ worker with `rq worker -c mysettings`, a transaction for the e It takes a couple of moments for the data to appear in [sentry.io](https://sentry.io). +## Crons + +To monitor jobs scheduled with `rq cron`, see RQ Crons. + ## The `--sentry-dsn` CLI option The `--sentry-dsn` CLI option has been removed from RQ. Initialize the Sentry SDK directly in your worker settings file (e.g. `mysettings.py`) as shown above. diff --git a/platform-includes/crons/setup/python.mdx b/platform-includes/crons/setup/python.mdx index 27e90b390e83e..e419849ebee83 100644 --- a/platform-includes/crons/setup/python.mdx +++ b/platform-includes/crons/setup/python.mdx @@ -2,6 +2,8 @@ If you're using **Celery Beat** to run your periodic tasks, have a look at our [Celery Beat Auto Discovery documentation](/platforms/python/integrations/celery/crons/). +If you're using **RQ's cron scheduler** (`rq cron`), see [RQ Crons](/platforms/python/integrations/rq/crons/). + ## Job Monitoring Use the Python SDK to monitor and notify you if your periodic task is missed (or doesn't start when expected), if it fails due to a problem in the runtime (such as an error), or if it fails by exceeding its maximum runtime.