Alerting on symptoms, not causes

Advanced · 43 min

Page a human only when users are hurting: alert on SLO burn rate instead of CPU and disk, and write the Prometheus rules that catch both fast and slow burns.

Before thisMetrics with PrometheusDashboards with Grafana

USENIX · 43 min

Alerting on symptoms, not causes

The player loads from youtube-nocookie.com when you press play. Nothing reaches YouTube before that.

Taught by USENIXReport a problem with this video
Not started
Set this lesson's status

What you'll learn

  • Every page should be urgent, actionable and about something users can feel. An alert that fires and needs no action trains people to ignore the next one.
  • Symptoms are what users experience, such as errors and slow responses. Causes are internal conditions, such as high CPU or a full queue. Page on symptoms, and put causes on dashboards for diagnosis.
  • Burn rate is how fast you are spending the error budget, relative to spending it exactly over the SLO window. A burn rate of 1 uses the whole month's budget in a month, and 14.4 uses 2% of it in an hour.
  • Combine a long and a short window in each rule. The long window proves the problem is big enough to matter, and the short one proves it is still happening, so the alert also clears quickly.
  • Use two severities. Fast burns page someone now, and slow burns open a ticket for working hours.

The problem: the pager that cried wolf

A new team sets up alerts for everything it can think of: CPU above 80%, disk above 85%, memory above 90%, any 5xx. Within a month the on-call phone goes off ten times a night. Most of the alerts need no action, since the CPU spike was a nightly batch job and the 5xx was one bot. People start silencing the pager. Then a real outage begins, and nobody notices for forty minutes.

This is alert fatigue, and it comes from paging on the wrong things. The fix comes from a short distinction. A symptom is something users experience: requests failing, pages slow. A cause is an internal condition that might produce a symptom: high CPU, a full disk, a dead replica. Users don’t care about your CPU. Page on symptoms. Keep causes on dashboards, where they help you diagnose once a symptom has paged you.

Causes still matter when they predict a symptom with certainty and you can act before it lands. “Disk will be full in four hours” is a fair ticket, or even a page.

The error budget as an alarm

System design covers SLIs, SLOs and error budgets in concept. Here is how they become alerts.

Say the SLO is 99.9% of requests succeeding over 30 days. The error budget is the remaining 0.1%. Burn rate is how fast you are spending it, relative to spending it exactly evenly over the window:

  • burn rate 1 means a 0.1% error ratio, and the budget runs out on day 30
  • burn rate 14.4 means a 1.44% error ratio, and 2% of the month’s budget goes in one hour

Google’s SRE Workbook works out a practical rule set for a 99.9% SLO:

Severity Long window Short window Burn rate Budget used
Page 1 hour 5 minutes 14.4 2%
Page 6 hours 30 minutes 6 5%
Ticket 3 days 6 hours 1 10%

Each rule fires only when both windows are over the threshold. The long window shows that enough budget has gone to matter. The short window shows that it is still going, so the alert clears within minutes of a fix rather than an hour later.

A worked example: four kinds of bad day

I wanted to see how those rules behave, so I simulated six days of traffic in Python: 1,000 requests a minute with 0.02% background errors. After three days of normal history, one of four things happens:

  • short blip: 2 minutes at 30% errors
  • blip: 4 minutes at 30% errors
  • outage: 20% errors from then on
  • slow leak: 0.3% errors from then on

The script evaluates the three rules every minute and prints when each first fires, counted from when the trouble started:

$ python3 burn.py
short blip no alert
blip       {'page 1h/5m': '+3 min'}
outage     {'page 1h/5m': '+5 min', 'page 6h/30m': '+11 min', 'ticket 72h/360m': '+18 min'}
slow leak  {'ticket 72h/360m': '+1231 min'}

The short blip spent about 1.4% of the month’s budget and paged nobody. The 4-minute blip spent about 2.8% and paged. That surprised me at first, but it is the rule working: 2% of a month’s budget in an hour is the line the table draws. If that is too sensitive for your service, the SLO is the thing to change, not the alert. The outage paged in 5 minutes. The slow leak, a burn rate of 3, which would empty the budget in about ten days, never paged. It opened a ticket after about 20 hours. That is the right response for a problem that can wait for the morning.

A simulation is tidier than reality. Traffic was flat and the errors were evenly random. Real traffic has daily cycles, and at low volume a handful of errors can look like a huge ratio.

The Prometheus rules

In Prometheus these are alerting rules. Below is the 1h/5m page, following the SRE Workbook’s expression, with the error ratio computed from the counter in the metrics lesson. I did not run this: Prometheus and Alertmanager aren’t installed here. I did parse the YAML.

groups:
  - name: shop-web-slo
    rules:
      - record: job:slo_errors_per_request:ratio_rate1h
        expr: |
          sum by (job) (rate(http_requests_total{code=~"5.."}[1h]))
          / sum by (job) (rate(http_requests_total[1h]))
      - record: job:slo_errors_per_request:ratio_rate5m
        expr: |
          sum by (job) (rate(http_requests_total{code=~"5.."}[5m]))
          / sum by (job) (rate(http_requests_total[5m]))
      - alert: ShopWebErrorBudgetFastBurn
        expr: |
          job:slo_errors_per_request:ratio_rate1h{job="shop-web"} > (14.4 * 0.001)
          and
          job:slo_errors_per_request:ratio_rate5m{job="shop-web"} > (14.4 * 0.001)
        labels:
          severity: page
        annotations:
          summary: "shop-web is burning its 30-day error budget 14x too fast"
          runbook_url: "https://wiki.example.com/runbooks/shop-web-errors"

The recording rules precompute each window’s ratio, so the alert expression stays cheap. The severity label is what Alertmanager routes on: pages to the paging tool, tickets to a queue. Alertmanager also groups related alerts into one notification and lets you silence them during maintenance. Every page should carry a runbook link saying what to check first.

About the video

“LISA18 - SLO Burn—Reducing Alert Fatigue and Maintenance Cost in Systems of Any Size” is a talk by Jamie Wilkinson of Google, on the USENIX channel, published November 2018, 43 minutes 26 seconds. The abstract says it argues for paging only on symptoms, defined through an SLO and its error budget, and builds the alerting rules in Prometheus in a live demonstration. The talk is from 2018, but the method has not changed. It has no chapters. English is judged from the title, description and channel. His SREcon18 Asia talk on the same topic is linked as a shorter variant, along with the workbook chapter itself.

Where this fits

Now that only real problems page, someone has to answer the page: on-call and incident response.

Check yourself

  1. 01Why is 'CPU above 90% for 5 minutes' a poor paging alert?

    High CPU may hurt no one, for example during a batch job, and users can be failing while CPU is normal. It pages on a possible cause instead of on user pain.

  2. 02With a 99.9% SLO, what error ratio corresponds to a burn rate of 14.4?

    14.4 times the 0.1% budget, which is a 1.44% error ratio.

  3. 03What does the short window in a multiwindow alert add?

    It checks that the errors are still happening now. Without it, a one-hour window keeps the alert firing for up to an hour after the problem is fixed.

  4. 04Should an error rate of 0.3% against a 99.9% SLO page someone at 3 a.m.?

    No. It is a burn rate of 3, which would use the month's budget in about ten days. That is worth a ticket for the next working day, not a page.

Go deeper

Notes

Private to you

Esc
↑↓ navigate↵ open? shortcuts

Keyboard shortcuts

Press Esc to close

Anywhere

⌘K
Search and commands
/
Search
?
This sheet
Esc
Close

Reading a lesson

J
Next lesson
K
Previous lesson
B
Bookmark