From 4cf028f6833763d56e25aa0c41daf60793c376f7 Mon Sep 17 00:00:00 2001 From: Chris Lu Date: Fri, 27 Nov 2026 18:58:37 -0800 Subject: [PATCH] grafana: show the first EC shard copy failure of each series (#13071) * grafana: count the failure that creates an EC shard copy failure series The EC shard copy failure counter exports a collection and reason pair only once a copy fails, so rate() saw that first value as a baseline and never showed it. The panel now shows failures per rate interval and adds the earliest value of a series that did not exist one interval ago. Co-Authored-By: Claude Opus 5.5 * grafana: count a new EC shard copy failure series from its last value increase() extrapolates the increments of a series that appears inside the window, and an instant offset selector loses an old series across a scrape gap, so the panel could add a whole counter as new failures. A series with no sample in the day before the window now shows its last value; every other series shows increase(). Co-Authored-By: Claude Opus 5.5 * grafana: count the first EC shard copy failure after a restart A restarted volume server exports a failure series again only at its first failure, so when the same labels had a sample earlier in the day the window held only the new counter's samples and increase() missed that failure. A series whose lowest value in the window is below its last value before the window has been reset since, and now shows its last value; a series back from a scrape gap keeps its value and still uses increase(). Co-Authored-By: Claude Opus 5.5 --------- Co-authored-by: Claude Opus 5.5 --- other/metrics/grafana_seaweedfs.json | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/other/metrics/grafana_seaweedfs.json b/other/metrics/grafana_seaweedfs.json index ba884011aa..ec559743eb 100644 --- a/other/metrics/grafana_seaweedfs.json +++ b/other/metrics/grafana_seaweedfs.json @@ -5458,7 +5458,7 @@ "uid": "${DS_PROMETHEUS}" }, "title": "EC Shard Copy Failures by reason", - "description": "Rate of failed EC shard copies into each volume server by collection and reason (source_not_found, empty_index, no_space, timeout, io_error, other). The volume server log names the volume, shards and source of each failure.", + "description": "Failed EC shard copies into each volume server per rate interval, by collection and reason (source_not_found, empty_index, no_space, timeout, io_error, other). The volume server log names the volume, shards and source of each failure.", "type": "timeseries", "id": 269, "gridPos": { @@ -5505,7 +5505,7 @@ } }, "mappings": [], - "unit": "ops", + "unit": "short", "thresholds": { "mode": "absolute", "steps": [ @@ -5540,7 +5540,7 @@ "uid": "${DS_PROMETHEUS}" }, "editorMode": "code", - "expr": "sum by (instance, collection, reason) (rate(SeaweedFS_volumeServer_ec_shard_copy_failures_total{cluster=~\"$cluster\"}[$__rate_interval]))", + "expr": "sum by (instance, collection, reason) ((last_over_time(SeaweedFS_volumeServer_ec_shard_copy_failures_total{cluster=~\"$cluster\"}[$__rate_interval]) and (min_over_time(SeaweedFS_volumeServer_ec_shard_copy_failures_total{cluster=~\"$cluster\"}[$__rate_interval]) < last_over_time(SeaweedFS_volumeServer_ec_shard_copy_failures_total{cluster=~\"$cluster\"}[1d] offset $__rate_interval))) or (increase(SeaweedFS_volumeServer_ec_shard_copy_failures_total{cluster=~\"$cluster\"}[$__rate_interval]) and count_over_time(SeaweedFS_volumeServer_ec_shard_copy_failures_total{cluster=~\"$cluster\"}[1d] offset $__rate_interval)) or (last_over_time(SeaweedFS_volumeServer_ec_shard_copy_failures_total{cluster=~\"$cluster\"}[$__rate_interval]) unless count_over_time(SeaweedFS_volumeServer_ec_shard_copy_failures_total{cluster=~\"$cluster\"}[1d] offset $__rate_interval)))", "range": true, "refId": "A", "legendFormat": "{{instance}} {{collection}} {{reason}}"