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

@@ -103,6 +103,10 @@ class TestInfrastructure:
assert ac == "host_resource"
def test_host_memory(self):
ac, nt = classify_alert_early("HostMemoryUsageHigh", "warning", {})
assert ac == "host_resource"
def test_historical_host_out_of_memory_alias(self):
ac, nt = classify_alert_early("HostOutOfMemory", "warning", {})
assert ac == "host_resource"

View File

@@ -21,6 +21,11 @@ class TestGetIncidentTypeStaticFallback:
result = get_incident_type("HostHighCpuLoad")
assert result == "host_cpu"
@pytest.mark.parametrize("alertname", ["HostMemoryUsageHigh", "HostOutOfMemory"])
def test_memory_pressure_taxonomy_and_historical_alias(self, alertname):
"""新記憶體壓力名稱與歷史事件 alias 都維持 host_memory。"""
assert get_incident_type(alertname) == "host_memory"
def test_known_alertname_k8s(self):
"""KubePodCrashLooping → k8s_pod_crash"""
result = get_incident_type("KubePodCrashLooping")