Monitor Sidekiq periodic and cron jobs
On this page
Sidekiq retries a failing job, which hides trouble, and a stopped scheduler enqueues nothing, which hides more. Whether you use Sidekiq Enterprise periodic jobs or the sidekiq-cron gem, a ping at the end of perform tells you the schedule really ran.
How can a scheduled job fail silently on Sidekiq periodic jobs?
- With sidekiq-cron, a poller thread checks the scheduled jobs every 30 seconds by default. After downtime such as a deploy, only jobs that should have started less than 1 minute ago are caught up, so a longer outage skips runs.
- Sidekiq Enterprise periodic jobs are global to the whole cluster, and Sidekiq makes sure a single process creates the jobs. If every process is down, nothing is created.
- A job that raises an error is retried like any other job, so a failing periodic job can look busy rather than broken for days.
- Cron expressions use the Ruby process's time zone in Enterprise, and the Rails time zone (or UTC) in sidekiq-cron, so the same line can mean different hours in two apps.
What are the limits of Sidekiq periodic jobs?
| Limit | What the documentation says |
|---|---|
| sidekiq-cron poll interval | Every 30 seconds by default; cron_poll_interval changes it. |
| sidekiq-cron catch-up | By default only jobs that should have started less than 1 minute ago are considered after downtime. |
| sidekiq-cron safety | Safe with several Sidekiq processes: a Redis sorted set lets only the first process enqueue each run. |
| Enterprise periodic jobs | Registered at startup; only one process creates each job; a per-job tz option is available from Enterprise 2.2.1. |
| Seconds | sidekiq-cron accepts second-level cron lines such as */30 * * * * *, and then the poll interval should be lower than the job interval. |
How do you add a CronMissed ping to Sidekiq periodic jobs?
Wrap perform so that a run reports its start, its success and its failure, and re-raise the error so that Sidekiq's own retry still works.
require "net/http"
class NightlyReportJob
include Sidekiq::Job
PING = "https://ping.cronmissed.com/5f0c1b2e-7a3d-4c8e-9b61-2d4f8a7e3c10"
def perform
ping("/start")
run_report
ping
rescue StandardError => e
ping("/fail", e.full_message.byteslice(-100_000, 100_000))
raise
end
private
def ping(suffix = "", body = nil)
uri = URI("#{PING}#{suffix}")
Net::HTTP.start(uri.host, uri.port, use_ssl: true, open_timeout: 10, read_timeout: 10) do |http|
body ? http.post(uri.request_uri, body) : http.get(uri.request_uri)
end
rescue StandardError
nil # a lost ping must never fail the job
end
def run_report
# the work
end
endWhich check settings fit Sidekiq periodic jobs?
Create a cron check with the same expression and time zone as the periodic registration. Grace should cover the queue delay (jobs wait behind others) and the run time; ten minutes is typical on a busy queue. Because Sidekiq retries failed jobs, the first /fail ping alerts immediately and the later success ping brings the check back up.
How do you confirm the check works?
- Enqueue the job once by hand with NightlyReportJob.perform_async and confirm the three pings in the log.
- Stop all Sidekiq processes and confirm the check goes down after the grace.
- Raise inside run_report and confirm the alert includes the end of the error.
Sources
- Sidekiq wiki: Enterprise periodic jobs , read 22 October 2026
- sidekiq-cron README , read 22 October 2026
Questions and answers
- No. A failure on a check that is already down sends no new alert; the check alerts once when it goes down and once when a success brings it back.
- In an environment variable or your credentials store, not in the repository. The ping URL is the check's only credential.
Does the /fail ping on each retry cause an alert each time?
Where should the ping URL live?
Create a check, add the ping to the job, and CronMissed alerts you the first time a run is late or reports a failure.
Start monitoring