blob: 8776949d4064e1663963315b606b37dd28400576 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
|
package s3api
import (
stats_collect "github.com/chrislusf/seaweedfs/weed/stats"
"net/http"
"time"
)
func stats(f http.HandlerFunc, action string) http.HandlerFunc {
return func(w http.ResponseWriter, r *http.Request) {
start := time.Now()
stats_collect.S3RequestCounter.WithLabelValues(action).Inc()
f(w, r)
stats_collect.S3RequestHistogram.WithLabelValues(action).Observe(time.Since(start).Seconds())
}
}
|