Watch
0
0
Fork
You've already forked hyperhive
0

agents board: a turns tab, and turn duration bounds past 10 s

The per-agent /stats page shows what the swarm agents board lacked about
turns. The new tab reads the turn count and duration the harness already
records: average duration, cache hit rate, tokens per turn, turns per hour
by agent and by model, duration percentiles, and the wake source and result
mixes. The duration histogram used the SDK default buckets, which stop at
10 s while a turn averages 24 s, so every p95 read a flat 10 s; it now has
explicit bounds up to an hour.
This commit is contained in:
iris 2026-11-03 00:16:47 +01:00
commit aecde1dc75

View file

@ -502,6 +502,40 @@ let
]
&& (lib.head xf).spec.options.byField == "agent";
}
{
# The agents board's turns tab reads the turn count and duration the harness
# records, grouped by the labels it sets on them. A renamed instrument or
# label there is a tab of empty panels, so each must still be spelled in the
# harness; and the duration percentiles are only right while the histogram
# has bounds past the SDK's 10 s default ceiling.
name = "the agents dashboard's turns tab reads the turn metrics and labels the harness records";
ok =
let
board = builtins.fromJSON (builtins.readFile ../host-modules/swarm-grafana/dashboards/agents.json);
tab = lib.findFirst (t: t.spec.title == "turns") null board.spec.layout.spec.tabs;
names = map (i: i.spec.element.name) tab.spec.layout.spec.items;
exprs = lib.concatMap (
n: map (q: q.spec.query.spec.expr) board.spec.elements.${n}.spec.data.spec.queries
) names;
recorded = builtins.readFile ../../hive-agent/src/otel_turn_metrics.rs;
in
tab != null
&& lib.length names == 9
&& lib.all (m: lib.hasInfix "\"${m}\"" recorded) [
"hyperhive.agent.turn.count"
"hyperhive.agent.turn.duration"
"wake_from"
"result_kind"
"model"
]
&& lib.all (l: lib.any (e: lib.hasInfix l e) exprs) [
"wake_from"
"result_kind"
"by (model)"
"turn.duration_bucket"
]
&& lib.hasInfix "with_boundaries(TURN_DURATION_BOUNDS_MS" recorded;
}
{
# The builds board reads the fields hive-c0re puts on every container-build
# log line: the build id, agent and kind on each, the event on the start and