From 609aab6d8a6aee5c2f05017a47fdb50d09475f3d Mon Sep 17 00:00:00 2001 From: Chris Lu Date: Mon, 14 Sep 2026 22:13:34 -0700 Subject: [PATCH] admin: classify volume reads and writes by HTTP method The request counters label "type" with the HTTP method, so filtering on type=read/write matched nothing and left the throughput chart empty. A live cluster reports type=GET/POST. --- weed/admin/dash/monitoring_data.go | 22 ++++++++++++++++++++-- 1 file changed, 20 insertions(+), 2 deletions(-) diff --git a/weed/admin/dash/monitoring_data.go b/weed/admin/dash/monitoring_data.go index 11e2e03cd..196a26692 100644 --- a/weed/admin/dash/monitoring_data.go +++ b/weed/admin/dash/monitoring_data.go @@ -159,6 +159,24 @@ func hasLabel(key, value string) func(map[string]string) bool { return func(labels map[string]string) bool { return labels[key] == value } } +// The request counters label "type" with the HTTP method, so reads and writes +// are classified by verb rather than by a dedicated label. +func isReadRequest(labels map[string]string) bool { + switch labels["type"] { + case "GET", "HEAD": + return true + } + return false +} + +func isWriteRequest(labels map[string]string) bool { + switch labels["type"] { + case "POST", "PUT", "PATCH", "DELETE": + return true + } + return false +} + func (s *AdminServer) fillOverview(d *MonitoringData) { o := &d.Overview o.UnderReplicatedVolumes = s.sum(srcMaster, mMasterUnderReplicated) @@ -166,8 +184,8 @@ func (s *AdminServer) fillOverview(d *MonitoringData) { o.CrowdedVolumes = s.sum(srcMaster, mMasterCrowded) o.DiskUsagePct = s.diskUsagePct(srcVolume) - o.VolumeReadRate = s.sumFiltered(srcVolume, mVolumeRequests+suffixRate, hasLabel("type", "read")) - o.VolumeWriteRate = s.sumFiltered(srcVolume, mVolumeRequests+suffixRate, hasLabel("type", "write")) + o.VolumeReadRate = s.sumFiltered(srcVolume, mVolumeRequests+suffixRate, isReadRequest) + o.VolumeWriteRate = s.sumFiltered(srcVolume, mVolumeRequests+suffixRate, isWriteRequest) o.FilerRequestRate = s.sum(srcFiler, mFilerRequests+suffixRate) o.S3RequestRate = s.sum(srcS3, mS3Requests+suffixRate)