Runbook Template
Service runbook: overview, dependencies, dashboards, per-alert diagnosis and mitigation with commands, common tasks, rollback, contacts
How to use: Use for every service with an on-call rotation, one section per paging alert, linked from the alert itself. Fill dependencies and the alert procedures first and test the commands in a drill. The main pitfall is diagnosis-first steps when a safe mitigation such as rollback exists, and commands that are never re-tested.
Preview
Runbook: [Service name]
Operational runbook for one service: what it does, what it depends on, where to look, and step-by-step procedures for every alert that can page, plus common tasks, rollback and contacts. Written for the on-call engineer at 03:00 who has never touched this service. Replace every
[bracketed]value and every row marked Example.
| Field | Value |
|---|---|
| Service | [checkout-api] |
| Owning team | [Team Orders] |
| Service owner | [@eng-lead] |
| Tier | [Tier 1: revenue critical] |
| On-call rotation | [link to rotation] |
| Repository | [link] |
| SLO document | [link to dev/slo-doc] |
| Last reviewed | YYYY-MM-DD by [@name] |
| Last drill | YYYY-MM-DD |
1. Service overview
Example: checkout-api turns a basket into a paid order. It is called by the
web frontend and the mobile backend, runs as 6 to 24 pods on the prod-eu-1
Kubernetes cluster, and handles about 400 requests per second normally and
1,200 at the evening peak (18:00 to 21:00 UTC). When it fails, customers cannot
buy anything.
The diagram shows synchronous dependencies (solid lines) that fail requests when they are down.
2. Dependencies
| Dependency | Type | If unavailable | Degradation | Owner / contact |
|---|---|---|---|---|
PostgreSQL orders | Hard | All checkouts fail | None | DBA on-call [@dba-rotation] |
| Redis sessions | Soft | Users must log in again | Falls back to DB session lookup (slower) | Platform [@platform] |
| inventory-service | Hard | Checkouts fail at reservation step | Feature flag skip_reservation allows oversell risk | Team Inventory |
| Payment provider | Hard | Payments fail | Orders held as "pending payment" for 30 min | Vendor support [phone / portal] |
Kafka orders topic | Soft | Warehouse not notified | Outbox table buffers events up to 6 h | Platform |
3. Dashboards, logs and traces
| What | Where | Normal |
|---|---|---|
| Service dashboard | [link] | Error rate < 0.1%, p95 < 400 ms |
| SLO dashboard | [link] | Budget remaining > 50% |
| Logs | [link], query service="checkout-api" level>=warn | < 50 warnings per minute |
| Traces | [link], filter service.name=checkout-api | Payment span < 300 ms |
| Database | [link] | Connections < 60% of max |
| Deploy history | [link] | Deploys 10:00 to 16:00 UTC |
4. Alert procedures
Each alert below matches an alert rule name. Start with the mitigation if the impact is user-facing.
4.1 Alert: CheckoutAvailabilityFastBurn
Meaning: the checkout error rate has used more than 2% of the 30-day error budget in the last hour (burn rate 14.4). Users are failing to check out.
Symptoms: 5xx rate above 1.44%, customer reports, support tickets mentioning "something went wrong" at payment.
Mitigation:
- Check the deploy history. If a deploy happened in the last 2 hours, roll back (section 6) before further diagnosis.
- If one dependency is failing (see diagnosis), apply its degradation from section 2.
- Declare an incident if impact continues beyond 10 minutes.
Diagnosis:
# Error breakdown by status and route, last 15 minutes
kubectl -n checkout logs -l app=checkout-api --since=15m | grep '"level":"error"' | jq -r '.route + " " + (.status|tostring)' | sort | uniq -c | sort -rn | head
# Pod health and restarts
kubectl -n checkout get pods -l app=checkout-api -o wide
# Dependency health as seen by the service
curl -fsS https://checkout-api.internal/healthz/deps | jq
Escalation: if not mitigated within 20 minutes, page the service owner; if a dependency is the cause, page that team's on-call.
4.2 Alert: CheckoutLatencyHigh
Meaning: more than 1% of successful checkout requests took longer than 800 ms over the last 30 minutes.
Symptoms: slow checkout, timeouts in the mobile app, rising p95 in traces.
Mitigation:
- If CPU is above 80% across pods, scale out:
kubectl -n checkout scale deploy/checkout-api --replicas=[current + 6]. - If one dependency span dominates the traces, follow that dependency's procedure.
Diagnosis:
# Slowest spans by operation (tracing CLI or UI)
[tracing-cli] query --service checkout-api --since 30m --min-duration 800ms --group-by operation
# Database: long-running queries
psql "$ORDERS_DB_URL" -c "SELECT pid, now()-query_start AS age, left(query,80) FROM pg_stat_activity WHERE state='active' ORDER BY age DESC LIMIT 10;"
Escalation: DBA on-call if queries exceed 5 seconds; service owner if latency persists after scaling.
4.3 Alert: OrdersDbConnectionsHigh
Meaning: database connections above 85% of max_connections for 5 minutes.
Not yet user-facing, but checkout will fail when the limit is reached.
Mitigation:
- Check for a connection leak after a recent deploy; roll back if correlated.
- Restart the pooler:
kubectl -n checkout rollout restart deploy/pgbouncer.
Diagnosis:
psql "$ORDERS_DB_URL" -c "SELECT application_name, state, count(*) FROM pg_stat_activity GROUP BY 1,2 ORDER BY 3 DESC;"
Escalation: DBA on-call during working hours via [channel]; page only if connections exceed 95%.
4.4 Alert: [AlertName]
Meaning: [what the condition means for users]. Mitigation: [numbered steps]. Diagnosis: [commands]. Escalation: [who and when].
5. Common tasks
The tasks below are safe to perform without approval unless stated.
| Task | Command or steps | Notes |
|---|---|---|
| Scale out | kubectl -n checkout scale deploy/checkout-api --replicas=N | HPA may override; also raise minReplicas if sustained |
| Rolling restart | kubectl -n checkout rollout restart deploy/checkout-api | Safe; zero downtime with 6+ replicas |
| Toggle feature flag | [flag console link], flag skip_reservation | Needs product owner approval; oversell risk |
| Flush session cache | redis-cli -u "$REDIS_URL" --scan --pattern 'sess:*' | xargs redis-cli -u "$REDIS_URL" del | Logs every user out; last resort |
| Replay outbox events | kubectl -n checkout create job --from=cronjob/outbox-replay replay-$(date +%s) | Idempotent |
6. Rollback
Rollback takes about 5 minutes. It does not undo database migrations; migrations must be backward compatible for one release (expand and contract).
# Show recent revisions
kubectl -n checkout rollout history deploy/checkout-api
# Roll back to the previous revision
kubectl -n checkout rollout undo deploy/checkout-api
# Or to a specific revision
kubectl -n checkout rollout undo deploy/checkout-api --to-revision=[N]
# Watch until complete, then verify
kubectl -n checkout rollout status deploy/checkout-api
curl -fsS https://checkout.example.com/api/health
After rollback: freeze further deploys in [deploy tool], post in [#deploys], and open an incident record if users were affected.
7. Contacts and escalation
| Level | Who | How | When |
|---|---|---|---|
| 1 | Primary on-call | Pager rotation [link] | Any page |
| 2 | Secondary on-call | Pager rotation | No acknowledgement in 10 min |
| 3 | Service owner [@eng-lead] | Phone [number] | Unmitigated after 20 min or SEV1 |
| 4 | Engineering manager [@manager] | Phone [number] | SEV1 or customer communication needed |
| Vendor | Payment provider support | [portal / phone], account ID [ID] | Provider-side failure |
8. Runbook maintenance
| Date | Change | By |
|---|---|---|
| YYYY-MM-DD | Example: Added OrdersDbConnectionsHigh after INC-YYYY-0142 | [@name] |
| YYYY-MM-DD | [Change] | [@name] |
Based on common industry practice for service runbooks and on-call operations. Template licence: MIT.
Related templates
Architecture Decision Record (ADR) Template
Lightweight Nygard-style ADR: status, context, decision, consequences, alternatives, related decisions, lifecycle and log
Software & EngineeringAGENTS.md Template for AI Coding Agents
Repository instructions for AI coding agents: setup, build and test commands, conventions, architecture map, PR and security rules
Software & EngineeringAI Coding Assistant Policy Template
Policy for AI coding assistants and agents: autonomy levels, tool register, secrets, sandboxing, review of generated code, provenance, OWASP ASI and SSDF mapping