How to Monitor Queue Time on Self-Hosted Runners
Queue time is the gap between a job being created and a runner picking it up, and it is the first symptom of undersized runner capacity.
The jobs API exposes created_at (queued) and started_at (picked up). The difference is queue time. Push it as a histogram so you can see when demand outruns your runner pool.
Steps
- Read
created_atandstarted_atper job from the API. - Push the difference as a
runner_queue_secondshistogram. - Add runners or autoscale when p95 queue time rises.
Compute queue time
Terminal
gh api "repos/$OWNER/$REPO/actions/runs/$RUN_ID/jobs" \
--jq '.jobs[]
| {name, queue_s: ((.started_at|fromdateiso8601) - (.created_at|fromdateiso8601))}'Gotchas
- GitHub-hosted runners hide queue time behind autoscaling; this matters most for self-hosted pools.
- Latchkey managed runners autoscale to keep queue time low without you provisioning capacity.
Related guides
How to Track Job Duration, Queue Time, and Success RateTrack per-job duration, queue time, and success rate in CI by emitting a histogram and a counter labeled by j…
How to Export CI Metrics to the Prometheus PushgatewayExport short-lived CI metrics to the Prometheus Pushgateway, since pipeline jobs are too brief to be scraped,…