How it works
Your job sends check-in signals to Sentry at the start and end of each execution. Sentry compares these signals against the configured schedule and raises an incident if:- The job does not check in within the expected window (missed)
- The job checks in as
in_progressbut does not complete within the max runtime (timed out) - The job checks in with
errorstatus (failed)
Check-in protocol
A job communicates its status via three check-in states:| Status | Meaning |
|---|---|
in_progress | The job has started. Sentry starts the timeout clock. |
ok | The job completed successfully. Resets the monitor to healthy. |
error | The job completed with an error. Creates or updates an incident. |
Instrumenting a cron job
- Python
- Node.js
- Shell
Schedule types
Sentry supports two schedule formats:Crontab
Standard Unix cron expression. For example,
0 9 * * 1-5 runs at 9 AM Monday through Friday.Interval
Simple interval expressed as a count and unit (minute, hour, day, week, month).
Monitor configuration
When creating or updating a monitor, you can configure:| Setting | Description |
|---|---|
checkin_margin | Minutes after the expected check-in time before declaring a miss (minimum: 1 minute) |
max_runtime | Maximum minutes an in_progress check-in can run before being marked as timed out (default: 30 minutes, maximum: 28 days) |
timezone | IANA timezone for interpreting the crontab schedule |
failure_issue_threshold | Number of consecutive failures before creating an issue (default: 1) |
recovery_threshold | Number of consecutive successes before resolving an incident (default: 1) |
Monitor statuses
| Status | Description |
|---|---|
ok | All check-ins are arriving on schedule and completing successfully |
error | The monitor is in an active incident state |
missed | A check-in was not received within the expected window |
timed_out | A check-in was started but did not complete within max_runtime |
disabled | The monitor has been manually disabled |
Alerts
You can attach an issue alert rule to a cron monitor to control how incidents are routed. By default, Sentry uses the project’s default alert rule. You can customize the alert to notify specific teams or channels when the monitor fails.Each organization has a maximum number of monitors. Monitors also have a per-organization environment limit. If you hit these limits, Sentry will raise a
MonitorLimitsExceeded error and reject new monitor creation.