Skip to the page

Observability and SRE · Write code

Review these Prometheus alert rules

The interviewer asks

These are the alerts for our checkout API. The team says they get paged at night for nothing, and last month they missed a real outage. What's wrong with them, and what would you write instead?

groups:
  - name: checkout
    rules:
      - alert: CheckoutErrors
        expr: rate(http_requests_total{job="checkout", status="500"}[1m]) > 5
        labels:
          severity: page
      - alert: CheckoutDown
        expr: up{job="checkout"} == 0
        for: 5m
        labels:
          severity: page
      - alert: HighCPU
        expr: avg(rate(container_cpu_usage_seconds_total{pod=~"checkout.*"}[5m])) > 0.8
        for: 2m
        labels:
          severity: page

Then

Follow-ups the interviewer asks next

  1. What does rate(...[1m]) need from the scrape interval?
  2. Why is "more than 5 errors a second" a poor rule?
  3. How could the team miss a real outage with these rules?
  4. Should high CPU ever page someone?
  5. What does a burn-rate alert look like for a 99.9% SLO?
  6. What should every paging alert link to?

The answer

What a strong answer covers

  • [1m] with a 30 s scrape interval holds two samples at best: noisy, with gaps. Use a window of at least four scrape intervals (5m).
  • Only status="500" misses 502, 503, 504 and other 5xx (status=~"5.."); an absolute rate ignores traffic (5 errors a second is nothing at the 8 pm peak and huge at 3 am). Alert on the error ratio: errors divided by all requests.
  • No for: on the error alert, so one spike pages.
  • up == 0 fires only while the target still exists. When the whole deployment disappeared, its targets left service discovery, up had no series at all, and the alert never fired. Add absent(up{job="checkout"}), and alert on what users see (no successful requests at the load balancer, a synthetic check).
  • CPU is a cause, not a symptom: page on what users feel (errors, latency) and send CPU to a ticket or dashboard. The avg also hides one hot pod, and 0.8 cores means little without the limit.
  • Burn rate for a 99.9% SLO (error budget 0.1%): page when the 1-hour error ratio is above 14.4 × 0.1% and the 5-minute ratio confirms it's still happening; a second page tier at 6× over 6 hours (with a 30-minute check) and ticket-level alerts for slow burns (Google SRE Workbook).
  • Every page: a runbook link, a dashboard, an owner; severity routing in Alertmanager; inhibition so a "down" alert silences the error alerts it explains.

The red pen

Common traps

Avoid:lowering thresholds to "catch more"; irate in alert rules; paging on CPU and memory.

Practise this out loud

Say your answer out loud to an AI interviewer that follows up, and get a score for it.

Practise by voice

Practise questions like this out loud

Sign up and start with a 15-minute interview with the full report, and an English conversation. No card needed.

Start your free interview