diff options
| author | Konstantin Lebedev <9497591+kmlebedev@users.noreply.github.com> | 2022-10-04 13:20:01 +0500 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2022-10-04 01:20:01 -0700 |
| commit | ec46a34f338ae40d2840c8569b26b02f8c8fbb22 (patch) | |
| tree | 73e7b34d626193776f0622c12a6adc58addecb92 /weed/s3api/stats.go | |
| parent | 18d92dbd45e227095c1051e6e07873a4917c01e8 (diff) | |
| download | seaweedfs-ec46a34f338ae40d2840c8569b26b02f8c8fbb22.tar.xz seaweedfs-ec46a34f338ae40d2840c8569b26b02f8c8fbb22.zip | |
avoid increasing the coordinates of metric labels (#3785)
Diffstat (limited to 'weed/s3api/stats.go')
| -rw-r--r-- | weed/s3api/stats.go | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/weed/s3api/stats.go b/weed/s3api/stats.go index cfdb3fb69..2b36478ad 100644 --- a/weed/s3api/stats.go +++ b/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() } |
