Pidoku

Archive

This learning material is in the archive. It is not currently maintained and has not been updated with the latest information, so tool versions, prices and dates may be out of date.

Learning from Incidents

Module 5 Lesson 5.d 45 min Difficulty 3/5

Prerequisites 5.c, 1.b

The idea in one minute#

One postmortem fixes one incident. Learning across many incidents finds the patterns: the same dependency, the same kind of change, the same missing safeguard. That needs a searchable archive of incidents tagged consistently, a regular review of themes, and metrics that actually mean something.

The usual metrics — MTTR and incident counts — mostly do not. Incident durations are heavily skewed, so the mean is dominated by a few long incidents and swings wildly by chance. A Google analysis showed that with realistic numbers of incidents, MTTR cannot reliably detect even large real improvements. Track SLO performance and error budget spend for outcomes, and use incidents for learning rather than scoring.

An analogy#

A hospital does not judge a surgeon by the average length of their operations; a single complicated case would ruin it. It looks at outcomes, complications, and patterns across cases — the same infection appearing in the same ward.

A picture#

flowchart LR
  P1[":i-file-text: Postmortem"] & P2[":i-file-text: Postmortem"] & P3[":i-file-text: Postmortem"] --> ARC[(":i-database: <b>Incident archive</b><br/><small>tagged: trigger, service, factor</small>")]
  ARC --> TH["Quarterly theme review<br/><small>what keeps happening?</small>"]
  TH --> INV[":i-wrench: Systemic investment<br/><small>e.g. staged config rollout for all</small>"]
  ARC --> MET[":i-gauge: Outcome metrics<br/><small>SLO attainment, budget spend</small>"]
  INV --> MET
  class P1,P2,P3 neutral
  class ARC memory
  class TH queue
  class INV compute
  class MET io

How it really works#

Tag incidents consistently#

A short, fixed taxonomy makes the archive searchable:

FieldValues (example)
Triggercode deploy, config change, flag change, infrastructure change, traffic surge, dependency failure, hardware, expiry (cert, domain, quota), data/schema change, unknown
DetectionSLO alert, probe, cause alert, customer report, employee report
Contributing factorsno canary, no validation, missing timeout, retry storm, single point of failure, capacity, missing runbook, access problem, …
Servicesthe services involved
Mitigationrollback, flag off, failover, scale, restart, manual data fix

Then questions become queries: what fraction of SEV-1s were triggered by config changes? How many were first reported by customers?

What to measure#

MeasureWhy it is useful
SLO attainment per service per quarterThe outcome users feel
Error budget spent by triggerWhere reliability is lost: “60% of budget lost to config changes”
Detection source shareCustomers reporting first is a monitoring gap
Repeat incidents (same factor within 90 days)Action items that did not work
Action item completion on timeWhether postmortems change anything
Change failure rate (DORA): share of deployments causing an incident or rollbackRelease safety

Why MTTR misleads#

Incident durations are roughly log-normal: most are short, a few are very long. The mean of such a distribution is unstable with small samples. Concretely:

  • Suppose a team’s incidents have a median duration of 40 minutes, with the spread typical of real data. A team with 15 incidents a quarter will see its quarterly MTTR swing by tens of percent from pure chance, with no change at all in how it works.
  • Štěpán Davidovič’s report Incident Metrics in SRE (Google, 2021) used Monte Carlo simulation on real incident data to show that MTTR comparisons between periods are dominated by this noise, and do not reliably detect even a substantial real improvement.
  • Durations also depend on arbitrary choices — when someone declared the start, when they closed it — and on incident mix (one big outage in a quarter dominates).

The VOID (Verica Open Incident Database) analysis of thousands of public incidents reached the same conclusion: durations are long-tailed, and MTTR is not a meaningful measure of reliability.

Use durations in individual postmortems (“detection took 11 minutes — why?”), not as a team KPI. If you must summarise, use the median and percentiles with confidence intervals, and compare with skepticism.

The theme review#

Quarterly, one hour, SRE and engineering leads:

  1. Read the list of incidents with tags.
  2. Group by trigger and contributing factor. What are the top three themes by budget spent?
  3. For each theme: is there a systemic fix (one platform change that protects every team)?
  4. Check repeat incidents: which action items did not prevent recurrence, and why?
  5. Pick one or two investments, with owners.

Typical systemic outcomes: staged rollout for config across all services, a shared retry library with budgets, a certificate inventory with expiry alerts, a deploy freeze calendar for peak days.

Learning beyond the numbers#

Some of the most valuable learning is qualitative: how responders found information, what confused them, which tools failed them. Techniques from the “learning from incidents” community (resilience engineering) — cognitive interviews with responders, looking at what normally makes things go right — reveal knowledge that tagging misses. Read incidents from other companies too: public postmortems are free lessons.

A worked example#

A company tags a year of 48 incidents. The quarterly review finds:

TriggerIncidentsBudget spent (sum across services)
Config change1158%
Code deploy1721%
Dependency failure912%
Expiry (certs, quotas)46%
Other73%

Code deploys are the most common trigger, but config changes cost almost three times more budget, because code goes through canaries and config goes everywhere at once. The investment: staged config rollout for every service (8.c). The next two quarters, config-triggered budget spend falls to 9%.

Meanwhile, MTTR went from 52 to 71 minutes and back to 44 — and the program below shows why nobody should have reacted to that.

Code#

Go
// mttrnoise.go — show that quarterly MTTR swings by chance even when nothing changes.
package main

import (
	"fmt"
	"math"
	"math/rand"
	"sort"
)

// lognormal duration in minutes with the given median and log-space sigma.
func duration(r *rand.Rand, median, sigma float64) float64 {
	return median * math.Exp(sigma*r.NormFloat64())
}

func mean(xs []float64) float64 {
	s := 0.0
	for _, x := range xs {
		s += x
	}
	return s / float64(len(xs))
}

func median(xs []float64) float64 {
	c := append([]float64(nil), xs...)
	sort.Float64s(c)
	return c[len(c)/2]
}

func main() {
	r := rand.New(rand.NewSource(42))
	const med, sigma = 40.0, 1.2 // a long tail, typical of real incident data
	const perQuarter = 15

	fmt.Println("Same team, same process, eight quarters — only chance differs:")
	fmt.Println("quarter  incidents  MTTR (mean)  median  longest")
	for q := 1; q <= 8; q++ {
		ds := make([]float64, perQuarter)
		for i := range ds {
			ds[i] = duration(r, med, sigma)
		}
		sort.Float64s(ds)
		fmt.Printf("Q%-7d %9d %11.0f m %6.0f m %7.0f m\n", q, perQuarter, mean(ds), median(ds), ds[len(ds)-1])
	}

	// Can MTTR detect a real 20% improvement? Compare many pairs of quarters.
	const trials = 10000
	detected := 0
	for i := 0; i < trials; i++ {
		before := make([]float64, perQuarter)
		after := make([]float64, perQuarter)
		for j := range before {
			before[j] = duration(r, med, sigma)
			after[j] = duration(r, med*0.8, sigma) // genuinely 20% faster
		}
		if mean(after) < 0.9*mean(before) { // "MTTR improved by at least 10%"
			detected++
		}
	}
	fmt.Printf("\nA real 20%% improvement shows up as a ≥10%% MTTR drop in only %.0f%% of quarter pairs.\n",
		100*float64(detected)/trials)
	fmt.Println("In the rest, the dashboard says nothing changed — or that things got worse.")
}

Remember this#

  • Tag incidents with a fixed taxonomy: trigger, detection, factors, services, mitigation.
  • Measure outcomes (SLO attainment, budget by trigger), detection source, repeats and action-item completion.
  • MTTR is dominated by chance and a few long incidents; do not use it as a KPI.
  • Run a quarterly theme review and invest in systemic fixes.
  • Learn qualitatively too — and from other companies’ public postmortems.

Try it#

  1. Run mttrnoise.go. Raise incidents per quarter to 100. How much does the MTTR swing shrink?
  2. Tag your team’s last ten incidents with the taxonomy above. What is the top trigger by impact?
  3. Read three public postmortems (Cloudflare, GitHub and AWS publish detailed ones) and tag them.

Check yourself#

  1. Why is the mean a poor summary of incident durations?
  2. Which metric shows that monitoring has a gap?
  3. What is a “systemic” fix, and why does the theme review look for them?
  4. Code deploys cause more incidents than config changes. Why might config still be the better investment?

Sources#

↑↓ navigate↵ openesc close

100% drag to pan · scroll or pinch to zoom · double-click to zoom in