diff --git a/nix/host-modules/swarm-grafana/dashboards/claude-usage.json b/nix/host-modules/swarm-grafana/dashboards/claude-usage.json index 35833b32d..312b28596 100644 --- a/nix/host-modules/swarm-grafana/dashboards/claude-usage.json +++ b/nix/host-modules/swarm-grafana/dashboards/claude-usage.json @@ -1010,8 +1010,8 @@ { "id": 44, "type": "timeseries", - "title": "Subscription usage, highest window", - "description": "Highest subscription usage percent across all agents and windows.", + "title": "Subscription usage per account", + "description": "Percent used (solid) and percent of the window elapsed (dashed), per claude account and window.", "datasource": { "type": "prometheus", "uid": "@datasourceUid@" @@ -1030,8 +1030,17 @@ "type": "prometheus", "uid": "@datasourceUid@" }, - "expr": "max({__name__=\"hyperhive.agent.claude_usage.percent\", hive=~\"$hive\", \"service.name\"=~\"$service\", agent=~\"$agent\"} unless on(agent, hive, window) ({__name__=\"hyperhive.agent.claude_usage.resets_at\", hive=~\"$hive\", \"service.name\"=~\"$service\", agent=~\"$agent\"} < time()))", - "legendFormat": "highest window" + "expr": "max by (account, window) ({__name__=\"hyperhive.agent.claude_usage.percent\", account!=\"\", hive=~\"$hive\", \"service.name\"=~\"$service\", agent=~\"$agent\"} unless on(agent, hive, window) ({__name__=\"hyperhive.agent.claude_usage.resets_at\", hive=~\"$hive\", \"service.name\"=~\"$service\", agent=~\"$agent\"} < time()))", + "legendFormat": "{{account}} · {{window}} used" + }, + { + "refId": "B", + "datasource": { + "type": "prometheus", + "uid": "@datasourceUid@" + }, + "expr": "(100 * (1 - (max by (account, window) ({__name__=\"hyperhive.agent.claude_usage.resets_at\", account!=\"\", window=\"seven_day\", hive=~\"$hive\", \"service.name\"=~\"$service\", agent=~\"$agent\"}) - time()) / 604800)) < 100 or (100 * (1 - (max by (account, window) ({__name__=\"hyperhive.agent.claude_usage.resets_at\", account!=\"\", window=\"five_hour\", hive=~\"$hive\", \"service.name\"=~\"$service\", agent=~\"$agent\"}) - time()) / 18000)) < 100", + "legendFormat": "{{account}} · {{window}} elapsed" } ], "fieldConfig": { @@ -1040,24 +1049,39 @@ "min": 0, "max": 100, "color": { - "mode": "fixed", - "fixedColor": "orange" + "mode": "palette-classic" }, "custom": { "drawStyle": "line", "lineWidth": 1, - "fillOpacity": 10, + "fillOpacity": 0, "showPoints": "never", "spanNulls": false } }, - "overrides": [] + "overrides": [ + { + "matcher": { + "id": "byFrameRefID", + "options": "B" + }, + "properties": [ + { + "id": "custom.lineStyle", + "value": { + "fill": "dash", + "dash": [10, 10] + } + } + ] + } + ] }, "options": { "legend": { "displayMode": "list", "placement": "bottom", - "showLegend": false, + "showLegend": true, "calcs": [] }, "tooltip": {