Calculate a service level indicator from successful events over total events.
An SLI (Service Level Indicator) is the measured proportion of 'good' events out of all valid events in a window — for example, requests served under a latency threshold, or responses that weren't a server error. Formula: SLI = good_events / total_events × 100. Comparing the SLI to your SLO (Service Level Objective) target tells you whether you're in compliance, and the gap between the two — expressed as error budget — tells you how much unreliability you can still afford before breaching the SLO.
Service Level Indicator
SLI = (good_events / total_events) × 100
Error budget consumed
error_budget_consumed_% = bad_events / (total_events × (1 - SLO_target / 100)) × 100
The SLI is the raw measurement (e.g. 99.95% success rate). The SLO is your internal target for that SLI (e.g. 99.9%). The SLA is the externally communicated commitment, usually with contractual consequences, and is often set looser than the SLO to leave margin.
It depends on the SLI type: for availability, a good event is a non-error response; for latency, it's a request under your threshold; for correctness, it's a response with the expected result. Define it precisely so measurement is consistent.
Error budget converts an abstract percentage into a concrete number of allowed failures. Once it's exhausted, many SRE practices pause risky releases and prioritize reliability work until the budget resets in the next window.
A rolling window (e.g. trailing 28 days) gives a consistent, continuously updated view of reliability without discontinuities at month boundaries, which is why most SRE tooling defaults to it.