From e259052a70b72bf193013829b272611a32f12bde Mon Sep 17 00:00:00 2001 From: chrislu Date: Wed, 17 Aug 2022 04:29:31 -0700 Subject: [PATCH] volume: fix metrics for volume request time --- weed/server/volume_server_handlers.go | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/weed/server/volume_server_handlers.go b/weed/server/volume_server_handlers.go index fd043ad51..92f7cca1d 100644 --- a/weed/server/volume_server_handlers.go +++ b/weed/server/volume_server_handlers.go @@ -38,9 +38,9 @@ func (vs *VolumeServer) privateStoreHandler(w http.ResponseWriter, r *http.Reque } stats.VolumeServerRequestCounter.WithLabelValues(r.Method).Inc() start := time.Now() - defer func() { + defer func(start time.Time) { stats.VolumeServerRequestHistogram.WithLabelValues(r.Method).Observe(time.Since(start).Seconds()) - }() + }(start) switch r.Method { case "GET", "HEAD": stats.ReadRequest()