DORA Metrics — Definitions, the Math, and How to Measure Them

The five DORA metrics as formulas with worked arithmetic, and how Four Keys and GitLab actually compute them. Covers joins, medians, edge cases and the mistakes that distort the numbers.

Overview

Most teams that publish DORA numbers have never checked how the numbers are computed. A dashboard says lead time is 3 hours, but it is a median of daily medians over merge-to-deploy time for merge requests only. Another says recovery time is 0 hours, because the query truncates 50 minutes to zero whole hours. Change failure rate drops to 2% because staging deployments were counted as production. None of these are delivery problems; they are measurement problems, and they are what this page is about.

The concepts, the band history and the capability model are covered in the other DORA pages of this section. This page adds the arithmetic: the definition of each metric as published by DORA, the formula, the events it needs, a worked example on made-up sample data with every step shown, and the exact calculation logic of two real implementations: Google's Four Keys project (archived on January 23, 2024, but still the reference for the SQL) and GitLab's built-in DORA metrics (Ultimate tier).

> [!IMPORTANT] DORA says these metrics are meant to be applied at the application or service level, and should be used to see whether you are improving, not to compare teams, and certainly not individuals (2024 Accelerate State of DevOps report).

Symptom to first check

Each kind of wrong-looking number has a first question to ask, and a section of this page that answers it.

  • Lead time looks too good or too bad: is it commit-to-deploy or merge-to-deploy, median or mean, per change or per merge request? See The five metrics, and Medians, means and windows.
  • Deployment frequency jumped with no process change: are non-production environments in the production tier, and are rollbacks or retries counted? See GitLab's built-in calculation, and Edge cases.
  • Change failure rate is 0% or over 100%: how are incidents linked to deployments, and are duplicates counted twice? See The measurement pipeline, and GitLab's built-in calculation.
  • Recovery time reads 0 hours: is the query truncating to whole hours, and when does the clock start? See Medians, means and windows.
  • An org-wide number hides a struggling service: is it a pooled ratio or an average of service ratios? See Per-service versus organization aggregation.
  • Teams argue about whose numbers are better: the metrics are being used as a target or a league table. See Mistakes and anti-patterns.

Behind every one of these checks sit the same three event sources and the tables built from them.

Key concepts

  • Change lead time
  • Deployment frequency
  • Change fail rate
  • Failed deployment recovery time
  • Deployment rework rate
  • Deploy SHA join
  • Root-cause link
  • Median of daily medians
  • Production deployment tier

Interview questions

  • DORA metrics - explain with math and measurement calculations
  • Why do Four Keys and GitLab use medians, and when would you still look at the mean or a percentile?
  • How do you join a deployment to its commits and to incidents? What breaks if the keys are missing?
  • What counts as a change failure? Does a rollback count? A failed pipeline?
  • Change fail rate and deployment rework rate look similar. What is the difference, and why did DORA add rework rate?
  • How does GitLab calculate DORA metrics, and what are its documented limitations?
  • Your VP wants to rank 20 teams by their DORA metrics and reward the top five. How do you respond?
  • Deployment frequency doubled overnight but nothing changed in the process. How do you debug it?
  • For failed deployment recovery time, when does the clock start and stop? Show how the choice changes the number.
  • How would you report DORA metrics for an organization with 30 services?
  • What were the 2024 DORA performance levels, and how should a team use them?

Sign up free to read the full topic

More DevOps topics

Start free on Cariara · Coding problems · System design studio