fix(webhooks): 補 get_alert_operation_log_repository import 兩處
All checks were successful
CD Pipeline / build-and-deploy (push) Successful in 12m53s
All checks were successful
CD Pipeline / build-and-deploy (push) Successful in 12m53s
alert_received_log_failed 錯誤原因:alertmanager_webhook 函數內 直接呼叫 get_alert_operation_log_repository() 但未在 local scope import, 導致 NameError 被 except 吞掉,ALERT_RECEIVED 事件無法記錄。 Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
@@ -1105,6 +1105,7 @@ async def alertmanager_webhook(
|
||||
# Q9: auto_repair flag — Rule=false 強制 HITL(不觸發自動修復背景任務)
|
||||
_can_auto_repair_by_rule = _alert_labels.get("auto_repair", "true").lower() == "true"
|
||||
try:
|
||||
from src.repositories.alert_operation_log_repository import get_alert_operation_log_repository
|
||||
_op_log = get_alert_operation_log_repository()
|
||||
await _op_log.append(
|
||||
"ALERT_RECEIVED",
|
||||
@@ -1377,6 +1378,7 @@ async def alertmanager_webhook(
|
||||
)
|
||||
else:
|
||||
# auto_repair=false → 記錄 GUARDRAIL_BLOCKED,不觸發自動修復
|
||||
from src.repositories.alert_operation_log_repository import get_alert_operation_log_repository
|
||||
_op_log_rule = get_alert_operation_log_repository()
|
||||
background_tasks.add_task(
|
||||
_op_log_rule.append,
|
||||
|
||||
Reference in New Issue
Block a user