TExcelTAD

Burn Rate

The error ratio alone doesn't say whether to worry: 1% errors is a disaster for a 99.99% SLO and fine for a 98% one. Burn rate normalises it against the SLO:

burn rate = observed error ratio / (1 − SLO)

A burn rate of 1 spends the budget exactly over the SLO window: at that pace you end the 30 days with nothing left. A burn rate of 2 empties it in half the window, 10 in a tenth. The alerting chapter of Google's SRE Workbook (Alerting on SLOs) builds all of its recommended alerts on this number.

Time to exhaustion

python · try it yourself
SLO = 0.999
WINDOW_H = 30 * 24                       # a 30-day SLO window, in hours

print(f"{'error ratio':>11} {'burn rate':>10} {'budget gone in':>16}")
for error_ratio in (0.001, 0.002, 0.005, 0.01, 0.0144, 0.05, 1.0):
    burn = error_ratio / (1 - SLO)
    hours = WINDOW_H / burn
    gone = f"{hours / 24:.1f} days" if hours >= 48 else f"{hours:.1f} hours" if hours >= 2 else f"{hours * 60:.0f} minutes"
    print(f"{error_ratio:>11.2%} {burn:>10.1f} {gone:>16}")
error ratio  burn rate   budget gone in
      0.10%        1.0        30.0 days
      0.20%        2.0        15.0 days
      0.50%        5.0         6.0 days
      1.00%       10.0         3.0 days
      1.44%       14.4         2.1 days
      5.00%       50.0       14.4 hours
    100.00%     1000.0       43 minutes

At 100% errors (a full outage) a 99.9% service loses its whole month's budget in 43 minutes. A 0.2% error rate looks harmless on a dashboard yet spends the budget in 15 days.

Where 14.4, 6 and 1 come from

An alert should fire when a meaningful share of the budget is being spent in a short time. "Meaningful" is a choice; the workbook suggests:

Budget consumed in (long window) Burn rate Action
2% 1 hour 14.4 page
5% 6 hours 6 page
10% 3 days 1 ticket

The burn rate follows from the budget share and the windows:

burn rate = budget share × SLO window / alert window
python · try it yourself
WINDOW_H = 30 * 24

for share, alert_h, action in ((0.02, 1, "page"), (0.05, 6, "page"), (0.10, 72, "ticket")):
    burn = share * WINDOW_H / alert_h
    print(f"{share:>4.0%} of the budget in {alert_h:>2} h -> burn rate {burn:>4.1f} "
          f"-> error ratio threshold {burn * 0.001:.2%} for a 99.9% SLO ({action})")
  2% of the budget in  1 h -> burn rate 14.4 -> error ratio threshold 1.44% for a 99.9% SLO (page)
  5% of the budget in  6 h -> burn rate  6.0 -> error ratio threshold 0.60% for a 99.9% SLO (page)
 10% of the budget in 72 h -> burn rate  1.0 -> error ratio threshold 0.10% for a 99.9% SLO (ticket)

The same burn rates work for any SLO: for 99.5% the 14.4x threshold is 7.2% errors, for 99.99% it is 0.144%. That's why burn-rate rules can be generated from the SLO alone.

Detection time

If errors jump from almost nothing to a constant ratio, an alert "burn rate over the last W > B" fires once enough bad minutes have filled the window. The detection time is roughly W × B / b, where b is the actual burn rate:

python · try it yourself
def detection_minutes(window_min, threshold_burn, actual_burn):
    if actual_burn <= threshold_burn:
        return None                     # never fires: the window average can't reach the threshold
    return window_min * threshold_burn / actual_burn

for actual in (10, 14.4, 20, 50, 100, 1000):
    d = detection_minutes(60, 14.4, actual)
    budget_used = 0 if d is None else actual * d / (30 * 24 * 60)
    print(f"actual burn {actual:>6}: " + ("never fires" if d is None else
          f"fires after {d:5.1f} min, having used {budget_used:.1%} of the budget"))
actual burn     10: never fires
actual burn   14.4: never fires
actual burn     20: fires after  43.2 min, having used 2.0% of the budget
actual burn     50: fires after  17.3 min, having used 2.0% of the budget
actual burn    100: fires after   8.6 min, having used 2.0% of the budget
actual burn   1000: fires after   0.9 min, having used 2.0% of the budget

Notice the pattern: whatever the burn rate, the 1-hour alert fires when about 2% of the budget is gone. That is the design: the threshold is a budget amount, not an error rate. A full outage pages within a minute; a burn rate of 10 never triggers this rule, which is why the workbook adds the 6-hour window at burn rate 6 for slower but steady burns (next lesson).

In PromQL

With a recording rule for the error ratio, the burn rate is a division:

promql
job:slo_errors_per_request:ratio_rate1h{job="checkout"} / (1 - 0.999)

SLO Recording Rules with promtool builds those rules and tests them.

Test yourself

A service has a 99.5% SLO and currently fails 1% of requests. What is the burn rate?

  1. 0.5
  2. 1
  3. 2
  4. 5

What does a burn rate of 1 mean?

  1. No errors
  2. The budget will be exactly used up at the end of the SLO window
  3. One error per second
  4. The SLO is broken

Why does a 1-hour burn-rate alert at 14.4 always fire after about 2% of the budget is spent, whatever the outage size?

  1. Coincidence
  2. The threshold is chosen as a budget amount: 14.4 x 1 h equals 2% of a 30-day window
  3. Prometheus rounds it
  4. Because of the 5-minute window