Site Reliability Engineering interview question · Most asked

Write Prometheus alerting rules for an SLO of 99.9% successful requests using multi-window burn rates.

Hands-on Asked in Site Reliability Engineer (SRE) · DevOps Engineer interviews

Members can save this page, take notes and track progress. See membership · Sign in

Summary

Compute the error ratio over several windows and alert when the error budget is burning much faster than allowed: a fast burn (14.4x over 1 hour, confirmed over 5 minutes) pages someone, a slow burn (6x over 6 hours, confirmed over 30 minutes) opens a ticket. With a 99.9% target, the budget is a 0.1% error ratio.

Longer Answer

Why two windows: the long window shows the problem is significant, the short window shows it's still happening, so alerts resolve quickly after recovery. Record the ratios with recording rules so alerts are cheap to evaluate.

Example

groups:
  - name: api-slo
    rules:
      - record: job:request_error_ratio:rate5m
        expr: sum(rate(http_requests_total{job="api",code=~"5.."}[5m])) / sum(rate(http_requests_total{job="api"}[5m]))
      - record: job:request_error_ratio:rate1h
        expr: sum(rate(http_requests_total{job="api",code=~"5.."}[1h])) / sum(rate(http_requests_total{job="api"}[1h]))
      - record: job:request_error_ratio:rate30m
        expr: sum(rate(http_requests_total{job="api",code=~"5.."}[30m])) / sum(rate(http_requests_total{job="api"}[30m]))
      - record: job:request_error_ratio:rate6h
        expr: sum(rate(http_requests_total{job="api",code=~"5.."}[6h])) / sum(rate(http_requests_total{job="api"}[6h]))
      - alert: APIErrorBudgetFastBurn
        expr: job:request_error_ratio:rate1h > (14.4 * 0.001) and job:request_error_ratio:rate5m > (14.4 * 0.001)
        labels: { severity: page }
        annotations: { summary: "API is burning its error budget fast (2% of the month's budget per hour)" }
      - alert: APIErrorBudgetSlowBurn
        expr: job:request_error_ratio:rate6h > (6 * 0.001) and job:request_error_ratio:rate30m > (6 * 0.001)
        labels: { severity: ticket }

Key Points

  • Error budget = 1 - SLO.
  • Fast burn pages; slow burn tickets.
  • Long window for significance, short for recency.
  • Recording rules keep alerts cheap.

Explanation

What interviewers look for

Correct burn-rate maths and the reasoning behind multi-window alerts.

More Site Reliability Engineering questions

← All Site Reliability Engineering questions

Last reviewed · By the ByteCamel team · How we write content

Was this page helpful?

Report a mistake