Browse Source

volume: fix metrics for volume request time

pull/3461/head
chrislu 2 years ago
parent
commit
e259052a70
  1. 4
      weed/server/volume_server_handlers.go

4
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() stats.VolumeServerRequestCounter.WithLabelValues(r.Method).Inc()
start := time.Now() start := time.Now()
defer func() {
defer func(start time.Time) {
stats.VolumeServerRequestHistogram.WithLabelValues(r.Method).Observe(time.Since(start).Seconds()) stats.VolumeServerRequestHistogram.WithLabelValues(r.Method).Observe(time.Since(start).Seconds())
}()
}(start)
switch r.Method { switch r.Method {
case "GET", "HEAD": case "GET", "HEAD":
stats.ReadRequest() stats.ReadRequest()

Loading…
Cancel
Save