diff options
| author | LHHDZ <changlin.shi@ly.com> | 2022-06-20 13:42:18 +0800 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2022-06-20 13:42:18 +0800 |
| commit | 8db9f13bc69be974fbd18c4b0aacd071ea1acaa9 (patch) | |
| tree | e84927ea360a7ede80d13fe7aada59356c0475ce /weed/s3api/stats.go | |
| parent | 9e036df3566e842710ea2b0ed3ad28f5af2a1885 (diff) | |
| parent | 1baa7ead59a0a040d1165e3579cf79f90c20dd65 (diff) | |
| download | seaweedfs-8db9f13bc69be974fbd18c4b0aacd071ea1acaa9.tar.xz seaweedfs-8db9f13bc69be974fbd18c4b0aacd071ea1acaa9.zip | |
Merge branch 'master' into circuit_breaker
Diffstat (limited to 'weed/s3api/stats.go')
| -rw-r--r-- | weed/s3api/stats.go | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/weed/s3api/stats.go b/weed/s3api/stats.go index 973d8c0eb..003807a25 100644 --- a/weed/s3api/stats.go +++ b/weed/s3api/stats.go @@ -1,6 +1,7 @@ package s3api import ( + "github.com/chrislusf/seaweedfs/weed/s3api/s3_constants" stats_collect "github.com/chrislusf/seaweedfs/weed/stats" "net/http" "strconv" @@ -27,11 +28,12 @@ func (r *StatusRecorder) Flush() { func track(f http.HandlerFunc, action string) http.HandlerFunc { return func(w http.ResponseWriter, r *http.Request) { + bucket, _ := s3_constants.GetBucketAndObject(r) w.Header().Set("Server", "SeaweedFS S3") recorder := NewStatusResponseWriter(w) start := time.Now() f(recorder, r) - stats_collect.S3RequestHistogram.WithLabelValues(action).Observe(time.Since(start).Seconds()) - stats_collect.S3RequestCounter.WithLabelValues(action, strconv.Itoa(recorder.Status)).Inc() + stats_collect.S3RequestHistogram.WithLabelValues(action, bucket).Observe(time.Since(start).Seconds()) + stats_collect.S3RequestCounter.WithLabelValues(action, strconv.Itoa(recorder.Status), bucket).Inc() } } |
