Operational runbooks and incidents
Prepare for incidents before they happen
An incident is an unplanned disruption or degradation that requires coordinated response. An event is an observed change; an alert is a signal that may require action. A fictional severity scale uses SEV1 for broad checkout failure or suspected integrity risk, SEV2 for significant partial degradation, SEV3 for limited impact with a workaround. Each organization must define severity from user impact, urgency and risk, not from CPU alone. On-call engineers acknowledge actionable alerts; an incident commander coordinates, a technical lead investigates, and a communications owner updates stakeholders. Small teams may combine roles but must identify who is making decisions. Route security or privacy incidents through the appropriate separate procedure. Define primary and backup contacts, escalation timers, handover, and sustainable rotation.
Operational readiness and release gates
Before launching a service, verify an owner and on-call rota, working SLI instrumentation, dashboard and paging route, tested backup restore, capacity headroom, dependency failure behavior, least-privilege access, change audit, runbooks, and a rehearsed rollback or roll-forward plan. Include evidence and expiry for readiness checks. For schema changes, maintain backward compatibility during mixed versions; rollback of binaries alone may not undo data mutations. Review maintenance windows, communicate expected impact and verify outcomes. Do not exclude maintenance from an SLI unless the agreed measurement definition permits it. Require a second authorized reviewer for risky emergency changes, even when features are paused.
Walk through a fictional incident
All timestamps are synthetic UTC on the same day. No production commands are run.
| Time | Evidence or decision |
|---|---|
| 10:00 | Canary release reaches 10% of checkout traffic |
| 10:05 | Short-window errors rise; long-window data incomplete |
| 10:10 | Both burn windows reach 10×; page on-call |
| 10:12 | On-call confirms widespread user impact, declares SEV1 and assigns roles |
| 10:15 | Incident commander pauses further rollout; comparison shows canary failure rate exceeds baseline |
| 10:18 | Owner confirms previous image is known-good, schema backward compatible and rollback authorized |
| 10:20 | Traffic returns to previous version under monitored rollback |
| 10:30 | Error fraction returns below threshold; verify correct orders, backlog and recovery |
| 10:40 | Incident commander closes after agreed recovery checks; schedule review |
Do not infer causation from timing alone. Compare cohorts, dependencies and change logs. If rollback compatibility is unknown, stop expansion, isolate affected traffic where safe, involve the data owner and evaluate roll-forward or restore. Never perform an unreviewed destructive data change. Record decisions and uncertainty; send impact, mitigation status and next update time without leaking credentials or personal data.
Create a runbook with stop conditions
A runbook describes a repeatable procedure; a playbook helps investigate uncertain failures. For this scenario: acknowledge page; confirm data completeness and affected users; check canary and baseline; pause new rollout; escalate by impact; verify rollback artifact, permissions, compatibility and authorization; execute only via approved controls; observe recovery and data integrity; close and hand over. Stop when evidence is missing, schema compatibility is unknown, permission is absent, or actions worsen impact. Escalate rather than improvise. Record timestamps and actions. Run exercises in a sandbox and update runbooks after findings. Automated operations should have bounded scope, dry-run checks, audit, and a human override.
Try a local decision model
Python 3 standard library only. Fraction represents ratios exactly. Inputs are complete synthetic windows as (total, bad), or None. The model uses the previous lesson's fictional thresholds and assumes valid integer counts. The release function accepts current remaining budget as a count (or None), telemetry and readiness flags, incident status, and emergency approval. Its return value is a review recommendation only, never permission to deploy. It is intentionally conservative about missing data. No actions, cloud calls, or credentials are involved.
from fractions import Fraction
def burn(window, objective=Fraction(999, 1000)): if window is None: return None total, bad = window if total < 100 or not 0 <= bad <= total: return None return Fraction(bad, total) / (1 - objective)
def alert(long_window, short_window): long_rate, short_rate = burn(long_window), burn(short_window) if long_rate is None or short_rate is None: return "UNKNOWN" if long_rate >= 10 and short_rate >= 10: return "PAGE" if long_rate >= 10: return "TICKET" return "OBSERVE"
def release_decision(remaining, telemetry_ok, incident_active, ready, emergency=False, approved=False): if not telemetry_ok or remaining is None or not ready: return "HOLD" if incident_active or remaining <= 0: if emergency and approved: return "AUTHORIZED_EMERGENCY_REVIEW" return "HOLD" if emergency and not approved: return "HOLD" return "NORMAL_REVIEW"
print(alert((2000, 20), (200, 2)))print(alert((2000, 20), (200, 0)))print(release_decision(-20, True, True, True))print(release_decision(-20, True, True, True, True, True))Expected output:
PAGETICKETHOLDAUTHORIZED_EMERGENCY_REVIEWA 10× long and short burn triggers paging; the second case has a healthy short window and creates a ticket. An exhausted budget with an active incident blocks normal changes; an approved emergency still requires a separate controlled review. The model omits incident state, alert deduplication and recovery checks; implement those before operational use. An OBSERVE result does not rule out a critical incident.
Learn without blame and reduce toil
A blameless postmortem examines contributing system conditions and decisions with the information available at the time, rather than assigning personal fault. Include impact (affected users and duration with denominator), timeline, detection, mitigation, recovery evidence, contributing factors, unresolved hypotheses, what worked, and corrective actions. For this incident, investigate why canary analysis missed dependency failures, why telemetry was incomplete and whether schema compatibility checks were sufficient. Assign owners and due dates, e.g. delivery owner adds representative canary checks within 14 days; observability owner adds missing-data alerts within seven days; service owner rehearses recovery within 30 days. Verify actions with a test or metric rather than closing them on promises.
Toil is repetitive, manual, automatable operational work that scales with service growth. If manual queue cleanup takes 15 minutes on eight occasions weekly, that is two hours per week. A reviewed automation reducing each to five minutes saves 80 minutes weekly before maintenance costs; use safeguards and measure actual savings. Not every manual task is toil: incident judgment and architecture design often need people. Track page burden and interruptions, rotate duties and allocate time to preventive engineering.
Practice and compare operational guidance
Draft a one-page runbook for checkout. Use the timeline to justify when to escalate, when to pause, and what must be verified before rollback. State one user-facing recovery signal and one data-integrity check. Run the model with missing short-window data, positive remaining budget but failed readiness, and exhausted budget with emergency approval. Explain why a decision label is not an execution authorization.
AWS guidance on responding to events discusses documented response procedures; Azure guidance on safe deployments discusses controlled deployment practices; Google Cloud guidance on managing incidents covers coordinated incident management. Review each separately. They do not prescribe this lesson's severity scale, timing, or release policy.
Check Your Understanding
Solidify your learning with the interactive assessment directly below this lesson.
Concept Quiz & Questions
Operational runbooks and incidents — knowledge check
Choose the best answer for each offline scenario.
What is the first safe decision when canary errors rise and compatibility is unknown?
What does missing short-window data produce in the Python alert model?
What does an approved emergency during budget exhaustion permit in the model?
Which postmortem action is most useful?
Which activity is most likely toil?