docs(cases/oracle): add DG/DR alert template label drift Path A 修法 case#226
Conversation
新增 docs/cases/oracle/oracle-dg-dr-alert-template-drift-path-a-fix-case.md
(250 行), 沉淀 alert template `{{ $labels.X }}` 字面引用 metric 不携带的
label 时渲染空字符串这一 UX 字面错的 Path A doc-spec 层修法。
具体场景: addon 给客户/平台交付 Prometheus alert template 时, 在
description / labels / summary 字段写了 `{{ $labels.thread_id }}` 或
`{{ $labels.db_unique_name }}` 这种 label 插值, 但实际触发告警的 metric
不携带这个 label。Prometheus / vmalert 不会拦截, 静悄悄渲染成空字符串。
告警卡片上出现"DG 备库 (, thread )"这样的半截描述, 客户值班看见会问
"是不是坏了", 信任度被磨掉。
修法分两条路:
- Path A (doc-spec 层短期修, 本 case 主体): 改 alert template 字面,
全局 default labels 块拆 per-rule, 只在 metric 携带的 rule 上 promote;
description 字面只引用 metric 携带的 label; pending 分支显式标
(backlog ID + spec 描述 + 落地后要改成什么)。
- Path B (SQL 层长期修, 排 Sprint 3+ backlog): fork exporter binary,
改 SQL probe 加 select 把 label 补齐到 raw metric 上。
主体 engine-neutral:
- 5 条硬规则 (mental-run / 全局 default 只放每条都有的 / per-rule labels
只放 metric 携带的 promote / mental-run + UI 抽查 verify / pending
显式标)
- per-rule label promotion 决策树 (3 步)
- pending 分支标记三件信息口径
- 6 行反模式表 (label drift / 全局默认放部分 metric label / fork 万能
反模式 / recording rule LHS 自动保留误解 / pending 不标 / 不 mental-run)
案例附录 (A.1-A.9, Oracle Data Guard / Disaster Recovery 具体例子):
- 五项 lock 不变 (跟 v0.2 final 字面对齐)
- 6 raw metric label 集 (含 replication_lag_seconds 表载 vs raw scrape
drift 备注)
- v0.2 final → v0.3 字面 diff 表 (12 行 diff 类别)
- §4 全局 default labels v0.3 字面 (删 db_unique_name 行)
- Rule 1/2/9/10 description v0.3 字面 (删 `, thread {{ thread_id }}`)
- Rule 5/12 per-rule labels v0.3 字面 (加 thread_id promotion)
- Rule 7/8 pending B1-b 注释 v0.3 字面
- §6 e2e 验证项 6 (AlertManager UI 抽查 db_unique_name / thread_id
非空 + Rule 4/6/13 无空字符串残留)
- Sprint 3 W1+ batch 待 trigger 表
按 addon-docs-writing skill 模板: frontmatter + 第一段问题陈述 (本 case
解决什么场景) + `## 先用白话理解这篇文档` (4 段) + `## 术语速查` (10
个术语 first-use expand) + `## 适用场景` 表 + `## 通用方法论` (硬规则
+ 决策树 + pending 口径 + 反模式表) + `## 与其他 doc / skill 关系`
(cross-link PR #221 case body + PR #222 8 类 blocker guide +
design-contract-review-during-xp + addon-docs-writing skill) + `## 案
例附录` + `## 一句话总结`。
跨 PR 依赖: 本 PR 跟 PR #221 (Sprint 2 case body) + PR #222 (8 类 peer
review blocker class guide 同期 OPEN。本 PR cross-link PR #221 §6.5
Path A vs Path B 路径选择 + §10 backlog row B3 owner 路由; 合并顺序
建议先 #221 (本 PR 的 cross-link 依赖), 再 #222 / 本 PR (这两个独立)。
来源: Skyworth PoC Sprint 2 Oracle DG/DR 规则包交付 P1-E (alert
template label drift, 9 条 rule definite affected) 修法落地。Emma
(KubeBlocks Enterprise) P1-E scope 收敛后 audit 确认 fixture JSON 字面
0 change, Path A 物理位置 = Oracle Addon 自己 workspace v0.2 final spec
doc; Emma 倾向 (c) PR-ify 一步到位 + GitHub byte-level diff view 比
inline paste 更稳 → 本 PR。Cindy 22:27 patrol 提的案例沉淀方向对齐。
Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
EOF
)
|
Byte-level static review PASS on commit Checklist 1: §4 全局 default labels 块拆 per-rule labels 字面对齐 ✓
Checklist 2: Rule 1/2/9/10 description
|
Summary
docs/cases/oracle/oracle-dg-dr-alert-template-drift-path-a-fix-case.md(250 行), 沉淀 alert template{{ \$labels.X }}字面引用 metric 不携带的 label 时渲染空字符串这一 UX 字面错的 Path A doc-spec 层修法addon-docs-writingskill 模板: frontmatter + 第一段问题陈述 + 先用白话理解 + 术语速查 (10 个术语 first-use expand) + 适用场景 + 通用方法论 + 与其他 doc/skill 关系 + 案例附录 + 一句话总结来源
Skyworth PoC Sprint 2 Oracle DG/DR 规则包交付 P1-E (alert template label drift, 9 条 rule definite affected) 修法落地:
, thread {{ \$labels.thread_id }}thread_idpromotionoracle_dr_drift_secondsPoC same-cluster vs production cross-cluster topology pending B1-b lock (Emma 方案 A 双 file 物理隔离 + record name 区分) → Rule 7/8 显式标 pending B1-b 注释Emma (KubeBlocks Enterprise apiserver) P1-E scope 收敛后 audit 确认 fixture JSON 字面 0 change, Path A 物理位置 = Oracle Addon 自己 workspace v0.2 final spec doc; Emma 倾向 (c) PR-ify 一步到位 + GitHub byte-level diff view 比 inline paste 更稳 → 本 PR。Cindy 22:27 patrol 提的"案例沉淀方向"对齐。
PR 依赖 (合并顺序)
本 PR cross-link PR #221 (Sprint 2 case body) §6.5 "Path A vs Path B 路径选择" + §10 backlog row B3 owner 路由 (James alert template + Emma apiserver chart 同步)。
合并顺序建议:
oracle-dg-dr-promql-rule-pack-sprint2-case.md)如果 PR #221 没先合, 本 PR 的 cross-link
docs/cases/oracle/oracle-dg-dr-promql-rule-pack-sprint2-case.md会指向 main 上不存在的文件。Boundary
apps.kubeblocks.io/dg-pair注入 land 后, alert template v0.4 batch 接Test plan
thread_id字样删干净 (案例附录 A.5)addon-docs-writingskill self-check 3Q: