Docs › Sidekiq cron job monitoring with RunVouch

Sidekiq cron job monitoring with RunVouch

Sidekiq cron job monitoring for the schedule Sidekiq Web says is fine: sidekiq-cron loads config/schedule.yml into Redis and a poller in the Sidekiq process enqueues jobs on time. A job that raises goes to the retry set, retries for 25 attempts over about 21 days, then goes to the Dead set. A job that was never enqueued goes nowhere.

How it runs on Sidekiq cron (sidekiq-cron, sidekiq-scheduler)

Inside perform, with two Net::HTTP calls around the work (no gem required), or shell out to rv run if the job runs a script. Report the run from the job, not from the schedule, so a job that was enqueued but never picked up is a MISSED start.

Store the key

ENV["RUNVOUCH_KEY"] on the Sidekiq process, from Rails credentials (Rails.application.credentials.runvouch_key) or the process environment.

Report the run (two HTTP calls)

# config/schedule.yml (sidekiq-cron)
nightly_report:
  cron: "0 2 * * *"
  class: NightlyReportJob
  queue: reports

# app/jobs/nightly_report_job.rb
require "net/http"; require "json"
class NightlyReportJob
  include Sidekiq::Job
  sidekiq_options retry: 2
  API = "https://api.runvouch.com"
  def post(path, body)
    uri = URI(API + path)
    req = Net::HTTP::Post.new(uri, "X-API-Key" => ENV.fetch("RUNVOUCH_KEY"), "content-type" => "application/json")
    req.body = body.to_json
    JSON.parse(Net::HTTP.start(uri.host, uri.port, use_ssl: true, read_timeout: 10) { |h| h.request(req) }.body)
  rescue StandardError => e
    Rails.logger.warn("runvouch unreachable: #{e.message}"); {}   # fail open
  end
  def perform
    run_id = post("/v1/runs/start", agent: "nightly-report", source: "sidekiq")["run_id"]
    rows = Report.build!                                         # your work
    post("/v1/runs/end", run_id: run_id, status: "ok", evidence: { rows_written: rows > 0 })
  rescue StandardError => e
    post("/v1/runs/end", run_id: run_id, status: "fail", meta: { error: e.message[0, 500] }) if run_id
    raise
  end
end

The start call returns run_id; the end call takes status (ok or fail), optional cost and tokens, and evidence as a JSON object of booleans. Full reference on the API page.

Register the cadence and caps

rv agent nightly-report --cadence 24h --grace 30m --max-runtime 1h --evidence --cap-run-cost 2

Register the agent once, from anywhere with the key. Cadence is what turns a schedule that stopped into an alert; --evidence makes a run without evidence a failure; the caps pause the agent when it overspends.

What goes silent on Sidekiq cron (sidekiq-cron, sidekiq-scheduler)

What Sidekiq cron (sidekiq-cron, sidekiq-scheduler) does not tell you

Sidekiq Web shows queues, the retry set, the Dead set and a Cron tab with each schedule's last enqueue time. Sidekiq itself sends no notifications; error trackers (Sentry, Honeybadger) receive exceptions from jobs that ran. There is no exception for a poller that is not running, a schedule that did not load, or a job that completed with nothing to show.

What RunVouch detects

AlertWhat it means here
MISSEDcadence plus grace passed and no run started
FAILEDnon-zero exit or a reported failure, with the stderr excerpt
NO_EVIDENCEthe run said ok but the file, URL or assertion you required is missing
STALLEDa run started and never ended within max runtime
RETRY_STORMthe same tool called with identical input many times in one run
BUDGET_RUN / BUDGET_DAYcost cap crossed; the agent is paused until you resume it
DRIFTduration or output size far off its 7-run baseline

Set up in two minutes

  1. Get a free key (3 agents, no card) and store it where this page says.
  2. report the run (two http calls): copy the snippet above into the scheduled job.
  3. Register the cadence once: rv agent nightly-report --cadence 24h --grace 30m --evidence, or let the first run create the agent and set the cadence on the dashboard.
  4. Send one test alert: curl -X POST https://api.runvouch.com/v1/settings/test-alert -H "X-API-Key: $RUNVOUCH_KEY". The next missed, failed or empty run reaches the same channels.

Need a key? Get a free key · Stuck? contact