Your Name
3779f6f1e0
fix(metrics): 串入飛輪指標到 /metrics 主端點,修復 FlywheelExecutionRateMissing 死告警
INC-20260507-99ADF2 根因(feedback_full_chain_first_then_fix.md 全鏈分析):
【鏈路斷點】規則層(5/3 加)vs 指標層(5/6 改)vs scrape 層(從沒同步)
- 577250a6(5/3)「反消音化」commit 加了 FlywheelExecutionRateMissing
rule,要求 110 Prom scrape 到 awoooi_flywheel_execution_success_rate;
- a2c4b3d4(5/6)Codex 改 FlywheelStatsService 用 auto_repair_executions
作 source of truth(24h 樣本 1-9 筆回 None 給 W-3b watchdog 接管);
- 但 awoooi_flywheel_* 指標自始至終只在 /api/v1/stats/flywheel/metrics
暴露,110 Prom awoooi-api job 抓的是 /metrics → absent() 永遠 1
→ 自 2026-05-06T04:14 UTC 起 firing 26h+ 屬 dead alert
【修法】只動 awoooi-api 一處,不碰 Codex 設計、不碰 110 Prom 配置:
- main.py /metrics endpoint 改 async,在 generate_latest() 後串入
FlywheelStatsService.compute() → to_prometheus_lines()。
- 既有 awoooi-api scrape job 自動拿到飛輪指標。
- 完全保留 Codex a2c4b3d4 設計:1-9 筆回 None 讓 W-3b watchdog 雙保險。
【不碰的部分】
- flywheel_stats_service.py 不動:Codex 5/6 LOGBOOK 已明確說明
「Redis playbook counter 失準 → 用 auto_repair_executions 為唯一信任源」,
1-9 筆 return None 是配合 ai_slo_watchdog_job W-3b grace+30min 設計的
反消音化雙保險,不是 bug。
驗證計畫(部署後):
1. curl /metrics | grep awoooi_flywheel → 看到飛輪指標
2. Prom query awoooi_flywheel_execution_success_rate → 非空
3. ALERTS{alertname="FlywheelExecutionRateMissing"} → resolved
4. 30 分鐘觀察 Telegram 不再收 INC-20260507-99ADF2
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-05-07 15:32:47 +08:00
..
2026-03-26 16:06:20 +08:00
2026-05-05 22:14:54 +08:00
2026-05-04 13:37:11 +08:00
2026-05-07 15:32:47 +08:00
2026-05-06 14:33:16 +08:00
2026-04-05 01:00:31 +08:00
2026-03-22 18:57:44 +08:00
2026-05-05 15:25:37 +08:00
2026-04-07 16:00:12 +08:00
2026-04-10 13:03:25 +08:00
2026-05-04 13:37:11 +08:00
2026-03-29 15:27:49 +08:00
2026-05-04 10:59:38 +08:00
2026-04-16 22:23:49 +08:00
2026-03-22 18:57:44 +08:00
2026-04-15 15:34:04 +08:00