What is change failure rate, and how do you measure it in Metabase?
Change failure rate is the share of production deployments that cause a failure — one needing a rollback, hotfix, or incident. It's a DORA stability metric that balances the throughput metrics (deployment frequency and lead time for changes). Measure it in Metabase by joining deploys from GitHub or GitLab to incident data.
What change failure rate measures
It's the percentage of deployments to production that result in degraded service. It guards against optimizing speed at the expense of quality — a rising frequency with a rising failure rate is a warning, not a win. Report monthly to smooth out small denominators.
- Numerator: deploys linked to an incident, rollback, or hotfix.
- Denominator: all successful production deploys.
- A failed CI run that never reached production is not a change failure.
What data does it need?
deployments:environment,status,created_at,repository_id.- A way to mark failures: an
incidentstable withdeployment_id, oris_rollback/is_hotfixflags on deploys. Incident data usually comes from PagerDuty, Opsgenie, incident.io, or a labeled issue.
SQL patterns
SELECT
date_trunc('month', d.created_at) AS month,
COUNT(*) AS deployments,
COUNT(DISTINCT i.deployment_id) AS failed_deployments,
COUNT(DISTINCT i.deployment_id)::numeric
/ NULLIF(COUNT(*), 0) AS change_failure_rate
FROM deployments d
LEFT JOIN incidents i ON i.deployment_id = d.id
WHERE d.environment = 'production'
AND d.status = 'success'
GROUP BY 1
ORDER BY 1;-- Fallback when incidents aren't linked: count deploys followed
-- by a rollback or hotfix deploy within 1 hour
SELECT
date_trunc('month', d.created_at) AS month,
AVG(
CASE WHEN EXISTS (
SELECT 1 FROM deployments r
WHERE r.repository_id = d.repository_id
AND r.environment = 'production'
AND (r.is_rollback OR r.is_hotfix)
AND r.created_at BETWEEN d.created_at AND d.created_at + INTERVAL '1 hour'
) THEN 1.0 ELSE 0.0 END
) AS change_failure_rate
FROM deployments d
WHERE d.environment = 'production' AND d.status = 'success'
GROUP BY 1
ORDER BY 1;Pitfalls
COUNT(DISTINCT deployment_id).Where this metric applies
- GitHub + Metabase — deploys joined to incidents or rollback workflows
- GitLab + Metabase — pipeline deployments joined to incidents