Monitoring

Larkspur exposes its numbers in the Prometheus text format on the port given by metrics_port, 9187 by default. Each worker serves its own numbers; the queue numbers come from the database and are the same on every worker.

The numbers

MetricTypeMeaning
larkspur_jobs_waitinggaugejobs waiting, per queue
larkspur_oldest_waiting_secondsgaugeage of the oldest waiting job, per queue
larkspur_jobs_finished_totalcounterjobs finished by this worker
larkspur_jobs_failed_totalcounterfailed attempts on this worker

What to alert on

Alert on the age of the oldest waiting job, not on the number of waiting jobs. A thousand jobs that each take a millisecond are no problem; ten jobs that have waited an hour are.

- alert: LarkspurBacklog
  expr: larkspur_oldest_waiting_seconds > 600
  for: 5m