Skip to content

ref(crons): Add Fugit schedule conversion helper - #3141

Merged
sl0thentr0py merged 3 commits into
masterfrom
danf/cron-fugit-config
Oct 21, 2026
Merged

sl0thentr0py merged 3 commits into
masterfrom
danf/cron-fugit-config

Conversation

@wedamija

@wedamija wedamija commented Oct 16, 2026 •

Copy link
Copy Markdown
Member

Part of a series that sends Crons monitor configs from Ruby schedulers. Check-ins for a monitor that does not exist yet are dropped, so today every monitor has to be created by hand with its schedule copied from the code. Sending the schedule lets Sentry create the monitor and keep it in sync.

This adds Sentry::Cron::FugitSchedule, which converts a Fugit cron or interval into a monitor config. Fugit is the schedule parser behind rufus-scheduler and Solid Queue, so both integrations use it: #3110 (rufus-scheduler) and #3140 (Solid Queue).

It also converts Fugit syntax that has a Crons equivalent: the last day of the month (L), the nth or last weekday of the month (mon#2, fri#-1), and whole-hour UTC offsets (+05:00 becomes Etc/GMT-5).

It returns nil when the schedule can't be expressed in the Crons schedule format, for example a job that runs every 10 seconds. Those jobs still send check-ins, but without a monitor config.

The SDK doesn't depend on Fugit. The lockfile changes only add it as a dev dependency for the specs.

Add Sentry::Cron::FugitSchedule, which turns fugit cron lines and
intervals into monitor configs. It returns nil for schedules Sentry
would read differently. Shared by the rufus-scheduler and Solid Queue
integrations. fugit is added as a dev dependency for the specs.

Co-Authored-By: Claude <noreply@anthropic.com>
Co-Authored-By: Claude <noreply@anthropic.com>
@wedamija
wedamija marked this pull request as ready for review October 16, 2026 22:57
Co-Authored-By: Claude <noreply@anthropic.com>
@sl0thentr0py
sl0thentr0py merged commit ec4adca into master Oct 21, 2026
157 checks passed
@sl0thentr0py
sl0thentr0py deleted the danf/cron-fugit-config branch October 21, 2026 14:23
@linear-code

linear-code Bot commented Oct 21, 2026

Copy link
Copy Markdown

RUBY-232

wedamija added a commit that referenced this pull request Oct 21, 2026
Part of a series that sends Crons monitor configs from Ruby schedulers. Check-ins for a monitor that does not exist yet are dropped, so today every monitor has to be created by hand with its schedule copied from the code. Sending the schedule lets Sentry create the monitor and keep it in sync.

This adds an opt-in patch for rufus-scheduler:

```ruby
config.enabled_patches << :rufus_scheduler
```

`cron` and `every` jobs send in-progress and ok/error check-ins, with the job's schedule as the monitor config.

- The slug is the job's `name:`, or the handler's class or method. Unnamed blocks aren't monitored, and `sentry_monitor: false` opts a job out.
- `interval` jobs and schedules Sentry can't represent check in without a config. One-off `in` and `at` jobs aren't monitored.
- Errors still reach rufus's `on_error`.

Stacked on #3141. The lockfile changes only add `rufus-scheduler` as a dev dependency.

Docs: getsentry/sentry-docs#19789
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