From dd17b20dac9b2887723f9f3ab4aa8d80546785d4 Mon Sep 17 00:00:00 2001 From: iris Date: Wed, 25 Nov 2026 18:50:01 +0100 Subject: [PATCH] grafana: draw the forge change-size panels as bars that follow the time range Average change size and the lines added and deleted panels drew one-line spikes: the counters only exist while a repo is active and the rate over the short rate interval left a gap everywhere else, so isolated pushes were hairlines, and one repo's bulk import set the scale for the rest. They now draw bars of at most 40 buckets that follow the time range, and the average is the bucket's lines over its merges on a logarithmic axis. No docs change: observability.md documents the metrics, not the panels. --- .../swarm-grafana/dashboards/forge.json | 45 +++++++++++++------ 1 file changed, 31 insertions(+), 14 deletions(-) diff --git a/nix/host-modules/swarm-grafana/dashboards/forge.json b/nix/host-modules/swarm-grafana/dashboards/forge.json index aa2dc3d91..26c736f9a 100644 --- a/nix/host-modules/swarm-grafana/dashboards/forge.json +++ b/nix/host-modules/swarm-grafana/dashboards/forge.json @@ -2148,7 +2148,9 @@ } ], "transformations": [], - "queryOptions": {} + "queryOptions": { + "maxDataPoints": 40 + } } }, "vizConfig": { @@ -2176,12 +2178,16 @@ "mode": "palette-classic" }, "custom": { - "drawStyle": "line", + "drawStyle": "bars", "lineWidth": 1, - "fillOpacity": 0, + "fillOpacity": 80, "showPoints": "never", "spanNulls": false, - "axisSoftMin": 0 + "axisSoftMin": 0, + "stacking": { + "mode": "normal", + "group": "A" + } } }, "overrides": [] @@ -2222,7 +2228,9 @@ } ], "transformations": [], - "queryOptions": {} + "queryOptions": { + "maxDataPoints": 40 + } } }, "vizConfig": { @@ -2250,12 +2258,16 @@ "mode": "palette-classic" }, "custom": { - "drawStyle": "line", + "drawStyle": "bars", "lineWidth": 1, - "fillOpacity": 0, + "fillOpacity": 80, "showPoints": "never", "spanNulls": false, - "axisSoftMin": 0 + "axisSoftMin": 0, + "stacking": { + "mode": "normal", + "group": "A" + } } }, "overrides": [] @@ -2269,7 +2281,7 @@ "spec": { "id": 26, "title": "Average change size", - "description": "Lines added plus deleted per default-branch push, by repo.", + "description": "Lines changed per default-branch push, by repo; bar width follows the time range; log axis.", "links": [], "data": { "kind": "QueryGroup", @@ -2286,7 +2298,7 @@ "name": "@datasourceUid@" }, "spec": { - "expr": "sum by (repo) (rate({__name__=\"hyperhive.vcs.default_branch.lines_added\", \"service.name\"=\"swarm-controller\"}[$__rate_interval]) + rate({__name__=\"hyperhive.vcs.default_branch.lines_deleted\", \"service.name\"=\"swarm-controller\"}[$__rate_interval])) / sum by (repo) (rate({__name__=\"hyperhive.vcs.default_branch.merges\", \"service.name\"=\"swarm-controller\"}[$__rate_interval]))", + "expr": "sum by (repo) (increase({__name__=\"hyperhive.vcs.default_branch.lines_added\", \"service.name\"=\"swarm-controller\"}[$__interval]) + increase({__name__=\"hyperhive.vcs.default_branch.lines_deleted\", \"service.name\"=\"swarm-controller\"}[$__interval])) / sum by (repo) (increase({__name__=\"hyperhive.vcs.default_branch.merges\", \"service.name\"=\"swarm-controller\"}[$__interval]))", "legendFormat": "{{repo}}" } }, @@ -2296,7 +2308,9 @@ } ], "transformations": [], - "queryOptions": {} + "queryOptions": { + "maxDataPoints": 40 + } } }, "vizConfig": { @@ -2324,12 +2338,15 @@ "mode": "palette-classic" }, "custom": { - "drawStyle": "line", + "drawStyle": "bars", "lineWidth": 1, - "fillOpacity": 0, + "fillOpacity": 80, "showPoints": "never", "spanNulls": false, - "axisSoftMin": 0 + "scaleDistribution": { + "type": "log", + "log": 10 + } } }, "overrides": []