grafana: alerts and the log-absence rule key on agent and sender, not hive
This commit is contained in:
parent
7796f53874
commit
2306b60473
1 changed files with 37 additions and 36 deletions
|
|
@ -1604,16 +1604,16 @@ in
|
||||||
for = "15m";
|
for = "15m";
|
||||||
summary = "swarm-controller has failed to write forge objects on consecutive reconcile passes";
|
summary = "swarm-controller has failed to write forge objects on consecutive reconcile passes";
|
||||||
})
|
})
|
||||||
# `hive` and `agent` are the resource attributes every
|
# `agent` is the resource attribute every agent container's log
|
||||||
# agent container's log forwarder carries, so each agent
|
# forwarder carries, and agent names are unique in the swarm, so
|
||||||
# is its own alert instance.
|
# each agent is its own alert instance.
|
||||||
(logCountRule {
|
(logCountRule {
|
||||||
uid = "hh-swarm-term-publish-skipped";
|
uid = "hh-swarm-term-publish-skipped";
|
||||||
title = "swarm terminal publish skipped";
|
title = "swarm terminal publish skipped";
|
||||||
windowSeconds = 900;
|
windowSeconds = 900;
|
||||||
expr = ''_time:15m _msg:"swarm terminal: publish skipped" | stats by (hive, agent) count() as skipped'';
|
expr = ''_time:15m _msg:"swarm terminal: publish skipped" | stats by (agent) count() as skipped'';
|
||||||
for = "5m";
|
for = "5m";
|
||||||
summary = "{{ $labels.hive }}/{{ $labels.agent }} is dropping swarm terminal rows: the harness is not connected to the queue";
|
summary = "{{ $labels.agent }} is dropping swarm terminal rows: the harness is not connected to the queue";
|
||||||
})
|
})
|
||||||
# `CONNECT_EXHAUSTED` in hive-agent's swarm_queue.rs,
|
# `CONNECT_EXHAUSTED` in hive-agent's swarm_queue.rs,
|
||||||
# logged when the harness's first-connect retries
|
# logged when the harness's first-connect retries
|
||||||
|
|
@ -1625,9 +1625,9 @@ in
|
||||||
uid = "hh-swarm-queue-connect-failed";
|
uid = "hh-swarm-queue-connect-failed";
|
||||||
title = "swarm queue connect failed";
|
title = "swarm queue connect failed";
|
||||||
windowSeconds = 3600;
|
windowSeconds = 3600;
|
||||||
expr = ''_time:1h _msg:"no swarm queue connection; exiting, since this agent cannot run without one" | stats by (hive, agent) count() as failures'';
|
expr = ''_time:1h _msg:"no swarm queue connection; exiting, since this agent cannot run without one" | stats by (agent) count() as failures'';
|
||||||
for = "0s";
|
for = "0s";
|
||||||
summary = "{{ $labels.hive }}/{{ $labels.agent }} could not connect to the swarm queue and its harness exited; systemd starts it again 30s later";
|
summary = "{{ $labels.agent }} could not connect to the swarm queue and its harness exited; systemd starts it again 30s later";
|
||||||
})
|
})
|
||||||
# A run that ends without a verdict leaves that PR with no
|
# A run that ends without a verdict leaves that PR with no
|
||||||
# classifier review. `swarm-review-classifier` logs four
|
# classifier review. `swarm-review-classifier` logs four
|
||||||
|
|
@ -1648,9 +1648,9 @@ in
|
||||||
uid = "hh-swarm-agent-state-publish-skipped";
|
uid = "hh-swarm-agent-state-publish-skipped";
|
||||||
title = "swarm agent state publish skipped";
|
title = "swarm agent state publish skipped";
|
||||||
windowSeconds = 900;
|
windowSeconds = 900;
|
||||||
expr = ''_time:15m _msg:"swarm agent state: publish skipped" | stats by (hive, agent) count() as skipped'';
|
expr = ''_time:15m _msg:"swarm agent state: publish skipped" | stats by (agent) count() as skipped'';
|
||||||
for = "5m";
|
for = "5m";
|
||||||
summary = "{{ $labels.hive }}/{{ $labels.agent }} is dropping agent state updates: the harness is not connected to the queue";
|
summary = "{{ $labels.agent }} is dropping agent state updates: the harness is not connected to the queue";
|
||||||
})
|
})
|
||||||
# Logged on every connection attempt, so it repeats under
|
# Logged on every connection attempt, so it repeats under
|
||||||
# the reconnect backoff for as long as the path is empty.
|
# the reconnect backoff for as long as the path is empty.
|
||||||
|
|
@ -1658,9 +1658,9 @@ in
|
||||||
uid = "hh-swarm-queue-credential-missing";
|
uid = "hh-swarm-queue-credential-missing";
|
||||||
title = "swarm queue credential missing";
|
title = "swarm queue credential missing";
|
||||||
windowSeconds = 900;
|
windowSeconds = 900;
|
||||||
expr = ''_time:15m _msg:"nothing is stored at this agent's queue credential path; its queue connection retries under backoff" | stats by (hive, agent) count() as missing'';
|
expr = ''_time:15m _msg:"nothing is stored at this agent's queue credential path; its queue connection retries under backoff" | stats by (agent) count() as missing'';
|
||||||
for = "5m";
|
for = "5m";
|
||||||
summary = "{{ $labels.hive }}/{{ $labels.agent }} finds nothing at its queue credential path and cannot connect to the queue";
|
summary = "{{ $labels.agent }} finds nothing at its queue credential path and cannot connect to the queue";
|
||||||
})
|
})
|
||||||
# Logged once per failed turn, by `emit_turn_end` in
|
# Logged once per failed turn, by `emit_turn_end` in
|
||||||
# hive-agent's turn.rs; the window is how long the rule
|
# hive-agent's turn.rs; the window is how long the rule
|
||||||
|
|
@ -1672,9 +1672,9 @@ in
|
||||||
uid = "hh-agent-turn-failed";
|
uid = "hh-agent-turn-failed";
|
||||||
title = "agent turn failed";
|
title = "agent turn failed";
|
||||||
windowSeconds = 900;
|
windowSeconds = 900;
|
||||||
expr = ''_time:15m _SYSTEMD_UNIT:="hive-agent.service" _msg:="turn failed" | stats by (hive, agent) count() as failures'';
|
expr = ''_time:15m _SYSTEMD_UNIT:="hive-agent.service" _msg:="turn failed" | stats by (agent) count() as failures'';
|
||||||
for = "0s";
|
for = "0s";
|
||||||
summary = "{{ $labels.hive }}/{{ $labels.agent }} had a claude turn fail; the reason is the `F_ERROR` field of the harness's `turn failed` log line";
|
summary = "{{ $labels.agent }} had a claude turn fail; the reason is the `F_ERROR` field of the harness's `turn failed` log line";
|
||||||
})
|
})
|
||||||
# Same cadence as the forge rule: one pass every 5m
|
# Same cadence as the forge rule: one pass every 5m
|
||||||
# (`RECONCILE_INTERVAL` in swarm-controller's
|
# (`RECONCILE_INTERVAL` in swarm-controller's
|
||||||
|
|
@ -1739,7 +1739,7 @@ in
|
||||||
# the old per-hive dashboard `agents_crashing` banner — see
|
# the old per-hive dashboard `agents_crashing` banner — see
|
||||||
# that function's module doc for why the banner went away
|
# that function's module doc for why the banner went away
|
||||||
# in favour of this. Host journal records carry the
|
# in favour of this. Host journal records carry the
|
||||||
# tracing fields as `F_<NAME>` and no `hive` attribute,
|
# tracing fields as `F_<NAME>` and no `sender` attribute,
|
||||||
# so the machine is `_HOSTNAME`. The unit
|
# so the machine is `_HOSTNAME`. The unit
|
||||||
# filter keeps out an agent's own log line if one ever
|
# filter keeps out an agent's own log line if one ever
|
||||||
# quotes the same message.
|
# quotes the same message.
|
||||||
|
|
@ -1759,10 +1759,10 @@ in
|
||||||
(metricThresholdRule {
|
(metricThresholdRule {
|
||||||
uid = "hh-hive-degraded";
|
uid = "hh-hive-degraded";
|
||||||
title = "hive degraded";
|
title = "hive degraded";
|
||||||
expr = ''max by (hive) ({__name__="hyperhive.hive.degraded"})'';
|
expr = ''max by (sender) ({__name__="hyperhive.hive.degraded"})'';
|
||||||
threshold = 0;
|
threshold = 0;
|
||||||
for = "2m";
|
for = "2m";
|
||||||
summary = "hive {{ $labels.hive }} reports itself degraded: a critical warning is raised; the `hh-hive-warning` alert names it";
|
summary = "{{ $labels.sender }} reports itself degraded: a critical warning is raised; the `hh-hive-warning` alert names it";
|
||||||
})
|
})
|
||||||
# One series per raised warning (`hyperhive.hive.warning`),
|
# One series per raised warning (`hyperhive.hive.warning`),
|
||||||
# so each `kind` is its own alert instance. The text is the
|
# so each `kind` is its own alert instance. The text is the
|
||||||
|
|
@ -1777,37 +1777,37 @@ in
|
||||||
(metricThresholdRule {
|
(metricThresholdRule {
|
||||||
uid = "hh-hive-warning";
|
uid = "hh-hive-warning";
|
||||||
title = "hive warning raised";
|
title = "hive warning raised";
|
||||||
expr = ''max by (hive, kind, level) ({__name__="hyperhive.hive.warning", kind!~"disk_pressure|pending_logins"} or ({__name__="hyperhive.hive.warning", kind="pending_logins"} unless on (hive) group by (hive) ({__name__="hyperhive.agent.needs_login"})))'';
|
expr = ''max by (sender, kind, level) ({__name__="hyperhive.hive.warning", kind!~"disk_pressure|pending_logins"} or ({__name__="hyperhive.hive.warning", kind="pending_logins"} unless on (sender) group by (sender) ({__name__="hyperhive.agent.needs_login"})))'';
|
||||||
threshold = 0;
|
threshold = 0;
|
||||||
for = "2m";
|
for = "2m";
|
||||||
summary = "hive {{ $labels.hive }} has a {{ $labels.level }} warning raised: {{ $labels.kind }}; the message is the `hive warning raised` line in the hive-c0re log";
|
summary = "{{ $labels.sender }} has a {{ $labels.level }} warning raised: {{ $labels.kind }}; the message is the `hive warning raised` line in the hive-c0re log";
|
||||||
})
|
})
|
||||||
# `hyperhive.agent.needs_login` is `1` for a running agent
|
# `hyperhive.agent.needs_login` is `1` for a running agent
|
||||||
# without a usable claude login; stopped agents report
|
# without a usable claude login; stopped agents report
|
||||||
# nothing. One alert instance per `(hive, agent)`; `for`
|
# nothing. One alert instance per `agent`; `for`
|
||||||
# lets a login in progress finish first.
|
# lets a login in progress finish first.
|
||||||
(metricThresholdRule {
|
(metricThresholdRule {
|
||||||
uid = "hh-agent-needs-login";
|
uid = "hh-agent-needs-login";
|
||||||
title = "agent needs a claude login";
|
title = "agent needs a claude login";
|
||||||
expr = ''max by (hive, agent) ({__name__="hyperhive.agent.needs_login"}) == 1'';
|
expr = ''max by (agent) ({__name__="hyperhive.agent.needs_login"}) == 1'';
|
||||||
threshold = 0;
|
threshold = 0;
|
||||||
for = "5m";
|
for = "5m";
|
||||||
summary = "agent {{ $labels.agent }} on hive {{ $labels.hive }} has needed a claude login for 5 minutes; open its page in the dashboard to complete it";
|
summary = "agent {{ $labels.agent }} has needed a claude login for 5 minutes; open its page in the dashboard to complete it";
|
||||||
})
|
})
|
||||||
# Processes the kernel OOM-killed in an agent's container, from
|
# Processes the kernel OOM-killed in an agent's container, from
|
||||||
# the counter hive-c0re exports (`otel_metrics.rs`). A budgeted
|
# the counter hive-c0re exports (`otel_metrics.rs`). A budgeted
|
||||||
# agent has no swap, so each kill is a subagent run, bash task or
|
# agent has no swap, so each kill is a subagent run, bash task or
|
||||||
# the agent's claude that hit its RAM budget. More than three in
|
# the agent's claude that hit its RAM budget. More than three in
|
||||||
# an hour is a budget that is too small for the work, not a
|
# an hour is a budget that is too small for the work, not a
|
||||||
# one-off peak. One alert instance per `(hive, agent)`.
|
# one-off peak. One alert instance per `agent`.
|
||||||
(metricThresholdRule {
|
(metricThresholdRule {
|
||||||
uid = "hh-agent-oom-kills";
|
uid = "hh-agent-oom-kills";
|
||||||
title = "agent OOM-killed repeatedly";
|
title = "agent OOM-killed repeatedly";
|
||||||
windowSeconds = 3600;
|
windowSeconds = 3600;
|
||||||
expr = ''sum by (hive, agent) (increase({__name__="hyperhive.container.memory.oom_kills", agent!=""}[1h]))'';
|
expr = ''sum by (agent) (increase({__name__="hyperhive.container.memory.oom_kills", agent!=""}[1h]))'';
|
||||||
threshold = 3;
|
threshold = 3;
|
||||||
for = "0m";
|
for = "0m";
|
||||||
summary = "agent {{ $labels.agent }} on hive {{ $labels.hive }} had more than 3 processes OOM-killed in the last hour: it keeps hitting its RAM budget; see \"OOM kills by agent\" on the agents dashboard, and raise its memory cap if the work needs it";
|
summary = "agent {{ $labels.agent }} had more than 3 processes OOM-killed in the last hour: it keeps hitting its RAM budget; see \"OOM kills by agent\" on the agents dashboard, and raise its memory cap if the work needs it";
|
||||||
})
|
})
|
||||||
# `hyperhive.hive.nix_store.utilization` is the used fraction of the
|
# `hyperhive.hive.nix_store.utilization` is the used fraction of the
|
||||||
# filesystem holding the nix store, the one that failed CI
|
# filesystem holding the nix store, the one that failed CI
|
||||||
|
|
@ -1815,18 +1815,18 @@ in
|
||||||
(metricThresholdRule {
|
(metricThresholdRule {
|
||||||
uid = "hh-host-disk-high";
|
uid = "hh-host-disk-high";
|
||||||
title = "host disk filling";
|
title = "host disk filling";
|
||||||
expr = ''max by (hive) ({__name__="hyperhive.hive.nix_store.utilization"})'';
|
expr = ''max by (sender) ({__name__="hyperhive.hive.nix_store.utilization"})'';
|
||||||
threshold = 0.85;
|
threshold = 0.85;
|
||||||
for = "10m";
|
for = "10m";
|
||||||
summary = "the nix store's filesystem on hive {{ $labels.hive }} is over 85% full; garbage-collect before it runs out of space";
|
summary = "the nix store's filesystem of {{ $labels.sender }} is over 85% full; garbage-collect before it runs out of space";
|
||||||
})
|
})
|
||||||
(metricThresholdRule {
|
(metricThresholdRule {
|
||||||
uid = "hh-host-disk-critical";
|
uid = "hh-host-disk-critical";
|
||||||
title = "host disk almost full";
|
title = "host disk almost full";
|
||||||
expr = ''max by (hive) ({__name__="hyperhive.hive.nix_store.utilization"})'';
|
expr = ''max by (sender) ({__name__="hyperhive.hive.nix_store.utilization"})'';
|
||||||
threshold = 0.95;
|
threshold = 0.95;
|
||||||
for = "2m";
|
for = "2m";
|
||||||
summary = "the nix store's filesystem on hive {{ $labels.hive }} is over 95% full; garbage-collect now";
|
summary = "the nix store's filesystem of {{ $labels.sender }} is over 95% full; garbage-collect now";
|
||||||
})
|
})
|
||||||
# The fraction of a store client certificate's validity
|
# The fraction of a store client certificate's validity
|
||||||
# already used, from the `bao.client_cert.*` gauges the
|
# already used, from the `bao.client_cert.*` gauges the
|
||||||
|
|
@ -1836,7 +1836,7 @@ in
|
||||||
# `last_over_time` rides out the five-minute cadence of
|
# `last_over_time` rides out the five-minute cadence of
|
||||||
# the one-shot reporter (`swarm-ci-metrics`). Agent leaves
|
# the one-shot reporter (`swarm-ci-metrics`). Agent leaves
|
||||||
# renew at half their life, so a fraction over 0.8 means
|
# renew at half their life, so a fraction over 0.8 means
|
||||||
# the renewal has been stuck for days. `hive` and `agent`
|
# the renewal has been stuck for days. `sender` and `agent`
|
||||||
# stay in the grouping so the alert names the holder.
|
# stay in the grouping so the alert names the holder.
|
||||||
# Agents whose deploy the build gate holds back, from the gauge
|
# Agents whose deploy the build gate holds back, from the gauge
|
||||||
# swarm-controller exports (`held_deploys.rs`): a build that
|
# swarm-controller exports (`held_deploys.rs`): a build that
|
||||||
|
|
@ -1855,10 +1855,10 @@ in
|
||||||
(metricThresholdRule {
|
(metricThresholdRule {
|
||||||
uid = "hh-bao-client-cert-lifetime";
|
uid = "hh-bao-client-cert-lifetime";
|
||||||
title = "bao client certificate past 80% of its lifetime";
|
title = "bao client certificate past 80% of its lifetime";
|
||||||
expr = ''max by ("service.name", cert, hive, agent) ((time() - last_over_time({__name__="bao.client_cert.not_before"}[15m])) / (last_over_time({__name__="bao.client_cert.not_after"}[15m]) - last_over_time({__name__="bao.client_cert.not_before"}[15m])))'';
|
expr = ''max by ("service.name", cert, sender, agent) ((time() - last_over_time({__name__="bao.client_cert.not_before"}[15m])) / (last_over_time({__name__="bao.client_cert.not_after"}[15m]) - last_over_time({__name__="bao.client_cert.not_before"}[15m])))'';
|
||||||
threshold = 0.8;
|
threshold = 0.8;
|
||||||
for = "10m";
|
for = "10m";
|
||||||
summary = "the store client certificate {{ $labels.cert }} (hive {{ $labels.hive }}, agent {{ $labels.agent }}) is past 80% of its validity";
|
summary = "the store client certificate {{ $labels.cert }} (sender {{ $labels.sender }}, agent {{ $labels.agent }}) is past 80% of its validity";
|
||||||
})
|
})
|
||||||
# Usage share ahead of the clock share, per claude account and
|
# Usage share ahead of the clock share, per claude account and
|
||||||
# window: percent used minus the percent of the window already
|
# window: percent used minus the percent of the window already
|
||||||
|
|
@ -1884,17 +1884,18 @@ in
|
||||||
summary = "claude account {{ $labels.account }} has used more of its {{ $labels.window }} usage window than the window has elapsed";
|
summary = "claude account {{ $labels.account }} has used more of its {{ $labels.window }} usage window than the window has elapsed";
|
||||||
})
|
})
|
||||||
]
|
]
|
||||||
# One rule per declared hive rather than one grouped by
|
# One rule per declared hive's collector rather than one grouped by
|
||||||
# `hive`, so a hive that sends nothing at all still has
|
# `sender`, so a collector that sends nothing at all still has an
|
||||||
# an instance to fire. `hive` is stamped by the swarm
|
# instance to fire. The swarm collector stamps `sender` with the
|
||||||
# collector from the same `swarm.hives` key.
|
# client id the hive's collector authenticated as, the same
|
||||||
|
# `hiveClientPrefix` name the OIDC client is registered under.
|
||||||
++ lib.mapAttrsToList (
|
++ lib.mapAttrsToList (
|
||||||
name: _:
|
name: _:
|
||||||
logAbsenceRule {
|
logAbsenceRule {
|
||||||
uid = "hh-logs-absent-${name}";
|
uid = "hh-logs-absent-${name}";
|
||||||
title = "no log records from ${name}";
|
title = "no log records from ${name}";
|
||||||
windowSeconds = 600;
|
windowSeconds = 600;
|
||||||
expr = ''_time:10m hive:="${name}" | stats count() as records'';
|
expr = ''_time:10m sender:="${hyperhiveCfg.swarm.authelia.hiveClientPrefix}${name}" | stats count() as records'';
|
||||||
for = "5m";
|
for = "5m";
|
||||||
summary = "hive ${name} has sent no log records to VictoriaLogs for at least 10m";
|
summary = "hive ${name} has sent no log records to VictoriaLogs for at least 10m";
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue