Skip to main content
Cluster operationsLesson 13 of 16

SLOs and Alert Design

A "CPU over 80%" alert fires 30 times a day, yet users have no complaints. Meanwhile, users may hit errors with no alert at all. Let's redesign the alerts that wake people up around user experience, and follow how to narrow down the cause once one fires.

SLI (success ratio)99.95%
Error budget—
Burn rate—
Usersorder requestsOrder servicehandles requestsMetrics storePrometheusSLO99.9% over 30dAlertmanagergrouping · routingOn-callrespondsTracesrequest pathLogsdetailed recordsOrderRequests · errors
RequestResponse / reportWatchAppears in a later step

What you will learn

  • How SLI, SLO and error budget relate
  • Why cause-based alerts lead to alert fatigue
  • Why burn rate is checked over two windows
  • Narrowing the cause: metrics → traces → logs

Cause-based vs symptom-based alerts​

TypeExampleResultWhere it belongs
Cause-basedCPU over 80%, Pod restarted onceFires even without user impact, causing alert fatigueDashboards and analysis
Symptom-basedError budget burn rate, p99 latency over 2s for 10 minutesFires only for problems users actually feelAlerts that wake people

With Prometheus, write alert conditions as alerting rules, and set grouping, repeat intervals and receivers in Alertmanager.

Try it yourself​

kubectl get --raw /metrics | grep '^apiserver_request_total' | head # Request counts by code: raw material for an SLI
curl -s <prometheus>/api/v1/query --data-urlencode 'query=sum(rate(apiserver_request_total{code=~"5.."}[5m])) / sum(rate(apiserver_request_total[5m]))' # Error ratio over 5 minutes
kubectl get prometheusrules -A # Alerting rules (Prometheus Operator)
curl -s <prometheus>/api/v1/rules | jq '.data.groups[].rules[].name' # Rules Prometheus actually loaded
curl -s <alertmanager>/api/v2/alerts/groups # Alerts grouped into notifications

Check yourself

  1. A "CPU over 80%" alert fires dozens of times a day, but users report no problems. What does the lesson recommend?
  2. Why does the urgent burn-rate alert require both a 1-hour and a 5-minute window to be at 14.4 or more?
  3. The SLO is 99.9% success over 30 days, and the burn rate is 14.4. What does that mean?

Further reading: Google SRE Workbook — Alerting on SLOs · Prometheus alerting overview · Kubernetes system metrics