fix(no-action-notify): YAML NO_ACTION 告警改為 TYPE-1 資訊通知(移除無意義審核按鈕)
Some checks failed
CD Pipeline / build-and-deploy (push) Has been cancelled
Some checks failed
CD Pipeline / build-and-deploy (push) Has been cancelled
根因: - host_resource/postgresql_disk_monitoring YAML 規則設 NO_ACTION - 但 classify_notification() 不知道 NO_ACTION - confidence=0.2(感應器無資料)→ 判為 TYPE-4(信心不足需人工審核) - SRE 看到「審核批准/拒絕」按鈕,卻沒有任何自動修復動作可執行 → 毫無意義 修復: - _push_decision_to_telegram 偵測 blocked_reason 含 "NO_ACTION" - 強制 _notif_type = TYPE-1(純資訊通知,無審核按鈕) - SRE 看到資訊卡「主機 CPU/負載/磁碟告警 (觀察即可)」而非假的審核請求 2026-04-16 ogt + Claude Sonnet 4.6 (台北時區) Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
@@ -263,6 +263,15 @@ async def _push_decision_to_telegram(
|
||||
_notification_type = getattr(incident, "notification_type", "") or (_notif_type.value if _notif_type else "")
|
||||
_alertname = incident.signals[0].labels.get("alertname", "MetaSystemAlert") if incident.signals else "MetaSystemAlert"
|
||||
|
||||
# 2026-04-16 ogt + Claude Sonnet 4.6: YAML NO_ACTION → TYPE-1(資訊通知,無按鈕)
|
||||
# 根因:YAML 規則標記 NO_ACTION(如 host_resource/postgresql_disk_monitoring)
|
||||
# 但 classify_notification() 不知道 NO_ACTION → 判為 TYPE-4(confidence 不足)
|
||||
# → SRE 看到審核按鈕卻沒有任何可執行動作,完全無意義
|
||||
# 修復:偵測 blocked_reason 含 "NO_ACTION" → 強制 TYPE-1(純資訊,告知 SRE 即可)
|
||||
_blocked_reason = proposal_data.get("blocked_reason", "")
|
||||
if "NO_ACTION" in _blocked_reason:
|
||||
_notif_type = NotificationType.TYPE_1
|
||||
|
||||
# 2026-04-12 ogt: classify_alert_early() 設的 notification_type 優先於 classify_notification()
|
||||
# 場景:backup/info 告警被 classify_notification() 誤判為 TYPE-3(confidence=0, 無 auto_executed)
|
||||
# 規則:incident.notification_type 明確為 TYPE-1 → 強制走 info 路徑
|
||||
|
||||
Reference in New Issue
Block a user