atlasbot: add node namespace lines for hotspots
This commit is contained in:
parent
178ae5470d
commit
487c2aa762
@ -329,6 +329,18 @@ class AnswerEngine:
|
|||||||
metric_facts = hottest_facts
|
metric_facts = hottest_facts
|
||||||
key_facts = _merge_fact_lines(metric_facts, key_facts)
|
key_facts = _merge_fact_lines(metric_facts, key_facts)
|
||||||
if "namespace" in lowered_q and any(term in lowered_q for term in ("hotspot", "hot spot", "hottest")):
|
if "namespace" in lowered_q and any(term in lowered_q for term in ("hotspot", "hot spot", "hottest")):
|
||||||
|
hotspot_node = None
|
||||||
|
if hottest_facts:
|
||||||
|
match = re.search(r"hottest_\w+_node: (?P<node>[^\s\[]+)", hottest_facts[0])
|
||||||
|
if match:
|
||||||
|
hotspot_node = match.group("node")
|
||||||
|
if hotspot_node:
|
||||||
|
for line in summary_lines:
|
||||||
|
if line.startswith("node_namespaces_top:") and f"{hotspot_node} " in line:
|
||||||
|
metric_facts = _merge_fact_lines([line], metric_facts)
|
||||||
|
key_facts = _merge_fact_lines([line], key_facts)
|
||||||
|
break
|
||||||
|
if not hotspot_node or not any(line.startswith("node_namespaces_top:") for line in metric_facts):
|
||||||
for line in summary_lines:
|
for line in summary_lines:
|
||||||
if line.startswith("node_pods_top:"):
|
if line.startswith("node_pods_top:"):
|
||||||
metric_facts = _merge_fact_lines([line], metric_facts)
|
metric_facts = _merge_fact_lines([line], metric_facts)
|
||||||
|
|||||||
@ -828,6 +828,13 @@ def _append_node_pods(lines: list[str], summary: dict[str, Any]) -> None:
|
|||||||
if ns_label:
|
if ns_label:
|
||||||
label = f"{label} ({ns_label})"
|
label = f"{label} ({ns_label})"
|
||||||
lines.append("node_pods_max: " + label)
|
lines.append("node_pods_max: " + label)
|
||||||
|
for item in top:
|
||||||
|
node = item.get("node")
|
||||||
|
namespaces = item.get("namespaces_top") or []
|
||||||
|
if not node or not namespaces:
|
||||||
|
continue
|
||||||
|
ns_label = ", ".join([f"{name}={count}" for name, count in namespaces])
|
||||||
|
lines.append(f"node_namespaces_top: {node} ({ns_label})")
|
||||||
|
|
||||||
|
|
||||||
def _append_pod_issues(lines: list[str], summary: dict[str, Any]) -> None:
|
def _append_pod_issues(lines: list[str], summary: dict[str, Any]) -> None:
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user