atlasbot: combine cpu + namespace metrics
This commit is contained in:
parent
cc3739efe4
commit
6d6039c8d6
@ -538,10 +538,21 @@ class AnswerEngine:
|
|||||||
if io_line:
|
if io_line:
|
||||||
reply = f"From the latest snapshot: {io_line}."
|
reply = f"From the latest snapshot: {io_line}."
|
||||||
if "namespace" in lowered_q and "pod" in lowered_q:
|
if "namespace" in lowered_q and "pod" in lowered_q:
|
||||||
|
ns_line = None
|
||||||
for line in summary_lines:
|
for line in summary_lines:
|
||||||
if line.startswith("namespaces_top:"):
|
if line.startswith("namespaces_top:"):
|
||||||
reply = f"From the latest snapshot: {line}."
|
ns_line = line
|
||||||
break
|
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"}:
|
if classify.get("question_type") in {"metric", "diagnostic"}:
|
||||||
lowered_q = f"{question} {normalized}".lower()
|
lowered_q = f"{question} {normalized}".lower()
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user