Browse Source

avoid increasing the coordinates of metric labels (#3785)

pull/3789/head
Konstantin Lebedev 2 years ago
committed by GitHub
parent
commit
ec46a34f33
No known key found for this signature in database GPG Key ID: 4AEE18F83AFDEB23
  1. 6
      weed/s3api/stats.go

6
weed/s3api/stats.go

@ -33,6 +33,12 @@ func track(f http.HandlerFunc, action string) http.HandlerFunc {
recorder := NewStatusResponseWriter(w)
start := time.Now()
f(recorder, r)
if recorder.Status == http.StatusForbidden {
if m, _ := stats_collect.S3RequestCounter.GetMetricWithLabelValues(
action, strconv.Itoa(http.StatusOK), bucket); m == nil {
bucket = ""
}
}
stats_collect.S3RequestHistogram.WithLabelValues(action, bucket).Observe(time.Since(start).Seconds())
stats_collect.S3RequestCounter.WithLabelValues(action, strconv.Itoa(recorder.Status), bucket).Inc()
}

Loading…
Cancel
Save