What is lead time for changes, and how do you measure it in Metabase?
Lead time for changes is the time from a commit to that code running in production. It's the DORA throughput metric for delivery speed, and pairs with deployment frequency. Measure it in Metabase by joining commits to the deploy that shipped them, using GitHub or GitLab data.
What lead time for changes measures
It captures how long code waits between being written and reaching users: review, CI, queueing, and release. Shorter lead time means smaller batches and faster feedback. Use median and p90 — the distribution is right-skewed, so averages mislead.
Lead time for changes vs. lead time vs. cycle time
| Metric | Starts | Ends |
|---|---|---|
| Lead time for changes (DORA) | Code committed | Deployed to production |
| Lead time (flow) | Request/issue created | Issue done |
| Cycle time (flow) | Work started (in progress) | Issue done |
DORA lead time is anchored to code and deploys; the flow metrics are anchored to issues/tickets. Don't conflate them.
What data does it need?
commits:sha,committed_at.deployments:environment,status,created_at, and the shippedsha(ideally the full set of commits per deploy).
SQL patterns
SELECT
date_trunc('week', d.created_at) AS week,
percentile_cont(0.5) WITHIN GROUP (
ORDER BY EXTRACT(EPOCH FROM (d.created_at - c.committed_at)) / 3600
) AS median_lead_hours,
percentile_cont(0.9) WITHIN GROUP (
ORDER BY EXTRACT(EPOCH FROM (d.created_at - c.committed_at)) / 3600
) AS p90_lead_hours
FROM deployments d
JOIN commits c ON c.sha = d.sha
WHERE d.environment = 'production'
AND d.status = 'success'
GROUP BY 1
ORDER BY 1;-- Every commit included in a deploy, not just the tip sha
SELECT
date_trunc('week', d.created_at) AS week,
percentile_cont(0.5) WITHIN GROUP (
ORDER BY EXTRACT(EPOCH FROM (d.created_at - c.committed_at)) / 3600
) AS median_lead_hours
FROM deployments d
JOIN deployment_commits dc ON dc.deployment_id = d.id
JOIN commits c ON c.sha = dc.sha
WHERE d.environment = 'production'
AND d.status = 'success'
GROUP BY 1
ORDER BY 1;Pitfalls
Where this metric applies
- GitHub + Metabase — commits joined to Deployments/Actions
- GitLab + Metabase — commits joined to pipeline deployments