Skip to content

feat(arq): Add an option to monitor arq cron jobs - #8051

Merged
wedamija merged 4 commits into
masterfrom
danf/arq-crons
Oct 20, 2026
Merged

wedamija merged 4 commits into
masterfrom
danf/arq-crons

Conversation

@wedamija

@wedamija wedamija commented Oct 17, 2026 •

Copy link
Copy Markdown
Member

Part of a series adding automatic Crons monitoring for the most-used job schedulers in each SDK. Check-ins for a monitor that doesn't exist yet are dropped, so today each monitor has to be created by hand with its schedule copied from the code. Sending the job's schedule as the monitor config lets Sentry create the monitor and keep it in sync.

This adds monitor_cron_jobs to ArqIntegration, matching Celery's monitor_beat_tasks. When it's on, each cron(...) job sends check-ins with its schedule in the worker's timezone, so Sentry creates the monitor on the first run. The slug is the job name without arq's cron: prefix. It's off by default.

sentry_sdk.init(
    integrations=[ArqIntegration(monitor_cron_jobs=True, exclude_cron_jobs=["cleanup"])],
)

Jobs check in without a config when Crons can't express the schedule: a second other than 0, both day and weekday set, or a UTC offset that isn't a whole number of hours. Before arq 0.25, the config is only sent when the system timezone is UTC.

Docs: getsentry/sentry-docs#20056

Send check-ins around each run of an arq cron job when
ArqIntegration(monitor_cron_jobs=True) is set. The cron job's schedule is
sent as the monitor config when it maps to a crontab in an IANA timezone,
so Sentry creates the monitor and keeps it in sync.

Co-Authored-By: Claude <[email protected]>
Comment thread sentry_sdk/integrations/arq.py
@github-actions

github-actions Bot commented Oct 17, 2026 •

Copy link
Copy Markdown
Contributor

Coverage Results 📊

✅ 133854 passed | ⏭️ 7294 skipped | Total: 141148 | Pass Rate: 94.83% | Execution Time: 442m 55s

📊 Comparison with Base Branch

Metric Change
Total Tests 📈 +206
Passed Tests 📈 +188
Failed Tests —
Skipped Tests 📈 +18

All tests are passing successfully.

✅ Patch coverage is 94.81% (73 of 77 changed executable lines covered; target 80%).
Project statement coverage is 90.24% (down 0.01 percentage points from base (0f7acd5) to head (9b8ca99)).

Changed files with executable lines (1)
File Patch coverage Changed executable lines
sentry_sdk/integrations/arq.py 94.81% 73/77 covered; missed: 361, 363, 391, 416; partial branches: 360, 362, 390, 409
Coverage diff
@@            Coverage Diff             @@
##        master     #8051       +/-##
==========================================
- Coverage    90.25%    90.24%    -0.01%
==========================================
  Files          202       202         —
  Tracked lines     26660     26736       +76
  Branches      9926      9968       +42
==========================================
+ Hits         24062     24127       +65
- Misses        2598      2609       +11
- Partials      1510      1514        +4

Generated by Coverage Action

@sentrivana sentrivana left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@wedamija LGTM, thanks! Any reason this is still in draft, or can I merge?

@wedamija wedamija changed the title feat(arq): Add cron monitoring for arq cron jobs feat(arq): Add an option to monitor arq cron jobs Oct 20, 2026
@wedamija
wedamija marked this pull request as ready for review October 20, 2026 22:08
@wedamija
wedamija requested a review from a team as a code owner October 20, 2026 22:08
@wedamija

Copy link
Copy Markdown
Member Author

@wedamija LGTM, thanks! Any reason this is still in draft, or can I merge?

I wanted to just do a few checks before I bugged anyone to review it! All good, I'll merge it now

@wedamija
wedamija merged commit a9553c4 into master Oct 20, 2026
168 checks passed
@wedamija
wedamija deleted the danf/arq-crons branch October 20, 2026 22:09
@linear-code

linear-code Bot commented Oct 21, 2026

Copy link
Copy Markdown

PY-117

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants