Video in progress

Staff 🌿 Git

How do you measure a team's delivery speed (lead time) from Git and PR data, and how should these numbers not be used?

Lead time is the time from commit to prod. I measure it split into stages by the timestamps of the first commit, PR opened, first review, merge and deploy. That shows where things get stuck. But if it is used to compare or evaluate people, it breaks immediately.

📖 Answer

Two of DORA's four metrics come straight from Git and CI: change lead time and deployment frequency. The other two (change failure rate and recovery time) are counted together with incident data.

Splitting lead time into pieces is more useful:

first commit → PR opened        (coding)
PR opened → first review        (waiting)
first review → merge            (review cycle)
merge → prod deploy             (pipeline / release)

On one project the total lead time was 6 days, and when split up, 4 of those days were "merge → deploy": a weekly manual release. Trying to speed up coding and review would have been useless.

Data sources: the platform API (PR times), the deploy pipeline logs, and linking deploys to the commit SHA. Use the median and the 85th percentile. A single three-week PR spoils the average.

How not to use it:

  • comparing developers by the number of commits, lines or PRs: people optimize the number, not the outcome (they split PRs artificially and stop writing tests);
  • ranking teams against each other: the context differs;
  • turning a goal into the metric ("lead time must be under 1 day"): Goodhart's law kicks in.

I show these figures to the team itself, in the retrospective, as an answer to the question "where are we waiting?", and I always look at them paired with a quality metric (change failure rate), to see that speed is not rising at the expense of quality.