Skip to content

feat(crons): Add resque-scheduler monitoring - #3142

Draft
wedamija wants to merge 1 commit into
danf/cron-fugit-configfrom
danf/resque-scheduler-crons
Draft

wedamija wants to merge 1 commit into
danf/cron-fugit-configfrom
danf/resque-scheduler-crons

Conversation

@wedamija

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 an opt-in patch to sentry-resque for resque-scheduler's recurring schedules (cron and every, static and dynamic):

config.enabled_patches << :resque_scheduler
config.resque.exclude_scheduled_jobs = ["clear_cache", /^tmp_/]

Schedules in exclude_scheduled_jobs are skipped; strings match the schedule name, regexps are matched against it.

Each run sends in-progress and ok/error check-ins, with the schedule name as the slug and its schedule as the monitor config.

  • The slug comes from the schedule name, not the job class, so one class behind several schedules gets one monitor per schedule.
  • When the scheduler enqueues a schedule, the slug and schedule are added to the Resque payload. The worker sends the check-ins around Resque::Job#perform, so they cover the job itself rather than the enqueue.
  • The schedule is read from the rufus-scheduler job in the scheduler process, so the time zone matches: the zone in the cron line, then TZ / Time.zone, then the system zone.
  • Schedules that can't be expressed in the Crons schedule format (for example, a job that runs every 10 seconds) check in without a config.
  • resque-scheduler runs its schedules as unnamed rufus-scheduler blocks. This patch marks those rufus jobs with sentry_monitor: false, so with feat(crons): Add rufus-scheduler cron monitoring #3110's :rufus_scheduler patch also enabled they're skipped there instead of being reported twice or logging a warning.

Stacked on #3141. The lockfile changes only add resque-scheduler (already resolved through resque-retry) as a direct dev dependency.

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