How to Choose a Heartbeat Grace Period
Grace period should cover normal runtime jitter plus the next scheduled slot. Too short pages on slow runs. Too long hides silent failures for hours.
Heartbeat monitoring expects a ping when a job finishes. Grace period is how long the monitor waits after the expected time before declaring a miss. Picking that window is the difference between catching silent failures and paging because a backup took longer than usual.
Start from schedule plus runtime
Note the cron schedule and the ninety-fifth percentile runtime from the last thirty days. Grace period should exceed typical runtime variance but stay shorter than the gap until the next run matters for your business.
| Job pattern | Starting grace period |
|---|---|
| Hourly sync under five minutes | 15 to 20 minutes |
| Nightly batch up to two hours | 3 to 4 hours |
| Weekly report | 6 to 12 hours after expected finish |
Late versus missed
- Late: job still running, heartbeat may arrive after grace if you set it too tight
- Missed: job never started or crashed before calling the heartbeat URL
- Extend grace when jobs legitimately queue behind upstream data
- Shorten grace when missing two consecutive runs causes customer impact
Tune with production history
- Deploy heartbeat with a generous grace period first
- Review late alerts for false positives over two weeks
- Tighten only when you understand longest normal runtime
- Document owner and runbook link in the monitor name
If jobs are supposed to run daily but only matter during business hours, consider pausing monitors outside that window instead of stretching grace across entire weekends.
Heartbeat URLs are secrets. Rotate them if leaked and never log the full URL in application logs. Security and reliability both depend on treating the ping endpoint like a credential.
Name monitors after the job they protect, not the server they run on. When grace period alerts fire, the on-call engineer should instantly know which business process is at risk.
Plain-text version · Cron and Scheduled Jobs
Was this useful?