50 行
1.2 KiB
Markdown
50 行
1.2 KiB
Markdown
# DORA 指标(CFR)落地说明(P13-7)
|
||
|
||
更新时间:2026-02-12
|
||
|
||
## 指标口径
|
||
|
||
- `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%)时,暂停高风险灰度并补回归样本。
|