TExcelTAD

Runbooks

A runbook (or playbook) tells the person holding the pager what to do when a specific alert fires: what it means, how to check the impact, the likely causes, the safe mitigations and who to call. The responder may be new to the service, half awake, or both. A good runbook turns a 3 a.m. page from "where do I even start?" into a checklist.

Every paging alert should link to its runbook in an annotation, so the link arrives with the page:

yaml
annotations:
  summary: "checkout is burning its 30-day error budget fast"
  runbook_url: "https://runbooks.example.com/checkout/error-budget-burn"
  dashboard: "https://grafana.example.com/d/checkout-slo"

Template

markdown
# Runbook: <AlertName>

**Service:** <service>   **Owner:** <team>   **Last reviewed:** <date> (by <name>)
**Severity:** page / ticket   **SLO:** <link to the SLO document>

## What this alert means
One paragraph in plain language: which users are affected and how badly, at the threshold that fires.

## Check the impact (first 5 minutes)
1. Dashboard: <link>. Which journeys, regions, versions?
2. Query: <PromQL>, expected value when healthy, value at the alert threshold.
3. Is it still happening? (short-window burn rate)

## Likely causes, most common first
| Clue | Probable cause | Mitigation |
|---|---|---|

## Mitigations
Step-by-step, with exact commands, the expected result of each, and how to undo it.

## Escalate
Who, how (rotation names, not people), and when.

## Background
Architecture notes, dependencies, past incidents (links to postmortems).

A worked runbook

markdown
# Runbook: CheckoutErrorBudgetBurn (severity=page)

**Service:** checkout   **Owner:** payments team   **Last reviewed:** 2026-03-02 (S. Park)
**SLO:** 99.9% of checkout requests succeed, rolling 28 days (link)

## What this alert means
More than 1.44% of checkouts are failing over the last hour (or 0.6% over 6 hours), and still failing over the
last 5 (or 30) minutes. Customers see "Payment could not be completed". At this rate 2% of the monthly error
budget is gone every hour.

## Check the impact
1. Error ratio, last 5 minutes (healthy: < 0.001):
   sum(rate(http_requests_total{job="checkout",code=~"5.."}[5m])) / sum(rate(http_requests_total{job="checkout"}[5m]))
2. The same `by (version)`, `by (region)` and `by (route)`. One version → bad release. One region → infrastructure
   or a zonal dependency. All of them → shared dependency (database, payment provider).

## Likely causes
| Clue | Probable cause | Mitigation |
|---|---|---|
| errors only on the newest `version` | bad release | roll back: revert the image bump in the GitOps repo (or `argocd app rollback checkout` when auto-sync is off) |
| 503 + payment-provider latency high | provider degradation | enable the "queue payments" flag (orders saved as pending payment) |
| 500 + DB connection errors in logs | database failover or pool exhausted | see runbook "OrdersDBConnections" |

## Escalate
Not mitigated in 30 minutes, or the cause is unclear: page `payments-secondary` and declare SEV-2.
Payment provider status: (link). Provider support: (phone, contract id in the vault).

Trying a runbook on recorded data

The runbook's queries only help if they're correct. The session backfills 20 minutes of synthetic counters into a Prometheus TSDB (a canary of version v42 starts taking a quarter of the traffic at minute 10 and fails 20% of its requests), starts Prometheus on that data, and runs the runbook's first steps with promtool query. Times are Unix timestamps: 1767226200 is 00:10 UTC.

bash · try it yourself
# 20 minutes of counters, one sample a minute from 2026-01-01T00:00:00Z (epoch 1767225600)
python3 - > data.om <<'PY'
start = 1767225600
print("# TYPE http_requests counter")
series = {}
for m in range(21):
    t = start + 60 * m
    canary = m >= 10                     # v42 starts taking 25% of traffic at minute 10
    rates = {("v41", "200"): 600 if not canary else 450, ("v41", "500"): 1,
             ("v42", "200"): 0 if not canary else 120, ("v42", "500"): 0 if not canary else 30}
    for key, per_min in rates.items():
        series[key] = series.get(key, 0) + (per_min if m else 0)
        version, code = key
        print(f'http_requests_total{{job="checkout",version="{version}",code="{code}"}} {series[key]} {t}')
print("# EOF")
PY
promtool tsdb create-blocks-from openmetrics data.om ./data > /dev/null
echo "global: {}" > prometheus.yml
prometheus --config.file=prometheus.yml --storage.tsdb.path=./data --storage.tsdb.retention.time=100y \
  --web.listen-address=127.0.0.1:9090 > prom.log 2>&1 &
for i in $(seq 300); do curl -s 127.0.0.1:9090/-/ready > /dev/null && break; sleep 0.2; done
q() { promtool query instant --time=2026-01-01T00:20:00Z http://127.0.0.1:9090 "$1"; }
echo "## step 1: how bad is it? (error ratio, last 5 minutes)"
q 'sum(rate(http_requests_total{job="checkout",code=~"5.."}[5m])) / sum(rate(http_requests_total{job="checkout"}[5m]))'
echo "## step 2: since when? (error ratio per minute)"
promtool query range --start=2026-01-01T00:06:00Z --end=2026-01-01T00:14:00Z --step=2m http://127.0.0.1:9090 \
  'round(sum(rate(http_requests_total{job="checkout",code=~"5.."}[2m])) / sum(rate(http_requests_total{job="checkout"}[2m])), 0.001)'
echo "## step 3: is it one version?"
q 'sum by (version) (rate(http_requests_total{job="checkout",code=~"5.."}[5m])) / sum by (version) (rate(http_requests_total{job="checkout"}[5m]))'
kill %1
## step 1: how bad is it? (error ratio, last 5 minutes)
{} => 0.051580698835274545 @[1767226800]
## step 2: since when? (error ratio per minute)
{} =>
0.002 @[1767225960]
0.002 @[1767226080]
0.03 @[1767226200]
0.052 @[1767226320]
0.052 @[1767226440]
## step 3: is it one version?
{version="v41"} => 0.0022172949002217295 @[1767226800]
{version="v42"} => 0.2 @[1767226800]

In three queries the responder knows the error ratio (5%, a burn rate around 50 for a 99.9% SLO), that it started at about minute 10, and that only v42 fails. The runbook's first mitigation, rolling back, follows directly. Running the runbook against recorded data like this, or during a game day, is how you find the query with a typo before an incident does.

Keeping runbooks alive

  • Review after every use: the responder fixes what was wrong or missing as part of the incident follow-up.
  • Date and owner at the top; a runbook not reviewed for a year is suspect.
  • Automate the steps that are always the same. A runbook step that is pure copy-paste ("run these three queries") becomes a script or a dashboard link; a step that is always "restart X" becomes automatic remediation, or better, a bug fix. Runbooks should shrink over time.
  • Link from the alert, not from a wiki page nobody finds.

Test yourself

Where should the link to a runbook live?

  1. In a wiki index
  2. In the alert's annotations, so it arrives with the page
  3. In the postmortem
  4. In the SLO document only

In the session, what did breaking the error ratio down by (version) reveal?

  1. Both versions fail equally
  2. Only the canary version v42 fails, so a rollback is the likely mitigation
  3. The database is down
  4. Nothing

A runbook step says 'restart the worker' and is used every week. What should happen?

  1. Nothing, it works
  2. Automate it as a stopgap and fix the bug that makes the restart necessary
  3. Delete the runbook
  4. Page more people