You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

21 lines
526 B

4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
  1. package s3api
  2. import (
  3. stats_collect "github.com/chrislusf/seaweedfs/weed/stats"
  4. "github.com/chrislusf/seaweedfs/weed/util"
  5. "net/http"
  6. "time"
  7. )
  8. func track(f http.HandlerFunc, action string) http.HandlerFunc {
  9. return func(w http.ResponseWriter, r *http.Request) {
  10. w.Header().Set("Server", "SeaweedFS S3 "+util.VERSION)
  11. start := time.Now()
  12. stats_collect.S3RequestCounter.WithLabelValues(action).Inc()
  13. f(w, r)
  14. stats_collect.S3RequestHistogram.WithLabelValues(action).Observe(time.Since(start).Seconds())
  15. }
  16. }