Skip to content
Latchkey

How to Measure CI Duration

You cannot optimize what you do not measure. Start by separating queue time from actual run time.

Total "CI took 12 minutes" hides where the time went. Pull per-job timings and split queue from execution to target the real bottleneck.

Queue time vs run time

created_at to started_at is queue/provision time; started_at to completed_at is run time. Slow due to queueing has a different fix (capacity) than slow execution (caching, parallelism).

Pull timings from the API

The jobs API returns per-job timestamps you can aggregate.

shell
gh api repos/OWNER/REPO/actions/runs/RUN_ID/jobs \
  --jq '.jobs[] | {name, started_at, completed_at}'

Track the trend

A single run is noisy. Aggregate p50/p95 duration over weeks to see whether CI is creeping up and which job is responsible.

Key takeaways

  • Separate queue time from run time first.
  • Pull per-job timings from the jobs API.
  • Track p50/p95 over time, not single runs.

Related guides

Run this faster and cheaper on Latchkey managed runners. Start free →