mirror of
https://github.com/seaweedfs/seaweedfs.git
synced 2024-01-19 02:48:24 +00:00
avoid increasing the coordinates of metric labels (#3785)
This commit is contained in:
parent
18d92dbd45
commit
ec46a34f33
|
@ -33,6 +33,12 @@ func track(f http.HandlerFunc, action string) http.HandlerFunc {
|
||||||
recorder := NewStatusResponseWriter(w)
|
recorder := NewStatusResponseWriter(w)
|
||||||
start := time.Now()
|
start := time.Now()
|
||||||
f(recorder, r)
|
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.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…
Reference in a new issue