Browse Source

[s3] reducing the number of metrics for 403 (#5961)

reducing the number of metrics
pull/5976/head
Konstantin Lebedev 4 months ago
committed by GitHub
parent
commit
16984ef07a
No known key found for this signature in database GPG Key ID: B5690EEEBB952194
  1. 5
      weed/s3api/stats.go

5
weed/s3api/stats.go

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

Loading…
Cancel
Save