Konstantin Lebedev
2 years ago
committed by
GitHub
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with
6 additions and
0 deletions
-
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() |
|
|
|
} |
|
|
|