61 行
2.1 KiB
Markdown
61 行
2.1 KiB
Markdown
# DORA 指标(CFR)落地说明(P13-7)
|
||
|
||
更新时间:2026-02-12
|
||
|
||
## QAOPS8 四指标口径
|
||
|
||
| 指标 | 定义 | 当前轻量数据源 | 使用边界 |
|
||
| --- | --- | --- | --- |
|
||
| 部署频率 | 单位时间内完成受控部署的次数 | git commit、部署记录、Runbook 部署摘要 | 只统计经过门禁和记录的部署 |
|
||
| 变更前置时间 | 从需求或 Issue 进入执行到部署或验收完成的时间 | Issue CSV 状态时间、git commit、最终验收记录 | 当前先按人工记录统计,不引入重平台 |
|
||
| 变更失败率 | 部署或回归后引发失败、回滚、热修的变更比例 | 回归 JSON、热修记录、Issue Notes | 现有 CFR 脚本优先覆盖此项 |
|
||
| 服务恢复时间 | 从故障确认到恢复并通过验证的时间 | 事故记录、回滚记录、`/ready` 和门禁复检时间 | 当前作为演练和事故复盘指标,不作为个人绩效 |
|
||
|
||
DORA 指标只用于交付系统改进,不作为个人绩效指标;不能为追求指标而降低测试、审计或回滚要求。
|
||
|
||
## CFR 指标口径
|
||
|
||
- `run_cfr = failed_runs / total_runs`
|
||
- `commit_cfr = failed_commits / total_commits`
|
||
- `failed_commit` 判定:
|
||
1. 对应回归 run 失败;或
|
||
2. 该 commit 在回归时间后 24 小时内出现热修记录。
|
||
|
||
## 数据输入
|
||
|
||
- 回归 JSON:来自 `server/scripts/regression-all.sh --json-report`
|
||
- 可选热修 CSV:`commit_sha,occurred_at`
|
||
|
||
## 生成命令
|
||
|
||
```bash
|
||
python3 scripts/cfr_report.py \
|
||
--input-dir artifacts/regression \
|
||
--window 7d,30d \
|
||
--output-json /tmp/cfr.json \
|
||
--output-md /tmp/cfr.md
|
||
```
|
||
|
||
带热修记录:
|
||
|
||
```bash
|
||
python3 scripts/cfr_report.py \
|
||
--input-dir artifacts/regression \
|
||
--window 30d \
|
||
--hotfix-csv data/hotfix-events.csv \
|
||
--output-json /tmp/cfr.json
|
||
```
|
||
|
||
## 输出结构(JSON)
|
||
|
||
- `generated_at`
|
||
- `input_dir`
|
||
- `reports_scanned`
|
||
- `hotfix_events`
|
||
- `windows.<Nd>.{total_runs,failed_runs,run_cfr,run_cfr_pct,total_commits,failed_commits,commit_cfr,commit_cfr_pct}`
|
||
|
||
## 使用建议
|
||
|
||
- 周报使用 `7d`,月报使用 `30d`。
|
||
- 当 `commit_cfr_pct` 持续高于阈值(例如 15%)时,暂停高风险灰度并补回归样本。
|