atlasbot: use hottest node labels for insights
This commit is contained in:
parent
79650616f1
commit
69d121aa07
@ -16,7 +16,7 @@ spec:
|
|||||||
labels:
|
labels:
|
||||||
app: atlasbot
|
app: atlasbot
|
||||||
annotations:
|
annotations:
|
||||||
checksum/atlasbot-configmap: manual-atlasbot-58
|
checksum/atlasbot-configmap: manual-atlasbot-59
|
||||||
vault.hashicorp.com/agent-inject: "true"
|
vault.hashicorp.com/agent-inject: "true"
|
||||||
vault.hashicorp.com/role: "comms"
|
vault.hashicorp.com/role: "comms"
|
||||||
vault.hashicorp.com/agent-inject-secret-turn-secret: "kv/data/atlas/comms/turn-shared-secret"
|
vault.hashicorp.com/agent-inject-secret-turn-secret: "kv/data/atlas/comms/turn-shared-secret"
|
||||||
|
|||||||
@ -1608,14 +1608,26 @@ def _insight_candidates(
|
|||||||
|
|
||||||
hottest = metrics.get("hottest_nodes") if isinstance(metrics.get("hottest_nodes"), dict) else {}
|
hottest = metrics.get("hottest_nodes") if isinstance(metrics.get("hottest_nodes"), dict) else {}
|
||||||
if hottest:
|
if hottest:
|
||||||
|
def _hot_node(entry: dict[str, Any]) -> str:
|
||||||
|
if not isinstance(entry, dict):
|
||||||
|
return ""
|
||||||
|
return (
|
||||||
|
entry.get("node")
|
||||||
|
or entry.get("label")
|
||||||
|
or (entry.get("metric") or {}).get("node")
|
||||||
|
or ""
|
||||||
|
)
|
||||||
|
|
||||||
cpu = hottest.get("cpu") if isinstance(hottest.get("cpu"), dict) else {}
|
cpu = hottest.get("cpu") if isinstance(hottest.get("cpu"), dict) else {}
|
||||||
if cpu.get("node") and cpu.get("value") is not None:
|
cpu_node = _hot_node(cpu)
|
||||||
|
if cpu_node and cpu.get("value") is not None:
|
||||||
value_fmt = _format_metric_value(str(cpu.get("value")), percent=True)
|
value_fmt = _format_metric_value(str(cpu.get("value")), percent=True)
|
||||||
candidates.append(("cpu", f"The busiest CPU right now is {cpu.get('node')} at about {value_fmt}.", "high"))
|
candidates.append(("cpu", f"The busiest CPU right now is {cpu_node} at about {value_fmt}.", "high"))
|
||||||
ram = hottest.get("ram") if isinstance(hottest.get("ram"), dict) else {}
|
ram = hottest.get("ram") if isinstance(hottest.get("ram"), dict) else {}
|
||||||
if ram.get("node") and ram.get("value") is not None:
|
ram_node = _hot_node(ram)
|
||||||
|
if ram_node and ram.get("value") is not None:
|
||||||
value_fmt = _format_metric_value(str(ram.get("value")), percent=True)
|
value_fmt = _format_metric_value(str(ram.get("value")), percent=True)
|
||||||
candidates.append(("ram", f"RAM usage peaks on {ram.get('node')} at about {value_fmt}.", "high"))
|
candidates.append(("ram", f"RAM usage peaks on {ram_node} at about {value_fmt}.", "high"))
|
||||||
|
|
||||||
postgres_line = _postgres_summary_line(metrics)
|
postgres_line = _postgres_summary_line(metrics)
|
||||||
if postgres_line:
|
if postgres_line:
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user