Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
44 changes: 44 additions & 0 deletions platform-includes/crons/setup/ruby.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -93,6 +93,50 @@ The monitor slug comes from the job's `name` option, or from the handler's class

Sentry creates the monitor from `cron` jobs and from `every` jobs whose frequency is a whole number of minutes, hours, or days. `interval` jobs wait a fixed time after each run ends, so they don't have a fixed schedule. For those, and for cron lines Sentry can't read the same way (for example `L`, `#`, or sub-minute seconds), the SDK sends check-ins without a monitor config, and you need to create the monitor in Sentry with the same slug. The same applies when the job's time zone is an offset like `+05:30` rather than an IANA name like `Europe/Vienna`. One-off `in` and `at` jobs are not monitored, and jobs scheduled by `sidekiq-scheduler` are left to the `:sidekiq_scheduler` patch.

### Solid Queue

<Alert>

The Solid Queue integration ships in the next release of `sentry-rails`.

</Alert>

If you're using Solid Queue recurring tasks, enable the `:solid_queue_recurring` patch to capture check-ins for every task in `config/recurring.yml`, as well as dynamic tasks:

```rb
Sentry.init do |config|
config.enabled_patches += [:solid_queue_recurring]
end
```

```yaml {filename:config/recurring.yml}
production:
nightly_report:
class: ReportJob
args: [nightly]
schedule: "0 2 * * * America/New_York"
weekly_report:
class: ReportJob
args: [weekly]
schedule: every monday at 9am
clear_cache:
command: "Rails.cache.clear"
schedule: every hour
```

The monitor slug is the task key, so this example creates three monitors: `nightly_report`, `weekly_report`, and `clear_cache`. Each task gets its own monitor, even when tasks share a job class. Both `class` and `command` tasks are monitored.

Sentry creates and updates each monitor from the task's schedule and time zone. Schedules that can't be expressed in the Crons schedule format, such as a task that runs every 10 seconds, still send check-ins, but without a monitor config. Create those monitors in Sentry first, using the same slug. Jobs that already call `sentry_monitor_check_ins` are left as they are.

To skip tasks, list their keys in `config.rails.solid_queue_exclude_recurring_tasks`. Strings match a task key exactly, and regular expressions are matched against it:

```rb
Sentry.init do |config|
config.enabled_patches += [:solid_queue_recurring]
config.rails.solid_queue_exclude_recurring_tasks = ["clear_cache", /^tmp_/]
end
```

## Manual Setup

If you're using `Clockwork` or `Whenever`, you'll need to instrument your jobs
Expand Down
Loading