Skip to content

Commit 8191350

Browse files
authored
feat(crons): Ruby docs for auto-instrumentation (#8550)
1 parent c1f3223 commit 8191350

File tree

1 file changed

+19
-1
lines changed
  • src/platform-includes/crons/setup

1 file changed

+19
-1
lines changed

src/platform-includes/crons/setup/ruby.mdx

Lines changed: 19 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,20 @@
11
## Job Monitoring
22

3-
Standard job frameworks such as `ActiveJob` and `Sidekiq` with a `perform` method can use the `Sentry::Cron::MonitorCheckIns` mixin module to automatically capture check-ins.
3+
If you're using `sidekiq-cron` or `sidekiq-scheduler`, Sentry can automatically
4+
capture check-ins for all jobs that are scheduled to run periodically. To
5+
achieve this, you need to enable the corresponding Sentry plugin:
6+
7+
```rb
8+
Sentry.init do |config|
9+
config.enabled_patches += [:sidekiq_cron]
10+
# or, for sidekiq-scheduler:
11+
config.enabled_patches += [:sidekiq_scheduler]
12+
end
13+
```
14+
15+
More generally, popular job frameworks such as `ActiveJob` and `Sidekiq` with
16+
a `perform` method can use the `Sentry::Cron::MonitorCheckIns` mixin module
17+
to automatically capture check-ins.
418

519
```rb {tabTitle: ActiveJob}
620
class ExampleJob < ApplicationJob
@@ -34,6 +48,7 @@ You can pass in optional attributes to `sentry_monitor_check_ins` as follows.
3448
sentry_monitor_check_ins slug: 'custom_slug'
3549

3650
# define the monitor config with an interval
51+
# the units supported are :year, :month, :week, :day, :hour, :minute
3752
sentry_monitor_check_ins monitor_config: Sentry::Cron::MonitorConfig.from_interval(1, :minute)
3853

3954
# define the monitor config with a crontab
@@ -42,6 +57,9 @@ sentry_monitor_check_ins monitor_config: Sentry::Cron::MonitorConfig.from_cronta
4257

4358
## Manual Setup
4459

60+
If you're using `Clockwork` or `Whenever`, you'll need to instrument your jobs
61+
manually.
62+
4563
### Check-Ins (Recommended)
4664

4765
Check-in monitoring allows you to track a job's progress by completing two check-ins: one at the start of your job and another at the end of your job. This two-step process allows Sentry to notify you if your job didn't start when expected (missed) or if it exceeded its maximum runtime (failed).

0 commit comments

Comments
 (0)