atlasbot: include namespace in hotspot replies

This commit is contained in:
Brad Stein 2026-02-02 13:09:51 -03:00
parent 487c2aa762
commit e752a86ecc

View File

@ -582,7 +582,21 @@ class AnswerEngine:
reply = f"{reply}\n\n{note}" reply = f"{reply}\n\n{note}"
if hotspot_request and hotspot_line: if hotspot_request and hotspot_line:
reply = f"Current hotspots: {hotspot_line}." namespace_line = None
if "namespace" in lowered_q:
for fact in metric_facts:
if fact.startswith("node_namespaces_top:"):
namespace_line = fact
break
if not namespace_line:
for fact in metric_facts:
if fact.startswith("node_pods_top:"):
namespace_line = fact
break
if namespace_line:
reply = f"Current hotspots: {hotspot_line}. {namespace_line}."
else:
reply = f"Current hotspots: {hotspot_line}."
if classify.get("question_type") in {"metric", "diagnostic"} and metric_facts: if classify.get("question_type") in {"metric", "diagnostic"} and metric_facts:
reply = _metric_fact_guard(reply, metric_facts, keyword_tokens) reply = _metric_fact_guard(reply, metric_facts, keyword_tokens)