SLI examples for Grafana SLO
A Service Level Indicator (SLI) is a metric that measures how well your service is performing from the user’s perspective. SLIs typically track availability, latency, or success rate. For example:
- Requests respond within 2 seconds
- Requests do not return system errors
To define a Service Level Objective (SLO), pair an SLI with a target and a time window. For example:
SLI category | SLI description | Time window | Target |
---|---|---|---|
Latency | Requests respond within 2 seconds | 28d | 99% |
Success rate | Requests do not return system errors | 7d | 99.5% |
An SLO sets your reliability goal by targeting SLI performance over a time window. Grafana SLO continuously evaluates whether the SLI meets that target.
SLI calculation types
SLIs are defined using data source queries that measure the success of the indicator. For example:
- What is the ratio of successful requests under 2 seconds (latency)?
- What is the ratio of successful requests without system errors (success rate)?
SLIs typically use one of two calculation types:
Event-based SLIs (also called ratio-based or request-based SLIs)
Calculate the ratio of successful events to total events:
number of successful events / total number of events
Time-based SLIs
Mark each time slice (such as one minute) as good or bad, and calculate the ratio of good slices to total slices:
number of successful time-slices / total number of time-slices
A drawback of time-based SLIs is that a bad minute during low traffic penalizes the SLO as much as a bad minute during peak traffic, even though it impacts more users.
Note
Event-based SLIs are fully supported in Grafana SLO and include all available features.
Time-based SLIs are supported using the Advanced SLI option, but do not support all Grafana SLO dashboards and filtering options.
If your data don’t expose both success and total events, consider defining recording rules or updating instrumentation in your service rather than relying on complex SLI workarounds.
The following examples define event-based SLIs for different types of metrics: