fix(monitoring): classify host memory pressure accurately

This commit is contained in:
ogt
2026-07-15 06:15:13 +08:00
parent 89595a7d8d
commit 5c0c5f6da2
11 changed files with 76 additions and 25 deletions

View File

@@ -960,6 +960,7 @@ async def _resolve_target_from_k8s(incident: "Incident", namespace: str) -> str
# 並加 log 便於追蹤 fallback 路徑
_ALERTNAME_KEYWORDS: dict[str, list[str]] = {
"HostHighCpuLoad": ["api", "web"],
"HostMemoryUsageHigh": ["api", "web"],
"HostOutOfMemory": ["api", "web"],
"DockerContainerUnhealthy": [],
"DockerContainerExited": [],
@@ -1064,7 +1065,7 @@ async def _fetch_metrics_snapshot(incident: Incident) -> dict:
snapshots: dict = {}
# 根據 alertname 選擇最相關的指標
if alertname in ("HostHighCpuLoad", "HostOutOfMemory"):
if alertname in ("HostHighCpuLoad", "HostMemoryUsageHigh", "HostOutOfMemory"):
if instance:
host = instance.split(":")[0]
# P0 fix 2026-04-11: _instant_query 要求 dict回傳 {"result": [...]}