swarm-grafana: replace busiest-agents bargauges with an actual table
mara: 'i asked for a table. ask when doing something different.' Right call — the PR body flagged the bargauge substitution as an open question, not a decision, and I should have waited for an answer instead of treating the silent absence of an objection as one. Single 'Busiest agents' table panel (replaces the 5 per-metric bargauges): 5 table-format instant queries (turns, input, output, cache-read, cost) joined on the agent label (joinByField), renamed to the screenshot's own column names via organize, sorted by turns descending via sortBy — same column set and sort order as the attached /stats screenshot. This is a genuinely novel schema shape for this repo: no table panel, transformation, or field-override config exists anywhere else in nix/host-modules/swarm-grafana/dashboards/*.json to verify the join/ organize/sortBy option shapes against. Structurally verified (valid JSON, jq empty, unique panel ids, every panel referenced exactly once, nix fmt clean, dashboard-description lint clean) but the join/rename field-name mechanics (whether Grafana names the joined columns exactly 'Value #A'/'Value #B'/etc.) are built from general Grafana schema knowledge, not a working local precedent — flagging that explicitly so the actual render gets checked before merge.
This commit is contained in:
parent
3a58bf59ba
commit
c9ba906284
1 changed files with 111 additions and 314 deletions
|
|
@ -1751,8 +1751,8 @@
|
||||||
"kind": "Panel",
|
"kind": "Panel",
|
||||||
"spec": {
|
"spec": {
|
||||||
"id": 60,
|
"id": 60,
|
||||||
"title": "Turns by agent",
|
"title": "Busiest agents",
|
||||||
"description": "Agent turns in the selected range, busiest first.",
|
"description": "Per-agent turns, tokens and cost in the selected range, busiest first.",
|
||||||
"links": [],
|
"links": [],
|
||||||
"data": {
|
"data": {
|
||||||
"kind": "QueryGroup",
|
"kind": "QueryGroup",
|
||||||
|
|
@ -1769,359 +1769,208 @@
|
||||||
"name": "@datasourceUid@"
|
"name": "@datasourceUid@"
|
||||||
},
|
},
|
||||||
"spec": {
|
"spec": {
|
||||||
"expr": "sort_desc(sum by (agent) (increase({__name__=\"hyperhive.agent.turn.count\", hive=~\"$hive\", agent=~\"$agent\"}[$__range])))",
|
"expr": "sum by (agent) (increase({__name__=\"hyperhive.agent.turn.count\", hive=~\"$hive\", agent=~\"$agent\"}[$__range]))",
|
||||||
"instant": true,
|
"instant": true,
|
||||||
"legendFormat": "{{agent}}"
|
"format": "table",
|
||||||
|
"legendFormat": "__auto"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"refId": "A",
|
"refId": "A",
|
||||||
"hidden": false
|
"hidden": false
|
||||||
}
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"kind": "PanelQuery",
|
||||||
|
"spec": {
|
||||||
|
"query": {
|
||||||
|
"kind": "DataQuery",
|
||||||
|
"group": "prometheus",
|
||||||
|
"version": "v0",
|
||||||
|
"datasource": {
|
||||||
|
"name": "@datasourceUid@"
|
||||||
|
},
|
||||||
|
"spec": {
|
||||||
|
"expr": "sum by (agent) (increase({__name__=\"claude_code.token.usage\", hive=~\"$hive\", agent=~\"$agent\", type=\"input\"}[$__range]))",
|
||||||
|
"instant": true,
|
||||||
|
"format": "table",
|
||||||
|
"legendFormat": "__auto"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"refId": "B",
|
||||||
|
"hidden": false
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"kind": "PanelQuery",
|
||||||
|
"spec": {
|
||||||
|
"query": {
|
||||||
|
"kind": "DataQuery",
|
||||||
|
"group": "prometheus",
|
||||||
|
"version": "v0",
|
||||||
|
"datasource": {
|
||||||
|
"name": "@datasourceUid@"
|
||||||
|
},
|
||||||
|
"spec": {
|
||||||
|
"expr": "sum by (agent) (increase({__name__=\"claude_code.token.usage\", hive=~\"$hive\", agent=~\"$agent\", type=\"output\"}[$__range]))",
|
||||||
|
"instant": true,
|
||||||
|
"format": "table",
|
||||||
|
"legendFormat": "__auto"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"refId": "C",
|
||||||
|
"hidden": false
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"kind": "PanelQuery",
|
||||||
|
"spec": {
|
||||||
|
"query": {
|
||||||
|
"kind": "DataQuery",
|
||||||
|
"group": "prometheus",
|
||||||
|
"version": "v0",
|
||||||
|
"datasource": {
|
||||||
|
"name": "@datasourceUid@"
|
||||||
|
},
|
||||||
|
"spec": {
|
||||||
|
"expr": "sum by (agent) (increase({__name__=\"claude_code.token.usage\", hive=~\"$hive\", agent=~\"$agent\", type=\"cacheRead\"}[$__range]))",
|
||||||
|
"instant": true,
|
||||||
|
"format": "table",
|
||||||
|
"legendFormat": "__auto"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"refId": "D",
|
||||||
|
"hidden": false
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"kind": "PanelQuery",
|
||||||
|
"spec": {
|
||||||
|
"query": {
|
||||||
|
"kind": "DataQuery",
|
||||||
|
"group": "prometheus",
|
||||||
|
"version": "v0",
|
||||||
|
"datasource": {
|
||||||
|
"name": "@datasourceUid@"
|
||||||
|
},
|
||||||
|
"spec": {
|
||||||
|
"expr": "sum by (agent) (increase({__name__=\"claude_code.cost.usage\", hive=~\"$hive\", agent=~\"$agent\"}[$__range]))",
|
||||||
|
"instant": true,
|
||||||
|
"format": "table",
|
||||||
|
"legendFormat": "__auto"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"refId": "E",
|
||||||
|
"hidden": false
|
||||||
|
}
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
"transformations": [],
|
"transformations": [
|
||||||
"queryOptions": {}
|
{
|
||||||
}
|
"id": "joinByField",
|
||||||
},
|
"options": {
|
||||||
"vizConfig": {
|
"byField": "agent",
|
||||||
"kind": "VizConfig",
|
"mode": "outer"
|
||||||
"group": "bargauge",
|
}
|
||||||
"version": "",
|
|
||||||
"spec": {
|
|
||||||
"options": {
|
|
||||||
"displayMode": "basic",
|
|
||||||
"orientation": "horizontal",
|
|
||||||
"reduceOptions": {
|
|
||||||
"calcs": ["lastNotNull"],
|
|
||||||
"fields": "",
|
|
||||||
"values": false
|
|
||||||
},
|
},
|
||||||
"showUnfilled": true,
|
{
|
||||||
"valueMode": "text"
|
"id": "organize",
|
||||||
},
|
"options": {
|
||||||
"fieldConfig": {
|
"excludeByName": {
|
||||||
"defaults": {
|
"Time": true
|
||||||
"unit": "short",
|
},
|
||||||
"decimals": 0,
|
"indexByName": {
|
||||||
"thresholds": {
|
"agent": 0,
|
||||||
"mode": "absolute",
|
"Value #A": 1,
|
||||||
"steps": [
|
"Value #B": 2,
|
||||||
|
"Value #C": 3,
|
||||||
|
"Value #D": 4,
|
||||||
|
"Value #E": 5
|
||||||
|
},
|
||||||
|
"renameByName": {
|
||||||
|
"Value #A": "turns",
|
||||||
|
"Value #B": "input",
|
||||||
|
"Value #C": "output",
|
||||||
|
"Value #D": "cache read",
|
||||||
|
"Value #E": "est cost"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"id": "sortBy",
|
||||||
|
"options": {
|
||||||
|
"fields": {},
|
||||||
|
"sort": [
|
||||||
{
|
{
|
||||||
"value": null,
|
"field": "turns",
|
||||||
"color": "blue"
|
"desc": true
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
},
|
|
||||||
"color": {
|
|
||||||
"mode": "fixed",
|
|
||||||
"fixedColor": "blue"
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"overrides": []
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"panel-61": {
|
|
||||||
"kind": "Panel",
|
|
||||||
"spec": {
|
|
||||||
"id": 61,
|
|
||||||
"title": "Cost by agent",
|
|
||||||
"description": "USD spent in the selected range, busiest first.",
|
|
||||||
"links": [],
|
|
||||||
"data": {
|
|
||||||
"kind": "QueryGroup",
|
|
||||||
"spec": {
|
|
||||||
"queries": [
|
|
||||||
{
|
|
||||||
"kind": "PanelQuery",
|
|
||||||
"spec": {
|
|
||||||
"query": {
|
|
||||||
"kind": "DataQuery",
|
|
||||||
"group": "prometheus",
|
|
||||||
"version": "v0",
|
|
||||||
"datasource": {
|
|
||||||
"name": "@datasourceUid@"
|
|
||||||
},
|
|
||||||
"spec": {
|
|
||||||
"expr": "sort_desc(sum by (agent) (increase({__name__=\"claude_code.cost.usage\", hive=~\"$hive\", agent=~\"$agent\"}[$__range])))",
|
|
||||||
"instant": true,
|
|
||||||
"legendFormat": "{{agent}}"
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"refId": "A",
|
|
||||||
"hidden": false
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
"transformations": [],
|
|
||||||
"queryOptions": {}
|
"queryOptions": {}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"vizConfig": {
|
"vizConfig": {
|
||||||
"kind": "VizConfig",
|
"kind": "VizConfig",
|
||||||
"group": "bargauge",
|
"group": "table",
|
||||||
"version": "",
|
"version": "",
|
||||||
"spec": {
|
"spec": {
|
||||||
"options": {
|
"options": {
|
||||||
"displayMode": "basic",
|
"showHeader": true,
|
||||||
"orientation": "horizontal",
|
"cellHeight": "sm",
|
||||||
"reduceOptions": {
|
"footer": {
|
||||||
"calcs": ["lastNotNull"],
|
"show": false,
|
||||||
"fields": "",
|
"reducer": ["sum"],
|
||||||
"values": false
|
"countRows": false
|
||||||
},
|
|
||||||
"showUnfilled": true,
|
|
||||||
"valueMode": "text"
|
|
||||||
},
|
|
||||||
"fieldConfig": {
|
|
||||||
"defaults": {
|
|
||||||
"unit": "currencyUSD",
|
|
||||||
"decimals": 2,
|
|
||||||
"thresholds": {
|
|
||||||
"mode": "absolute",
|
|
||||||
"steps": [
|
|
||||||
{
|
|
||||||
"value": null,
|
|
||||||
"color": "purple"
|
|
||||||
}
|
|
||||||
]
|
|
||||||
},
|
|
||||||
"color": {
|
|
||||||
"mode": "fixed",
|
|
||||||
"fixedColor": "purple"
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"overrides": []
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"panel-62": {
|
|
||||||
"kind": "Panel",
|
|
||||||
"spec": {
|
|
||||||
"id": 62,
|
|
||||||
"title": "Input tokens by agent",
|
|
||||||
"description": "Input tokens in the selected range, busiest first.",
|
|
||||||
"links": [],
|
|
||||||
"data": {
|
|
||||||
"kind": "QueryGroup",
|
|
||||||
"spec": {
|
|
||||||
"queries": [
|
|
||||||
{
|
|
||||||
"kind": "PanelQuery",
|
|
||||||
"spec": {
|
|
||||||
"query": {
|
|
||||||
"kind": "DataQuery",
|
|
||||||
"group": "prometheus",
|
|
||||||
"version": "v0",
|
|
||||||
"datasource": {
|
|
||||||
"name": "@datasourceUid@"
|
|
||||||
},
|
|
||||||
"spec": {
|
|
||||||
"expr": "sort_desc(sum by (agent) (increase({__name__=\"claude_code.token.usage\", hive=~\"$hive\", agent=~\"$agent\", type=\"input\"}[$__range])))",
|
|
||||||
"instant": true,
|
|
||||||
"legendFormat": "{{agent}}"
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"refId": "A",
|
|
||||||
"hidden": false
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
],
|
|
||||||
"transformations": [],
|
|
||||||
"queryOptions": {}
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"vizConfig": {
|
|
||||||
"kind": "VizConfig",
|
|
||||||
"group": "bargauge",
|
|
||||||
"version": "",
|
|
||||||
"spec": {
|
|
||||||
"options": {
|
|
||||||
"displayMode": "basic",
|
|
||||||
"orientation": "horizontal",
|
|
||||||
"reduceOptions": {
|
|
||||||
"calcs": ["lastNotNull"],
|
|
||||||
"fields": "",
|
|
||||||
"values": false
|
|
||||||
},
|
|
||||||
"showUnfilled": true,
|
|
||||||
"valueMode": "text"
|
|
||||||
},
|
},
|
||||||
"fieldConfig": {
|
"fieldConfig": {
|
||||||
"defaults": {
|
"defaults": {
|
||||||
"unit": "short",
|
"unit": "short",
|
||||||
"decimals": 1,
|
"decimals": 1,
|
||||||
"thresholds": {
|
"custom": {
|
||||||
"mode": "absolute",
|
"align": "auto",
|
||||||
"steps": [
|
"cellOptions": {
|
||||||
{
|
"type": "auto"
|
||||||
"value": null,
|
|
||||||
"color": "blue"
|
|
||||||
}
|
|
||||||
]
|
|
||||||
},
|
|
||||||
"color": {
|
|
||||||
"mode": "fixed",
|
|
||||||
"fixedColor": "blue"
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"overrides": []
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"panel-63": {
|
|
||||||
"kind": "Panel",
|
|
||||||
"spec": {
|
|
||||||
"id": 63,
|
|
||||||
"title": "Output tokens by agent",
|
|
||||||
"description": "Output tokens in the selected range, busiest first.",
|
|
||||||
"links": [],
|
|
||||||
"data": {
|
|
||||||
"kind": "QueryGroup",
|
|
||||||
"spec": {
|
|
||||||
"queries": [
|
|
||||||
{
|
|
||||||
"kind": "PanelQuery",
|
|
||||||
"spec": {
|
|
||||||
"query": {
|
|
||||||
"kind": "DataQuery",
|
|
||||||
"group": "prometheus",
|
|
||||||
"version": "v0",
|
|
||||||
"datasource": {
|
|
||||||
"name": "@datasourceUid@"
|
|
||||||
},
|
|
||||||
"spec": {
|
|
||||||
"expr": "sort_desc(sum by (agent) (increase({__name__=\"claude_code.token.usage\", hive=~\"$hive\", agent=~\"$agent\", type=\"output\"}[$__range])))",
|
|
||||||
"instant": true,
|
|
||||||
"legendFormat": "{{agent}}"
|
|
||||||
}
|
|
||||||
},
|
},
|
||||||
"refId": "A",
|
"inspect": false
|
||||||
"hidden": false
|
|
||||||
}
|
|
||||||
}
|
|
||||||
],
|
|
||||||
"transformations": [],
|
|
||||||
"queryOptions": {}
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"vizConfig": {
|
|
||||||
"kind": "VizConfig",
|
|
||||||
"group": "bargauge",
|
|
||||||
"version": "",
|
|
||||||
"spec": {
|
|
||||||
"options": {
|
|
||||||
"displayMode": "basic",
|
|
||||||
"orientation": "horizontal",
|
|
||||||
"reduceOptions": {
|
|
||||||
"calcs": ["lastNotNull"],
|
|
||||||
"fields": "",
|
|
||||||
"values": false
|
|
||||||
},
|
|
||||||
"showUnfilled": true,
|
|
||||||
"valueMode": "text"
|
|
||||||
},
|
|
||||||
"fieldConfig": {
|
|
||||||
"defaults": {
|
|
||||||
"unit": "short",
|
|
||||||
"decimals": 1,
|
|
||||||
"thresholds": {
|
|
||||||
"mode": "absolute",
|
|
||||||
"steps": [
|
|
||||||
{
|
|
||||||
"value": null,
|
|
||||||
"color": "blue"
|
|
||||||
}
|
|
||||||
]
|
|
||||||
},
|
|
||||||
"color": {
|
|
||||||
"mode": "fixed",
|
|
||||||
"fixedColor": "blue"
|
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"overrides": []
|
"overrides": [
|
||||||
}
|
{
|
||||||
}
|
"matcher": {
|
||||||
}
|
"id": "byName",
|
||||||
}
|
"options": "turns"
|
||||||
},
|
|
||||||
"panel-64": {
|
|
||||||
"kind": "Panel",
|
|
||||||
"spec": {
|
|
||||||
"id": 64,
|
|
||||||
"title": "Cache read tokens by agent",
|
|
||||||
"description": "Cache-read tokens in the selected range, busiest first.",
|
|
||||||
"links": [],
|
|
||||||
"data": {
|
|
||||||
"kind": "QueryGroup",
|
|
||||||
"spec": {
|
|
||||||
"queries": [
|
|
||||||
{
|
|
||||||
"kind": "PanelQuery",
|
|
||||||
"spec": {
|
|
||||||
"query": {
|
|
||||||
"kind": "DataQuery",
|
|
||||||
"group": "prometheus",
|
|
||||||
"version": "v0",
|
|
||||||
"datasource": {
|
|
||||||
"name": "@datasourceUid@"
|
|
||||||
},
|
|
||||||
"spec": {
|
|
||||||
"expr": "sort_desc(sum by (agent) (increase({__name__=\"claude_code.token.usage\", hive=~\"$hive\", agent=~\"$agent\", type=\"cacheRead\"}[$__range])))",
|
|
||||||
"instant": true,
|
|
||||||
"legendFormat": "{{agent}}"
|
|
||||||
}
|
|
||||||
},
|
},
|
||||||
"refId": "A",
|
"properties": [
|
||||||
"hidden": false
|
|
||||||
}
|
|
||||||
}
|
|
||||||
],
|
|
||||||
"transformations": [],
|
|
||||||
"queryOptions": {}
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"vizConfig": {
|
|
||||||
"kind": "VizConfig",
|
|
||||||
"group": "bargauge",
|
|
||||||
"version": "",
|
|
||||||
"spec": {
|
|
||||||
"options": {
|
|
||||||
"displayMode": "basic",
|
|
||||||
"orientation": "horizontal",
|
|
||||||
"reduceOptions": {
|
|
||||||
"calcs": ["lastNotNull"],
|
|
||||||
"fields": "",
|
|
||||||
"values": false
|
|
||||||
},
|
|
||||||
"showUnfilled": true,
|
|
||||||
"valueMode": "text"
|
|
||||||
},
|
|
||||||
"fieldConfig": {
|
|
||||||
"defaults": {
|
|
||||||
"unit": "short",
|
|
||||||
"decimals": 1,
|
|
||||||
"thresholds": {
|
|
||||||
"mode": "absolute",
|
|
||||||
"steps": [
|
|
||||||
{
|
{
|
||||||
"value": null,
|
"id": "unit",
|
||||||
"color": "blue"
|
"value": "short"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"id": "decimals",
|
||||||
|
"value": 0
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
},
|
},
|
||||||
"color": {
|
{
|
||||||
"mode": "fixed",
|
"matcher": {
|
||||||
"fixedColor": "blue"
|
"id": "byName",
|
||||||
|
"options": "est cost"
|
||||||
|
},
|
||||||
|
"properties": [
|
||||||
|
{
|
||||||
|
"id": "unit",
|
||||||
|
"value": "currencyUSD"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"id": "decimals",
|
||||||
|
"value": 2
|
||||||
|
}
|
||||||
|
]
|
||||||
}
|
}
|
||||||
},
|
]
|
||||||
"overrides": []
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -2211,7 +2060,7 @@
|
||||||
"x": 0,
|
"x": 0,
|
||||||
"y": 15,
|
"y": 15,
|
||||||
"width": 24,
|
"width": 24,
|
||||||
"height": 8,
|
"height": 10,
|
||||||
"element": {
|
"element": {
|
||||||
"kind": "ElementReference",
|
"kind": "ElementReference",
|
||||||
"name": "panel-60"
|
"name": "panel-60"
|
||||||
|
|
@ -2321,58 +2170,6 @@
|
||||||
"name": "panel-55"
|
"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"
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue