From 3a58bf59bad3941129231fc338b88c4f1fc16c7c Mon Sep 17 00:00:00 2001 From: iris Date: Sun, 20 Sep 2026 23:35:15 +0200 Subject: [PATCH] swarm-grafana: drop overview tab, fold panels into activity/cost Reworked per review feedback: no new tab, and 3 of the added stat panels duplicated existing ones (Active agents ~ panel-1 Agents reporting, Cost = panel-2 Cost verbatim, Tokens ~ panel-3 + the new input/output/cache-read breakdown). Removed panel-50/52/56 and the overview tab entirely. What's left is genuinely new (no prior panel covered it): a Turns KPI and turns-by-agent bargauge in the activity tab (hyperhive.agent.turn.count was emitted but unused anywhere), and input/output/cache-read token KPIs plus cost/input/output/cache-read-by-agent bargauges in the cost tab (the existing cost/token panels have no per-agent breakdown, and none sort busiest-first). --- .../swarm-grafana/dashboards/agents.json | 487 +++++------------- 1 file changed, 117 insertions(+), 370 deletions(-) diff --git a/nix/host-modules/swarm-grafana/dashboards/agents.json b/nix/host-modules/swarm-grafana/dashboards/agents.json index 760b40ab..39f0ba95 100644 --- a/nix/host-modules/swarm-grafana/dashboards/agents.json +++ b/nix/host-modules/swarm-grafana/dashboards/agents.json @@ -1479,73 +1479,6 @@ } } }, - "panel-50": { - "kind": "Panel", - "spec": { - "id": 50, - "title": "Active agents", - "description": "Distinct agents with Claude Code activity in the selected range.", - "links": [], - "data": { - "kind": "QueryGroup", - "spec": { - "queries": [ - { - "kind": "PanelQuery", - "spec": { - "query": { - "kind": "DataQuery", - "group": "prometheus", - "version": "v0", - "datasource": { - "name": "@datasourceUid@" - }, - "spec": { - "expr": "count(count by (agent) ({__name__=\"claude_code.session.count\", hive=~\"$hive\", agent=~\"$agent\"}))", - "instant": true, - "legendFormat": "agents" - } - }, - "refId": "A", - "hidden": false - } - } - ], - "transformations": [], - "queryOptions": {} - } - }, - "vizConfig": { - "kind": "VizConfig", - "group": "stat", - "version": "", - "spec": { - "options": { - "colorMode": "value", - "graphMode": "none", - "justifyMode": "auto", - "reduceOptions": { - "calcs": ["lastNotNull"], - "fields": "", - "values": false - }, - "textMode": "value" - }, - "fieldConfig": { - "defaults": { - "unit": "short", - "decimals": 0, - "color": { - "mode": "fixed", - "fixedColor": "text" - } - }, - "overrides": [] - } - } - } - } - }, "panel-51": { "kind": "Panel", "spec": { @@ -1613,73 +1546,6 @@ } } }, - "panel-52": { - "kind": "Panel", - "spec": { - "id": 52, - "title": "Tokens", - "description": "Total tokens (all types) in the selected range.", - "links": [], - "data": { - "kind": "QueryGroup", - "spec": { - "queries": [ - { - "kind": "PanelQuery", - "spec": { - "query": { - "kind": "DataQuery", - "group": "prometheus", - "version": "v0", - "datasource": { - "name": "@datasourceUid@" - }, - "spec": { - "expr": "sum(increase({__name__=\"claude_code.token.usage\", hive=~\"$hive\", agent=~\"$agent\"}[$__range]))", - "instant": true, - "legendFormat": "tokens" - } - }, - "refId": "A", - "hidden": false - } - } - ], - "transformations": [], - "queryOptions": {} - } - }, - "vizConfig": { - "kind": "VizConfig", - "group": "stat", - "version": "", - "spec": { - "options": { - "colorMode": "value", - "graphMode": "none", - "justifyMode": "auto", - "reduceOptions": { - "calcs": ["lastNotNull"], - "fields": "", - "values": false - }, - "textMode": "value" - }, - "fieldConfig": { - "defaults": { - "unit": "short", - "decimals": 1, - "color": { - "mode": "fixed", - "fixedColor": "text" - } - }, - "overrides": [] - } - } - } - } - }, "panel-53": { "kind": "Panel", "spec": { @@ -1881,73 +1747,6 @@ } } }, - "panel-56": { - "kind": "Panel", - "spec": { - "id": 56, - "title": "Cost", - "description": "Total USD spent in the selected range.", - "links": [], - "data": { - "kind": "QueryGroup", - "spec": { - "queries": [ - { - "kind": "PanelQuery", - "spec": { - "query": { - "kind": "DataQuery", - "group": "prometheus", - "version": "v0", - "datasource": { - "name": "@datasourceUid@" - }, - "spec": { - "expr": "sum(increase({__name__=\"claude_code.cost.usage\", hive=~\"$hive\", agent=~\"$agent\"}[$__range]))", - "instant": true, - "legendFormat": "cost" - } - }, - "refId": "A", - "hidden": false - } - } - ], - "transformations": [], - "queryOptions": {} - } - }, - "vizConfig": { - "kind": "VizConfig", - "group": "stat", - "version": "", - "spec": { - "options": { - "colorMode": "value", - "graphMode": "none", - "justifyMode": "auto", - "reduceOptions": { - "calcs": ["lastNotNull"], - "fields": "", - "values": false - }, - "textMode": "value" - }, - "fieldConfig": { - "defaults": { - "unit": "currencyUSD", - "decimals": 2, - "color": { - "mode": "fixed", - "fixedColor": "text" - } - }, - "overrides": [] - } - } - } - } - }, "panel-60": { "kind": "Panel", "spec": { @@ -2333,175 +2132,6 @@ "kind": "TabsLayout", "spec": { "tabs": [ - { - "kind": "TabsLayoutTab", - "spec": { - "title": "overview", - "layout": { - "kind": "GridLayout", - "spec": { - "items": [ - { - "kind": "GridLayoutItem", - "spec": { - "x": 0, - "y": 0, - "width": 3, - "height": 4, - "element": { - "kind": "ElementReference", - "name": "panel-50" - } - } - }, - { - "kind": "GridLayoutItem", - "spec": { - "x": 3, - "y": 0, - "width": 3, - "height": 4, - "element": { - "kind": "ElementReference", - "name": "panel-51" - } - } - }, - { - "kind": "GridLayoutItem", - "spec": { - "x": 6, - "y": 0, - "width": 4, - "height": 4, - "element": { - "kind": "ElementReference", - "name": "panel-52" - } - } - }, - { - "kind": "GridLayoutItem", - "spec": { - "x": 10, - "y": 0, - "width": 4, - "height": 4, - "element": { - "kind": "ElementReference", - "name": "panel-53" - } - } - }, - { - "kind": "GridLayoutItem", - "spec": { - "x": 14, - "y": 0, - "width": 3, - "height": 4, - "element": { - "kind": "ElementReference", - "name": "panel-54" - } - } - }, - { - "kind": "GridLayoutItem", - "spec": { - "x": 17, - "y": 0, - "width": 3, - "height": 4, - "element": { - "kind": "ElementReference", - "name": "panel-55" - } - } - }, - { - "kind": "GridLayoutItem", - "spec": { - "x": 20, - "y": 0, - "width": 4, - "height": 4, - "element": { - "kind": "ElementReference", - "name": "panel-56" - } - } - }, - { - "kind": "GridLayoutItem", - "spec": { - "x": 0, - "y": 4, - "width": 12, - "height": 8, - "element": { - "kind": "ElementReference", - "name": "panel-60" - } - } - }, - { - "kind": "GridLayoutItem", - "spec": { - "x": 12, - "y": 4, - "width": 12, - "height": 8, - "element": { - "kind": "ElementReference", - "name": "panel-61" - } - } - }, - { - "kind": "GridLayoutItem", - "spec": { - "x": 0, - "y": 12, - "width": 8, - "height": 8, - "element": { - "kind": "ElementReference", - "name": "panel-62" - } - } - }, - { - "kind": "GridLayoutItem", - "spec": { - "x": 8, - "y": 12, - "width": 8, - "height": 8, - "element": { - "kind": "ElementReference", - "name": "panel-63" - } - } - }, - { - "kind": "GridLayoutItem", - "spec": { - "x": 16, - "y": 12, - "width": 8, - "height": 8, - "element": { - "kind": "ElementReference", - "name": "panel-64" - } - } - } - ] - } - } - } - }, { "kind": "TabsLayoutTab", "spec": { @@ -2561,6 +2191,32 @@ "name": "panel-32" } } + }, + { + "kind": "GridLayoutItem", + "spec": { + "x": 0, + "y": 11, + "width": 24, + "height": 4, + "element": { + "kind": "ElementReference", + "name": "panel-51" + } + } + }, + { + "kind": "GridLayoutItem", + "spec": { + "x": 0, + "y": 15, + "width": 24, + "height": 8, + "element": { + "kind": "ElementReference", + "name": "panel-60" + } + } } ] } @@ -2626,6 +2282,97 @@ "name": "panel-21" } } + }, + { + "kind": "GridLayoutItem", + "spec": { + "x": 0, + "y": 12, + "width": 8, + "height": 4, + "element": { + "kind": "ElementReference", + "name": "panel-53" + } + } + }, + { + "kind": "GridLayoutItem", + "spec": { + "x": 8, + "y": 12, + "width": 8, + "height": 4, + "element": { + "kind": "ElementReference", + "name": "panel-54" + } + } + }, + { + "kind": "GridLayoutItem", + "spec": { + "x": 16, + "y": 12, + "width": 8, + "height": 4, + "element": { + "kind": "ElementReference", + "name": "panel-55" + } + } + }, + { + "kind": "GridLayoutItem", + "spec": { + "x": 0, + "y": 16, + "width": 12, + "height": 7, + "element": { + "kind": "ElementReference", + "name": "panel-61" + } + } + }, + { + "kind": "GridLayoutItem", + "spec": { + "x": 12, + "y": 16, + "width": 12, + "height": 7, + "element": { + "kind": "ElementReference", + "name": "panel-62" + } + } + }, + { + "kind": "GridLayoutItem", + "spec": { + "x": 0, + "y": 23, + "width": 12, + "height": 7, + "element": { + "kind": "ElementReference", + "name": "panel-63" + } + } + }, + { + "kind": "GridLayoutItem", + "spec": { + "x": 12, + "y": 23, + "width": 12, + "height": 7, + "element": { + "kind": "ElementReference", + "name": "panel-64" + } + } } ] }