Quality metrics that are not lies
A quality metric is a question with a definition, a data source, a decision it informs and a list of things it must never be used for: escape rate, flake rate, recovery time and the DORA metrics, and why coverage belongs on the diagnostic page, not in the OKRs
Leadership adopts your escape rate as a team OKR: below 10% by quarter end, with the score feeding into performance reviews. What is the most likely first change in the data?
Every quality team is asked for numbers. The request is reasonable: leadership funds the function, and it wants to know whether quality is getting better and whether the money is helping. The trouble is that the easy numbers, test counts, coverage percentages, pass rates, bugs found per tester, measure activity, and activity is what people produce more of when you point a target at it. The useful numbers are harder to collect, slower to move, and easy to corrupt once they carry a reward.
This chapter is about building a quality dashboard that tells the truth: which metrics, defined how, sourced from where, reviewed by whom, and, the column most dashboards leave out, what each must not be used for.
The model: a metric is a question, not a number
Before you add a number to a dashboard, write down four things about it.
The question it answers. ‘Are customers meeting bugs we could have caught?’ is a question. ‘Escape rate’ is a label. If you cannot write the question, you do not know whether the metric answers it.
The definition. Numerator, denominator, period, inclusions and exclusions, in words a sceptic could recompute. Two teams computing ‘escape rate’ differently will produce two numbers that look comparable and are not.
The source. Which system, which field, which query. A metric whose source is ‘the QA lead’s spreadsheet’ dies when the QA lead goes on holiday.
The decision it informs. What will someone do differently when it moves? If nothing, it is decoration. The escape rate going up should trigger an escape review; flake over budget should pause new end-to-end tests; change fail rate rising should change how releases are staged.
Then sort what you have into three kinds.
| Kind | Examples | Good for | Dangerous as |
|---|---|---|---|
| Outcome | Escape rate, change fail rate, customer-impacting incidents, recovery time | Telling leadership whether quality is improving | A target tied to individuals or pay |
| Signal health | Flake rate, gating-suite run time, quarantine age | Knowing whether your evidence can be trusted | A comparison between teams with different suites |
| Activity | Coverage, test counts, bugs found, test cases executed | Diagnosis: where are the gaps, where is effort going | Almost anything else |
Outcome metrics go on the page leadership reads. Signal-health metrics go on the page the engineering leads read every week. Activity metrics go on a diagnostic page that the people doing the work use to find gaps, and they never become goals.
Goodhart’s law, and Strathern’s version of it
The law has two forms, and it is worth knowing both. Charles Goodhart, an economist advising the Bank of England, observed in 1975 that ‘any observed statistical regularity will tend to collapse once pressure is placed upon it for control purposes’. He was writing about money-supply figures. The anthropologist Marilyn Strathern, in a 1997 paper on audit in British universities, put it in the words everyone now quotes: ‘When a measure becomes a target, it ceases to be a good measure.’ Her example was degree classifications: the more a 2:1 becomes an expectation, the poorer it is at telling students apart. The product chapter on metrics and experiments uses the same law to argue for guardrail metrics; this chapter applies it to quality.
The law is not a claim that people cheat. Most gaming is honest. An engineer told to reach 80% coverage writes tests for the easy code first, because that is the rational way to reach 80%. A triage group under an escape target argues each borderline case in good faith, and the borderline cases go one way. Nobody lies; the number drifts away from the thing it once tracked.
Every quality metric has a cheap way to move it and a metric that would reveal the move. Know both before you publish.
| Metric | Cheap way to move it | What reveals the move |
|---|---|---|
| Coverage | Tests with no assertions; excluding hard modules | Mutation score on the same code; escapes in covered code |
| Escape rate | Reclassify post-release bugs; log fewer pre-release ones | Support ticket volume; incidents; count of ‘not a bug’ closures |
| Flake rate | Blanket retries; quarantine with no end date | Quarantine size and age; retried-pass count |
| Recovery time | Close the incident at mitigation that did not hold | Reopened incidents; repeat incidents within 7 days |
| Deployment frequency | Split one change into several deploys | Change lead time; change size |
| Change fail rate | Do not declare small incidents | Rework deploys; support tickets after deploys |
This pairing is the core of a dashboard that survives. DORA’s own guidance says the same of its metrics: use several, ‘including some with a healthy amount of tension between them’.
The metrics, defined so they hold
Escape rate
Use the definition from why quality engineering exists, unchanged, so the whole track speaks one language: of all defects found in a period, the share found after release, by customers, support or monitoring, rather than before. The complement is the older defect detection percentage.
At Lead level you add three refinements that keep it honest.
- Weight by severity, or split it. Fifty cosmetic escapes and one that moved money are not the same quarter. Report the overall rate and, separately, the count of severity 1 and 2 escapes. The second number is the one leadership should watch. The severity scale is the one your bug reports already use.
- Cohort by release, with a window. A bug shipped in March may be found in June. Attribute each escape to the release that introduced it where you can, and read a release’s rate after a fixed window, say 30 days. A rule of thumb, not a standard: pick the window and keep it.
- Make found-by a required field. The data source is the tracker; the field that matters is where the defect was found (unit check, review, exploratory session, staging, customer, support, monitoring). If triage can leave it blank, it will.
Must not be used for: ranking individual engineers or testers; a target with a reward attached; comparing teams whose products have different user bases and logging habits.
Flake rate
Again use the definition the track already has, from test automation and the SDET: the share of gating-suite runs that pass only on retry, measured weekly against the flake budget the team agreed, with any test that flakes twice in a week quarantined. Show beside it the quarantine list size and the age of its oldest item, because a falling flake rate with a growing quarantine is not progress.
Flake rate is a signal-health metric. Its job is to tell you whether a red build means anything. John Micco’s 2016 account of flakiness at Google found that most pass-to-fail transitions involved a flaky test; when that is true locally, every other number on the dashboard that depends on test results is suspect.
Must not be used for: comparing teams with different suites (a team with forty browser tests and one with four thousand unit tests are not on the same scale); judging the SDET, who did not write most of the tests.
Recovery time, and why not the mean
MTTR, mean time to restore or recover, is the most requested number and the least reliable. Incident durations have a long tail: one six-hour outage outweighs twenty fifteen-minute ones. Štěpán Davidovič, in a report published by Google SRE, ran simulations on incident data and concluded that MTTR and similar statistics are ‘poorly suited for decision making or trend analysis’. With a handful of incidents a quarter, a shift in the mean is mostly noise. Switching to the median does not rescue it: the same report finds that ‘median TTR isn’t helping us either’, and that higher percentiles such as the 95th ‘perform much worse’, because they are set by the rarest, worst incidents.
What to do instead:
- Show the count and the individual incidents, as a strip or table of durations, not a single averaged trend line. If you must give one number, give the median with the count beside it and say it is descriptive, not evidence of improvement. Read the long incidents one by one in the postmortem review; that is where the learning is.
- Define the start and end. Start: when customer impact began, from monitoring, not when someone opened a ticket. End: when impact stopped, not when the root cause was fixed.
- Scope it. DORA now measures failed deployment recovery time, recovery from a deployment that needed immediate intervention, rather than all incidents. That makes it a quality measure of your release process. Keep all-incident recovery as an SRE metric, defined in the observability course’s incidents and postmortems chapter.
Must not be used for: judging on-call engineers; a target, which rewards closing incidents early.
The DORA metrics
Accelerate, by Nicole Forsgren, Jez Humble and Gene Kim (2018), reported four years of survey research on software delivery. Its central finding for a quality lead is that throughput and stability were not a trade-off: the highest performers deployed more often, with shorter lead times, and also had lower change failure rates and faster recovery. The book named four key metrics. DORA, the research programme behind it, now publishes five, grouped in two:
| Group | Metric | DORA’s definition |
|---|---|---|
| Throughput | Change lead time | Time for a change to go from committed to version control to deployed in production |
| Throughput | Deployment frequency | Number of deployments in a period, or time between them |
| Throughput | Failed deployment recovery time | Time to recover from a deployment that fails and needs immediate intervention |
| Instability | Change fail rate | Share of deployments that need immediate intervention |
| Instability | Deployment rework rate | Share of deployments that are unplanned and happen because of a production incident |
Change fail rate is the one closest to your work, because it measures whether release evidence held up. It needs a definition of ‘immediate intervention’ that your release sign-off process records: a rollback, a hotfix, a flag turned off, a forward fix within a set time.
DORA’s guide lists the misuses itself. The metrics apply ‘at the application or service level’; comparing vastly different applications misleads; setting them as mandated targets invites gaming; and the point is improvement over time, not to compete against other teams.
Data sources: the deployment pipeline for deploy events and commit timestamps, the incident tool for interventions, and a join between them by service and time. Most of the work is the join.
Coverage: a map, not a score
Coverage is the metric leadership asks for most, because it is easy to understand and every tool produces it. The case against it as a target comes from the people who run coverage at the largest scale.
Google’s testing blog post ‘Code Coverage Best Practices’ (Carlos Arguelles, Marko Ivanković and Adam Bender, 2020) offers 60% as ‘acceptable’, 75% as ‘commendable’ and 90% as ‘exemplary’, and in the next sentence says ‘we like to stay away from broad top-down mandates and encourage every team to select the value that makes sense for their business needs’. It warns that engineers ‘may start treating your target like a checkbox’, that coverage ‘does not guarantee that the covered lines or branches have been tested correctly’, only that a test executed them, and that project-wide goals above 90% are most likely not worth it. Martin Fowler’s bliki entry puts it in two lines: coverage is ‘a useful tool for finding untested parts of a codebase’ and ‘of little use as a numeric statement of how good your tests are’.
The same Google post makes the case for coverage used well, and you should make it too.
- Low coverage is informative. A module at 20% is largely untested by automation on every deploy. That is worth knowing.
- Coverage of changed code works. Ivanković and colleagues’ 2019 paper, ‘Code Coverage at Google’, reports that coverage becomes actionable when applied at the level of changesets and code review. A reviewer seeing which new lines no test executed is a better use of the number than a quarterly percentage.
- Do not let it fall. A ratchet, where coverage on a critical service may not decrease, is a guardrail rather than a goal.
- Pair it with mutation testing. The blog names mutation testing as the better way to check whether covered lines are asserted on. A mutation score on your riskiest module tells you whether its coverage is real.
Where practitioners disagree
Whether quality metrics belong in OKRs at all. One camp says outcome metrics such as severity 1 and 2 escapes are exactly what a quality OKR should hold. The other says any metric tied to a score gets gamed, so quality should appear in OKRs only as a guardrail: ‘ship X without change fail rate rising above Y’. The OKR mechanics, including committed against aspirational key results and the harm done by tying scores to pay, are covered in product leadership; the quality lead’s addition is that guardrail framing usually survives Goodhart better.
Whether to show metrics per team. Per-team numbers find where help is needed. They also become a league table the moment a VP sorts the column. Many leads show per-team numbers to the team and its manager, and only aggregates and trends upward.
Who owns the dashboard. If QA owns it, engineers may read it as QA’s scorecard on them. If engineering owns it, nobody may maintain the definitions. A common answer: the quality lead owns definitions and data quality; each engineering manager owns their team’s numbers.
Day to day
Weekly, thirty minutes. Review the signal-health page with the SDETs: flake against budget, quarantine age, gating-suite run time. This is the page that tells you whether the rest is trustworthy. Fix data problems found here first, such as a pipeline that stopped emitting deploy events.
Fortnightly, in each team’s retro or a joint escape review, forty-five minutes. Walk the new escapes: where each was found, where it could have been caught, and the one change that would catch the next. The escape review is where the number becomes practice, and it is the only meeting on this list that changes the product.
Monthly, an hour. A data hygiene pass. Sample twenty closed bugs and check found-by and severity were set correctly; look at ‘not a bug’ and ‘works as intended’ closures for reclassified escapes; check the incident tool’s interventions against the deploy log. Write what you found in a short note, even when it is nothing. This is the audit that keeps the dashboard honest.
Quarterly, a written quality review for engineering leadership. Two pages: trends with their counts, the three escapes that mattered most and what changed because of them, and one proposal. Present it in the engineering leadership meeting, not by email. This is also when someone will propose a new target, so bring the paired metrics.
When a metric is requested. Someone asks for a new number every few weeks. Run it through the four questions: the question, the definition, the source, the decision. Most requests are a question you can answer once with a query rather than a chart you maintain forever.
When a definition changes. Record it in a changelog on the dashboard itself, with a date, and mark the discontinuity on every chart. Silent redefinition is how a metric becomes a lie without anyone gaming it.
There is no dashboard and there should not be one yet. With a few dozen bugs a quarter, every metric is noise. What you can do is set the habits that make metrics possible later: a required found-by field in the tracker, a severity scale, and a deploy log, even a channel where every deploy is posted. Read the escapes one by one in a monthly review instead of computing a rate. If a founder asks for a coverage number, give it, with a sentence saying which risky code it does not cover.
This is where the dashboard is built and where its definitions get set for years. Write the spec before you build the charts, and get the engineering managers to agree the definitions in writing. Expect two data problems: deploy events spread across several CI systems, and a tracker where found-by was optional for two years. Expect one political problem: the first time a leader asks for coverage in the OKRs. Your answer then sets the tone for every metric that follows.
The metrics exist, in several competing dashboards, with definitions that differ by division. Your job is consolidation and governance: one definition per metric, a named owner, a changelog. Metrics may also be audit or regulatory evidence, which makes them harder to change and more tempting to game. Expect quality numbers in executive scorecards and pressure to rank teams. Hold the line on aggregation and context, and agree in writing which metrics may be compared across divisions and which may not.
Template
# Quality dashboard spec: <org or group>
Owner (definitions and data quality): <name> · Reviewed: <cadence> · Version: <n>
## Audience and pages
- Leadership page: <outcome metrics, trends, quarterly>
- Engineering page: <signal health, weekly>
- Diagnostic page: <activity metrics, for the teams; not reported upward>
## Metric: <name>
Question: <what it answers, in one sentence>
Definition: <numerator> / <denominator>, per <period>; includes <...>; excludes <...>
Data source: <system, field, query link>
Aggregation: <per service | per team | org>; <median, p90, rate>; minimum n: <...>
Owner of the number: <role>
Decision it informs: <when it moves past X, who does what>
Paired metric: <the number that would move if this one were gamed>
Must not be used for: <ranking people | targets with reward | cross-team comparison | ...>
(repeat for: escape rate, sev 1-2 escapes, flake rate, quarantine age,
change lead time, deployment frequency, change fail rate,
failed deployment recovery time, deployment rework rate, coverage)
## Not on this dashboard, and why
- <metric> — <reason>
## Data hygiene
- Required fields: <found-by, severity, introduced-in release>
- Monthly audit: <sample size, who, what is checked>
## Changelog
| Date | Metric | Change | Effect on trend |
|---|---|---|---| WORKED EXAMPLE
Thornbury Bank is a fictional retail bank. Its payments group, five teams, owns faster payments, standing orders and the payee service in the mobile app. The quality engineering lead wrote this spec after the CTO asked for ‘a quality number for the board’. Extracts:
Escape rate. Question: are customers or monitoring finding defects we could have found? Definition: defects found after release / all defects found, per quarter, by found-by field; release cohort read at 30 days. Source: Jira, field found-by, made required in July. Last quarter: 31 of 212, 14.6%. Paired: support tickets tagged payments, 1,840. Must not be used for: individual reviews, cross-group comparison.
Severity 1 and 2 escapes. Count per quarter, each linked to its escape review: 4 last quarter, one a duplicate standing order. This is the number on the board page.
Flake rate. Share of gating runs passing only on retry, weekly: 3.1% against a 2% budget; quarantine 17 tests, oldest 23 days. Decision: over budget for two weeks pauses new browser tests.
Change fail rate. 11 of 122 production deployments needed rollback, flag-off or hotfix within 24 hours: 9.0%. Paired: deployment rework rate.
Failed deployment recovery time. n=11, shown as a strip of the eleven durations: nine under an hour, two of about six hours, both linked to their postmortems. No trend line; the quarter’s median (47 minutes) appears as a label only, marked low-n. Start: first alert or customer report; end: impact stopped.
Coverage. Diagnostic page only; ratchet on the payments-ledger service, currently 78%, may not fall. Mutation score on the ledger’s rounding module: 61%, which is the more useful number.
Not on this dashboard. Test case counts, bugs found per tester: activity, and both reward the wrong behaviour.
Now you
You have joined Plover, a fictional delivery-notification service that sends SMS updates for 300 retail and courier clients, as Quality Engineering Lead: 120 people, seven product teams, two SDETs. The COO wants ‘one quality number’ for the monthly business review after a bug sent 40,000 duplicate SMS messages, costing about £1,600 in carrier fees and a client’s complaint. Your data: 410 bugs logged last quarter, found-by filled on 58% of them; deploys go through two CI systems, one of which emits no events; the gating suite retries every test three times silently. A VP has asked for a per-team league table, and an engineering manager has already promised 85% coverage. Write the quality dashboard spec. Say what you can report now, what you cannot until the data is fixed, and what the COO’s one number should be.
Self-check
You are the Quality Engineering Lead at Thornbury Bank's payments group. After an incident in which some standing orders ran twice, the CTO proposes a company key result for next quarter: 80% unit test coverage across all repositories, reported monthly to the executive committee. The group is at 64% on average; the standing-order bug sat in code that was 88% covered. You have a week before OKRs are fixed. What do you recommend?
- BOOK Accelerate: The Science of Lean Software and DevOps Nicole Forsgren, Jez Humble and Gene Kim, 2018
The research behind the four key metrics and the finding that throughput and stability move together. Read chapter 2 before you defend change fail rate to anyone. Read: Part one, chapters 1 and 2, on measuring delivery performance.
- DOC DORA's software delivery performance metrics DORA
The current five metrics with their official definitions, and a list of pitfalls including targets, team comparisons and blending across services. Quote it when someone wants a league table.
- PAPER 'Improving ratings': audit in the British University system Marilyn Strathern, 1997
The source of the formulation 'when a measure becomes a target, it ceases to be a good measure', in a paper about what audit does to the thing audited. Short and worth reading whole. Read: European Review 5(3), pp. 305–321.
- POST Code Coverage Best Practices Carlos Arguelles, Marko Ivanković and Adam Bender, 2020
Google's guidance: 60, 75 and 90% as guidelines, no top-down mandates, per-commit coverage and mutation testing. The single most useful link for the coverage-target conversation.
- PAPER Code Coverage at Google Marko Ivanković, Goran Petrović, René Just and Gordon Fraser, 2019
How coverage is computed and surfaced in code review at very large scale, and how developers perceive it. Read it for the case that changeset coverage is where the number earns its keep. Read: ESEC/FSE 2019, pp. 955–963.
- POST Test Coverage Martin Fowler, 2012
Two pages on why coverage finds untested code but says little about test quality, and what happens when a coverage level becomes a target.
- DOC Incident Metrics in SRE Štěpán Davidovič, 2021
A statistical argument, with simulations, that MTTR is unreliable for trend analysis, and what to measure instead. Read it before you put a mean on any chart.
All companies and people in these examples are fictional. Any resemblance to a real business or person is unintended.