Use it when defining SLOs for a service.
Choosing SLIs
Choosing SLIs: pick measurements that reflect user experience — availability (good/valid requests), latency (requests below a threshold), freshness, correctness — measured as close to the user as possible.
1. Availability SLI: sum(rate(http_requests_total{code!~"5.."}[5m])) / sum(rate(http_requests_total[5m])).
2. Latency SLI: share below threshold via histogram bucket le.
3. Measured at load balancer or client?
4. Valid-event definition.
5. Agree with stakeholders.
user journey → good/valid events → SLI
Context & applicabilityCommon mistakes · platform/version boundaries
Operational reference
Fast context before you go deeper.
Verification & Troubleshooting
Start with the observed symptom, prove the nearest boundary, and move outward only when the current state is understood.
Use the operational verification above to establish the expected state.
Capture the concrete output, symptom, packet, log or counter before changing anything.
Step 1 How to verify Verify boundary
Confirm the SLI dropped during past incidents. Confirm the histogram has a bucket at the latency threshold.
Step 2 Common failures Narrow the fault
Measuring only server-side misses load balancer or network failures. Including health checks inflates availability. Averages are not SLIs.
Express SLIs as good events / valid events. Exclude invalid requests (e.g. 4xx caused by clients) deliberately. Fewer SLIs are better.
sum(rate(http_requests_total{code!~"5.."}[5m])) / sum(rate(http_requests_total[5m]))— first check for this topiccurl -s localhost:9090/-/ready— Prometheus readycurl -s 'localhost:9090/api/v1/query?query=up'— scrape targets up/downpromtool check config prometheus.yml— config valid
ReferenceWhat it is1 section · depth on demand
How it works
SLIs are computed from counters: good requests and total requests. Latency SLIs count requests faster than a threshold, which needs a histogram bucket at that threshold.
ReferenceImportant terms & boundaries3 sections · depth on demand
Choosing SLIs
| Service type | SLI example |
|---|---|
| Request/response | Proportion of requests with status < 500 and latency < 300 ms |
| Data pipeline | Proportion of records processed within 10 minutes |
| Storage | Proportion of reads that succeed |
| Batch job | Proportion of runs that finish before the deadline |
Measure as close to the user as possible (load balancer or client), and define good/total events precisely (exclude health checks).
In depth
SLI = good events ÷ valid events
Write the definition precisely, including what is not counted:
| Service type | Good events | Valid events |
|---|---|---|
| HTTP API | Responses with status < 500 and latency < 300 ms | All requests except health checks and requests rejected for bad input (4xx) |
| Batch pipeline | Runs that finish within 2 h of schedule with correct output | All scheduled runs |
| Storage | Reads that return the written data | All reads |
| Streaming | Messages processed within 60 s of production | All messages |
From the definition to PromQL
# availability over 30 days
sum(increase(http_requests_total{job="api",code!~"5..",route!="/healthz"}[30d]))
/ sum(increase(http_requests_total{job="api",route!="/healthz"}[30d]))
# latency SLI: share of requests faster than 300 ms (needs a bucket at exactly 0.3)
sum(rate(http_request_duration_seconds_bucket{job="api",le="0.3"}[5m]))
/ sum(rate(http_request_duration_seconds_count{job="api"}[5m]))
Where to measure
| Measurement point | Sees | Misses |
|---|---|---|
| Application | Detailed, per route | Requests that never reached it |
| Load balancer / ingress | Most user traffic | Client-side and DNS failures |
| Synthetic probes | End-to-end path from outside | Real traffic mix |
| Client (RUM) | What users actually experience | Noisy, partial coverage |
Start with the load balancer for availability and latency, add synthetic probes for low-traffic paths, and check the SLI against history: it must have dropped during every real incident you remember, and must not have dropped when nothing was wrong.
Setting the target
Pick a target slightly below what the service achieves today and what users have been content with, not 100 %. 99.9 % over 30 days allows about 43 minutes of full outage.
Common mistakes
- SLIs that do not reflect user experience.
Additional reference context Scope · expected state · examples · history · terminology Open only when you need the supporting context
Terms & aliases
Hover a linked term for a quick definition; click it to open its glossary entry. Aliases are other names that find this Topic in search.