Video in progress

What is an alert, and what makes a good alert different from a bad one?

An alert is an automatic message sent to a person when a metric or log goes outside a set condition. A good alert fires for a real problem that affects users, and it's clear what to do next.

📖 Answer

Examples of bad alerts:

  • "CPU went over 80%": maybe that's just load and users notice nothing;
  • a message for every single ERROR log: 300 a day, and nobody reads them;
  • "something is odd", with no note of where to look.

A good alert:

  • looks at the symptom: "the 5xx share on checkout has been above 2% for 5 minutes";
  • fires not instantly but after it persists for a while (for: 5m), otherwise even momentary spikes wake someone up;
  • has a dashboard and runbook link in it;
  • has a clear severity: one that wakes you at night is separate from a ticket you look at in the morning.
- alert: CheckoutHighErrorRate
  expr: |
    sum(rate(http_server_requests_seconds_count{uri="/checkout",status=~"5.."}[5m]))
      / sum(rate(http_server_requests_seconds_count{uri="/checkout"}[5m])) > 0.02
  for: 5m
  labels:
    severity: page

The rule is simple: if nobody does anything when the alert arrives, it isn't an alert. Delete it or move it to a dashboard.