Skip to content
Latchkey

How to Set an SLO for CI Build Time

A CI build-time SLO says a target share of runs finish under a budget, and the error budget is the runs that miss it.

Pick a target like "95% of builds finish under 10 minutes". The SLI is the fraction of runs under budget; the error budget is one minus the target. Track it with a ratio of fast runs to all runs.

Steps

  • Choose a duration budget and a target percentage.
  • Compute the share of runs under budget as the SLI.
  • Alert when the share drops below the target.

SLI query

Terminal
# fraction of builds under a 600s budget over 7 days
sum(increase(ci_build_duration_seconds_bucket{le="600"}[7d]))
  / sum(increase(ci_build_duration_seconds_count[7d]))

Gotchas

  • The budget bound must match a real histogram bucket boundary (le), or the query returns nothing.
  • Set the budget from current p95, not an aspirational number, so the SLO stays actionable.

Related guides

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