From 61d9ebd707b7edc7f40c0d70e27decf6b8c6590e Mon Sep 17 00:00:00 2001 From: Brad Stein Date: Mon, 2 Feb 2026 13:20:45 -0300 Subject: [PATCH] atlasbot: bind hotspot namespaces to node --- atlasbot/engine/answerer.py | 25 ++++++++++++++++++++----- 1 file changed, 20 insertions(+), 5 deletions(-) diff --git a/atlasbot/engine/answerer.py b/atlasbot/engine/answerer.py index 59c124d..eabdd3e 100644 --- a/atlasbot/engine/answerer.py +++ b/atlasbot/engine/answerer.py @@ -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: