atlasbot: bind hotspot namespaces to node
This commit is contained in:
parent
e752a86ecc
commit
61d9ebd707
@ -584,15 +584,30 @@ class AnswerEngine:
|
|||||||
if hotspot_request and hotspot_line:
|
if hotspot_request and hotspot_line:
|
||||||
namespace_line = None
|
namespace_line = None
|
||||||
if "namespace" in lowered_q:
|
if "namespace" in lowered_q:
|
||||||
for fact in metric_facts:
|
hotspot_node = None
|
||||||
if fact.startswith("node_namespaces_top:"):
|
match = re.search(r"(titan-[a-z0-9]+)", hotspot_line)
|
||||||
namespace_line = fact
|
if match:
|
||||||
break
|
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:
|
if not namespace_line:
|
||||||
for fact in metric_facts:
|
for fact in metric_facts:
|
||||||
if fact.startswith("node_pods_top:"):
|
if fact.startswith("node_namespaces_top:"):
|
||||||
namespace_line = fact
|
namespace_line = fact
|
||||||
break
|
break
|
||||||
|
if not namespace_line:
|
||||||
|
for fact in metric_facts:
|
||||||
|
if fact.startswith("node_pods_top:"):
|
||||||
|
namespace_line = fact
|
||||||
|
break
|
||||||
if namespace_line:
|
if namespace_line:
|
||||||
reply = f"Current hotspots: {hotspot_line}. {namespace_line}."
|
reply = f"Current hotspots: {hotspot_line}. {namespace_line}."
|
||||||
else:
|
else:
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user