diff --git a/docs/swarm/services.md b/docs/swarm/services.md index 000fca4e8..750c6ffe5 100644 --- a/docs/swarm/services.md +++ b/docs/swarm/services.md @@ -203,7 +203,7 @@ kept. - `agents`: per-agent resource usage and Claude Code activity. - `authelia`, `bao`, `queue`: the identity provider, the secret store and the NATS queue. - `claude-usage`: Claude use by model, effort, token type and source. Filter by hive, service (agents or the review classifier) and agent. The service filter separates the classifier's API-key spend from the agents. -- `egress`: what agents send through the egress proxy, in three tabs. **overview** has the totals (requests, agents active, refused, credential challenges, data transferred), requests over time by status, and the busiest agents and destinations. **refused** lists the hosts the proxy refused for each agent. **would-deny** lists what agents in `log` mode reached that restricted mode would refuse. Filter by agent. +- `egress`: what agents send through the egress proxy, in three tabs. **overview** has the totals (requests, agents active, refused, credential challenges, data transferred), requests over time by status, and the busiest agents and destinations. **refused** lists the hosts the proxy refused for each agent. **would-deny** lists what agents in `log` mode reached that restricted mode would refuse. The host lists are tables, one row per host (and agent), with a count column you can sort. Filter by agent. - `controller`: the swarm controller's job graph by state, and the push and commit rates it sees on the forge. - `review-classifier`: review requests by outcome, the verdict mix, results per check, retried asks, and run duration p50 and p95. - `forge`: what the forge holds, and the forge process's CPU, memory and descriptors. diff --git a/nix/host-modules/swarm-grafana/dashboards/egress.json b/nix/host-modules/swarm-grafana/dashboards/egress.json index b4a95281f..c5447d8cf 100644 --- a/nix/host-modules/swarm-grafana/dashboards/egress.json +++ b/nix/host-modules/swarm-grafana/dashboards/egress.json @@ -797,6 +797,16 @@ } ], "transformations": [ + { + "kind": "joinByLabels", + "spec": { + "id": "joinByLabels", + "options": { + "join": ["dest"], + "value": "__name__" + } + } + }, { "kind": "organize", "spec": { @@ -1023,6 +1033,16 @@ } ], "transformations": [ + { + "kind": "joinByLabels", + "spec": { + "id": "joinByLabels", + "options": { + "join": ["agent", "dest"], + "value": "__name__" + } + } + }, { "kind": "organize", "spec": { @@ -1378,6 +1398,16 @@ } ], "transformations": [ + { + "kind": "joinByLabels", + "spec": { + "id": "joinByLabels", + "options": { + "join": ["agent", "dest", "port"], + "value": "__name__" + } + } + }, { "kind": "organize", "spec": { diff --git a/nix/module-eval/grafana.nix b/nix/module-eval/grafana.nix index 7f766cf4d..b4f95f9f4 100644 --- a/nix/module-eval/grafana.nix +++ b/nix/module-eval/grafana.nix @@ -496,6 +496,21 @@ let && lib.all (e: lib.hasInfix "\"TCP_\"*" e) ( lib.filter (e: lib.hasInfix access e) (exprs ++ [ agentVar.spec.query.spec.query ]) ) + # A grouped stats query is one frame per group and stat, which a table panel + # shows as a dropdown of series; joining by the group labels, with the stat's + # name as the column, makes one row per group. + && lib.all ( + e: + let + xf = e.spec.data.spec.transformations; + in + map (t: t.spec.id) xf == [ + "joinByLabels" + "organize" + ] + && (lib.head xf).spec.options.value == "__name__" + && (lib.head xf).spec.options.join != [ ] + ) (lib.filter (e: e.spec.vizConfig.group == "table") (lib.attrValues board.spec.elements)) && lib.hasInfix "logformat would_deny would_deny user=%[un method=%rm host=%>rd port=%>rP result=" squid && lib.hasInfix "access_log syslog:daemon.info squid !manager" squid; }