# Delivery Metrics

Course: [CI/CD](https://www.devtutorials.ai/learn/cicd) · Section: Running Pipelines Well
Source: https://www.devtutorials.ai/learn/cicd/running-pipelines-well/delivery-metrics

> The four DORA numbers: deployment frequency, lead time, change failure rate and time to restore. Simulate a team's month, find the slowest part of lead time and move all four into the green.

## Delivery Metrics

How do you know your pipeline is getting better?

You measure it. Four numbers are used by teams all over the world. They come from a research group called **DORA**.

In this lesson you:

- learn the four numbers.
- see one team's month in a simulator.
- find the slowest part of their lead time.
- move all four numbers into the green.

**Simple lesson:** what you measure, you can improve.

### A Real-World Example

Think about a school bus.

- **How often it runs:** every 15 minutes, or once a day?
- **Door to school:** how long from your stop to the gate?
- **Breakdowns:** how many trips out of 10 have a problem?
- **Back on the road:** after a breakdown, how fast does a spare bus come?

Now map it:

- **How often** = deployment frequency.
- **Door to school** = lead time for changes.
- **Breakdowns** = change failure rate.
- **Spare bus** = time to restore.

**Simple lesson:** two numbers measure speed. Two numbers measure safety. You want both.

## The Four Numbers

| Number | Question it answers | Good teams aim for |
|---|---|---|
| **Deployment frequency** | How often do we release to production? | Many times a week, or daily |
| **Lead time for changes** | How long from commit to production? | Less than a day |
| **Change failure rate** | Out of our releases, how many cause a problem? | A small share, like 15% or less |
| **Time to restore** | How long to fix production when it breaks? | Less than an hour |

**Real tools vs this lab:** DORA's yearly reports group teams into bands, and the exact numbers change a little each year. The "aim for" column is a simple guide. In this lab, the team's month is simulated with a small teaching model.

**Simple lesson:** speed and safety go up together when the pipeline is good.

## Lead Time: Find the Slowest Part

Lead time is made of waiting, not working:

- **Waiting for review:** big pull requests wait longer.
- **Pipeline runs:** usually the smallest part.
- **Waiting for approval:** a person must click.
- **Waiting for release day:** "we only release on Fridays".

The coloured bar under the numbers shows each part.

- Making the pipeline faster helps a little.
- Removing the biggest wait helps the most.

**Simple lesson:** fix the biggest part of the bar first. It is rarely the pipeline itself.

## Release More Often

- Releasing once a week packs many changes into one release.
- If it breaks, which change caused it? Hard to tell.
- Releasing after each merge means each release is small and easy to undo.

**Simple lesson:** small, frequent releases are safer than big, rare ones.

## Fewer Failures, Faster Recovery

- **Gates** (lint, types, tests) stop bad changes before merge.
- **Smoke tests** stop bad releases at staging.
- **Automatic rollback** makes the time to restore minutes, not hours.

Do not turn the numbers into a target for each person. If people are punished for failures, they hide them. Use the numbers to improve the pipeline, not to blame people.

Start simple. Count releases and failures in a shared sheet for a month. You do not need a dashboard tool to start improving.

**Simple lesson:** every lesson in this course moves one of these four numbers.

1. Open your starter repo's Actions tab and count the production deploys this month.
2. For one release, note the time of the first commit and the time production went live.

**What you should see:** your own deploy frequency and lead time. Write them down and check again next month.

## Quick Check

## Cheat Sheet

| Number | Raise it or lower it | What moves it in this course |
|---|---|---|
| Deployment frequency | Raise | Release on merge, small pull requests |
| Lead time for changes | Lower | Faster reviews, fewer waits, Faster Pipelines |
| Change failure rate | Lower | Quality Gates on Pull Requests, Deploy and Smoke Test |
| Time to restore | Lower | Rollback and Recovery |

## Common mistakes

| Mistake | Wrong idea | Correct idea | What goes wrong |
|---|---|---|---|
| Only speeding up the pipeline | The pipeline is the slow part | Waiting is usually bigger | Lead time barely moves |
| Releasing once a week to be safe | Fewer releases = fewer problems | Big releases fail harder | Long, painful outages |
| Measuring people, not the process | Numbers show who is bad | They show where the process is slow | People hide failures |
| Counting only successes | Failures look bad | Count every failure | The numbers lie |
| Chasing one number | Speed is all that matters | Watch all four | Fast but broken releases |

## What to Remember

- Four numbers: frequency, lead time, failure rate, time to restore.
- Two for speed, two for safety.
- Lead time is mostly waiting. Fix the biggest wait first.
- Small, frequent releases with automatic rollback move all four.

## Exercises

Next: **Pipelines as a Product**
