Markdown Editor

Runbook Template

Service runbook: overview, dependencies, dashboards, per-alert diagnosis and mitigation with commands, common tasks, rollback, contacts

Software & EngineeringStandardrunbook

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.

FieldValue
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 reviewedYYYY-MM-DD by [@name]
Last drillYYYY-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

DependencyTypeIf unavailableDegradationOwner / contact
PostgreSQL ordersHardAll checkouts failNoneDBA on-call [@dba-rotation]
Redis sessionsSoftUsers must log in againFalls back to DB session lookup (slower)Platform [@platform]
inventory-serviceHardCheckouts fail at reservation stepFeature flag skip_reservation allows oversell riskTeam Inventory
Payment providerHardPayments failOrders held as "pending payment" for 30 minVendor support [phone / portal]
Kafka orders topicSoftWarehouse not notifiedOutbox table buffers events up to 6 hPlatform

3. Dashboards, logs and traces

WhatWhereNormal
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-apiPayment 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:

  1. Check the deploy history. If a deploy happened in the last 2 hours, roll back (section 6) before further diagnosis.
  2. If one dependency is failing (see diagnosis), apply its degradation from section 2.
  3. 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:

  1. If CPU is above 80% across pods, scale out: kubectl -n checkout scale deploy/checkout-api --replicas=[current + 6].
  2. 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:

  1. Check for a connection leak after a recent deploy; roll back if correlated.
  2. 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.

TaskCommand or stepsNotes
Scale outkubectl -n checkout scale deploy/checkout-api --replicas=NHPA may override; also raise minReplicas if sustained
Rolling restartkubectl -n checkout rollout restart deploy/checkout-apiSafe; zero downtime with 6+ replicas
Toggle feature flag[flag console link], flag skip_reservationNeeds product owner approval; oversell risk
Flush session cacheredis-cli -u "$REDIS_URL" --scan --pattern 'sess:*' | xargs redis-cli -u "$REDIS_URL" delLogs every user out; last resort
Replay outbox eventskubectl -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

LevelWhoHowWhen
1Primary on-callPager rotation [link]Any page
2Secondary on-callPager rotationNo acknowledgement in 10 min
3Service owner [@eng-lead]Phone [number]Unmitigated after 20 min or SEV1
4Engineering manager [@manager]Phone [number]SEV1 or customer communication needed
VendorPayment provider support[portal / phone], account ID [ID]Provider-side failure

8. Runbook maintenance

DateChangeBy
YYYY-MM-DDExample: 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