fix(monitoring): classify host memory pressure accurately
This commit is contained in:
@@ -2661,7 +2661,7 @@ def _build_host_sustained_load_controlled_automation_readback() -> dict[str, Any
|
||||
},
|
||||
{
|
||||
"class_id": "memory_or_swap_pressure",
|
||||
"alertnames": ["HostLoadAverageSustainedHigh", "HostOutOfMemory"],
|
||||
"alertnames": ["HostLoadAverageSustainedHigh", "HostMemoryUsageHigh", "HostOutOfMemory"],
|
||||
"classifier": "host-sustained-load-controller.py:blocked_memory_or_swap_pressure_requires_service_playbook",
|
||||
"controlled_action": "route to service-specific memory/cgroup playbook with check-mode diff",
|
||||
"controlled_apply_allowed": False,
|
||||
|
||||
@@ -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": [...]}
|
||||
|
||||
Reference in New Issue
Block a user