Repository navigation
feat(rq): Add an option to monitor rq-scheduler jobs - #8053
Merged
Merged
Conversation
Send check-ins around each run of a job that rq-scheduler re-enqueues (scheduler.cron() and scheduler.schedule(interval=...)) when RqIntegration(monitor_cron_jobs=True) is set. The schedule is sent as the monitor config when Sentry reads it the same way, so Sentry creates the monitor and keeps it in sync. One-off jobs (enqueue_at, enqueue_in) are not monitored. Co-Authored-By: Claude <[email protected]>
1 of 3 tasks
Co-Authored-By: Claude <[email protected]>
Contributor
Coverage Results 📊✅ 134037 passed | ⏭️ 7317 skipped | Total: 141354 | Pass Rate: 94.82% | Execution Time: 441m 7s 📊 Comparison with Base Branch
➖ Removed Tests (58)View removed tests
All tests are passing successfully. ✅ Patch coverage is 98.96% (95 of 96 changed executable lines covered; target 80%). Changed files with executable lines (2)
Coverage diff@@ Coverage Diff @@
## master #8053 +/-##
==========================================
+ Coverage 90.26% 90.27% +0.01%
==========================================
Files 202 203 +1
Tracked lines 26660 26813 +153
Branches 9926 10008 +82
==========================================
+ Hits 24062 24204 +142
- Misses 2598 2609 +11
- Partials 1510 1515 +5Generated by Coverage Action |
Co-Authored-By: Claude <[email protected]>
sentrivana
requested changes
Oct 20, 2026
sentrivana
left a comment
Collaborator
There was a problem hiding this comment.
Ty, left a few comments 🙏🏻
rq-scheduler's crontab parser and Sentry disagree on `n/step` in day of week, single-value ranges like `0-0` and wrapping ranges like `5-1` (which Sentry rejects). Those jobs now check in without a config. Also move the interval conversion to `sentry_sdk/crons/utils.py` (same helper as the APScheduler integration), drop the warning for jobs without an `id`, inline the closing check-in and move the module constants up. Co-Authored-By: Claude <[email protected]>
Match the Celery beat integration: skip jobs whose schedule can't be expressed as a Sentry Crons monitor config instead of sending check-ins without one. Also close the in_progress check-in with an error if perform_job raises. Co-Authored-By: Claude <[email protected]>
Close the check-in in a finally block instead of a helper, and keep the job body in place. Co-Authored-By: Claude <[email protected]>
This file contains hidden or 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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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_jobstoRqIntegrationfor recurring jobs from rq-scheduler'sscheduler.cron(...)andscheduler.schedule(..., interval=...). Only the worker needs the option, and it sends the cron string or interval as the monitor config. The slug is the jobid, and jobs without one share a monitor named after the function's import path. It's off by default.Jobs aren't monitored when Sentry may read the cron string differently (6 fields,
@daily,MON, both day fields set), the interval isn't whole minutes, the job hasrepeat, or the worker's local timezone isn't UTC. RQ's built-inrq cronscheduler isn't covered.The rq test envs now install
rq-schedulerfor RQ 2.x.Docs: getsentry/sentry-docs#20058