Sub topic 14
Measuring Delivery Performance
This chapter assumes you can read a pipeline definition, know the difference between continuous integration, continuous delivery, and continuous deployment, and understand environments and rollbacks. It shows how to tell whether your pipeline is helping.
Why measure
A pipeline can run green every day and still deliver slowly or break production often. Metrics replace opinions with numbers. They show whether changes reach users quickly and whether those changes are safe.
The best-known set is the four DORA metrics, from the DevOps Research and Assessment program. Two measure speed. Two measure stability.
| Metric | What it measures | Type |
|---|---|---|
| Deployment frequency | How often you deploy to production | Speed |
| Lead time for changes | Time from commit to running in production | Speed |
| Change failure rate | Share of deployments that cause a failure needing a fix, rollback, or hotfix | Stability |
| Time to restore service | Time from a production failure to recovery | Stability |
Reading each metric
Deployment frequency counts production deployments per day or week. Small, frequent releases are easier to test and easier to undo, so a rising number usually signals healthy batch sizes.
Lead time for changes starts at the commit (or merge) and ends when the change is live. Long lead times often come from slow tests, manual approvals, or queues waiting for a release window.
Change failure rate is failed deployments divided by total deployments. If 3 of 40 deployments needed a rollback or hotfix, the rate is 3 / 40 = 7.5%.
Time to restore service reflects how well your rollbacks, feature flags, and monitoring work. Fast recovery matters more than never failing.
Getting the data from your pipeline
Your CI/CD system already records most of what you need: start and end times of runs, which commit each run built, and whether a deploy succeeded. The script below computes deployment frequency, median lead time, and change failure rate from a list of deployment records.
from datetime import datetime
from statistics import median
deployments = [
{"commit_time": "2026-11-30T09:00", "deploy_time": "2026-11-30T10:30", "failed": False},
{"commit_time": "2026-12-01T13:00", "deploy_time": "2026-12-01T13:50", "failed": True},
{"commit_time": "2026-12-02T08:15", "deploy_time": "2026-12-02T09:00", "failed": False},
{"commit_time": "2026-12-03T15:00", "deploy_time": "2026-12-03T16:10", "failed": False},
]
def parse(ts):
return datetime.fromisoformat(ts)
lead_minutes = [
(parse(d["deploy_time"]) - parse(d["commit_time"])).total_seconds() / 60
for d in deployments
]
failures = sum(1 for d in deployments if d["failed"])
first = parse(min(d["deploy_time"] for d in deployments))
last = parse(max(d["deploy_time"] for d in deployments))
days = max((last - first).days, 1)
print(f"Deployments per day: {len(deployments) / days:.2f}")
print(f"Median lead time (min): {median(lead_minutes):.0f}")
print(f"Change failure rate: {failures / len(deployments):.0%}")Run it and you get 1.33 deployments per day, a median lead time of 70 minutes, and a 25% change failure rate. With real data, pull records from your CI system's API or from deployment events.
Using metrics well
- Track trends over weeks, not single days. One bad deployment should not decide your conclusion.
- Use medians for lead time. A few very slow changes distort an average.
- Read the metrics together. Raising deployment frequency while change failure rate climbs means you are shipping faster but less safely.
- Compare a team with its own past, not with other teams. Context differs.
Finding the bottleneck
When a metric looks poor, break it into parts. If lead time is long, measure how much of it is queue time, build time, test time, and approval wait. The largest slice is where to act first. A 40-minute test suite points to parallelizing or trimming tests. A two-day approval wait points to process, not tooling.
Exercise
Over a month your team made 50 production deployments. 4 needed a rollback or hotfix. What is the change failure rate, and which of the four metrics would rollbacks and feature flags most directly improve?
Show answer
The change failure rate is 4 / 50 = 8%. Rollbacks and feature flags most directly improve time to restore service, because they let you undo or switch off a bad change quickly.