diff --git a/apps/api/src/api/v1/webhooks.py b/apps/api/src/api/v1/webhooks.py index 87f70ad3..3ebda8e6 100644 --- a/apps/api/src/api/v1/webhooks.py +++ b/apps/api/src/api/v1/webhooks.py @@ -93,6 +93,7 @@ async def create_incident_for_approval( alert_type: str, message: str, source: str = "alertmanager", + alertname: str | None = None, ) -> str: """ 為 Approval 創建對應的 Incident (活躍事件同步) @@ -119,7 +120,7 @@ async def create_incident_for_approval( severity=severity, source=source, fired_at=now_taipei(), - labels={"namespace": namespace, "resource": target_resource}, + labels={"namespace": namespace, "resource": target_resource, "alertname": alertname or alert_type}, annotations={"message": message}, ) @@ -1340,6 +1341,7 @@ async def alertmanager_webhook( alert_type=alert_type, message=message, source="alertmanager", + alertname=alertname, ) # 2026-04-06 ogt: Phase 26 — 回寫 incident_id 到 Approval @@ -1462,6 +1464,7 @@ async def alertmanager_webhook( alert_type=alert_type, message=message, source="alertmanager", + alertname=alertname, ) background_tasks.add_task(