atlasbot: bind hotspot namespaces to node

This commit is contained in:
Brad Stein 2026-02-02 13:20:45 -03:00
parent e752a86ecc
commit 61d9ebd707

View File

@ -584,15 +584,30 @@ class AnswerEngine:
if hotspot_request and 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
hotspot_node = None
match = re.search(r"(titan-[a-z0-9]+)", hotspot_line)
if match:
hotspot_node = match.group(1)
if hotspot_node:
for line in summary_lines:
if line.startswith("node_namespaces_top:") and f"{hotspot_node} " in line:
namespace_line = line
break
if not namespace_line:
for line in summary_lines:
if line.startswith("node_pods_top:") and hotspot_node in line:
namespace_line = line
break
if not namespace_line:
for fact in metric_facts:
if fact.startswith("node_pods_top:"):
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: