Skip to content

feat(crons): Add rufus-scheduler cron monitoring - #3110

Draft
wedamija wants to merge 2 commits into
masterfrom
danf/rufus-scheduler-crons
Draft

wedamija wants to merge 2 commits into
masterfrom
danf/rufus-scheduler-crons

Conversation

@wedamija

@wedamija wedamija commented Oct 3, 2026 •

Copy link
Copy Markdown
Member

Description

Adds an opt-in :rufus_scheduler patch that sends Crons check-ins around rufus-scheduler jobs: in_progress before the block, then ok or error with the duration. Errors are still handed to rufus's on_error.

config.enabled_patches << :rufus_scheduler

cron and every jobs send their schedule as the monitor config, so Sentry creates the monitor or updates its schedule. When Sentry would read a schedule differently (fugit-only cron syntax, an every that isn't whole minutes, interval jobs, which wait after each run), check-ins go out without a config rather than with a schedule that would cause false missed-check-in alerts. One-off in/at jobs aren't monitored.

The slug comes from the name: option, or the handler's class or method; job ids are random per process. Unnamed blocks aren't monitored, and sentry_monitor: false skips a job. sidekiq-scheduler jobs are left to :sidekiq_scheduler.

Motivation

Check-ins for a monitor that doesn't exist yet are dropped, so rufus-scheduler users have to create each monitor by hand and add check-ins to every job. The schedule is already in the code, so the SDK can send it and monitors are created and kept in sync automatically.

Testing

spec/sentry/rufus_scheduler_spec.rb. The lockfiles add rufus-scheduler for the specs.

Docs: getsentry/sentry-docs#19789

Opt-in via `config.enabled_patches << :rufus_scheduler`. Sends
in_progress/ok/error check-ins for cron, every and interval jobs, with a
monitor config for cron and fixed-interval every jobs.

Co-Authored-By: Claude <noreply@anthropic.com>
Run the job unmonitored when building the monitor fails, name method
handlers after their owner and method, skip unnamed blocks with a log
asking for name:, send only IANA time zones, and keep the first 50
characters of long slugs.

Co-Authored-By: Claude <noreply@anthropic.com>
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.

1 participant