From 6d6039c8d65db286dffbde06d24ffebf3364fae5 Mon Sep 17 00:00:00 2001 From: Brad Stein Date: Mon, 2 Feb 2026 02:38:53 -0300 Subject: [PATCH] atlasbot: combine cpu + namespace metrics --- atlasbot/engine/answerer.py | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/atlasbot/engine/answerer.py b/atlasbot/engine/answerer.py index a140651..6db5fd6 100644 --- a/atlasbot/engine/answerer.py +++ b/atlasbot/engine/answerer.py @@ -538,10 +538,21 @@ class AnswerEngine: if io_line: reply = f"From the latest snapshot: {io_line}." if "namespace" in lowered_q and "pod" in lowered_q: + ns_line = None for line in summary_lines: if line.startswith("namespaces_top:"): - reply = f"From the latest snapshot: {line}." + ns_line = line break + cpu_line = None + if any(tok in lowered_q for tok in ("cpu", "hottest", "highest cpu", "highest")): + cpu_facts = _extract_hottest_facts(summary_lines, lowered_q) + cpu_line = next((fact for fact in cpu_facts if fact.startswith("hottest_cpu_node")), None) + if ns_line: + if cpu_line: + reply = f"From the latest snapshot: {cpu_line}; {ns_line}." + else: + reply = f"From the latest snapshot: {ns_line}." + # do not fall through to other overrides if classify.get("question_type") in {"metric", "diagnostic"}: lowered_q = f"{question} {normalized}".lower()