metrics/metrics.go
func Wrap(h http.Handler) http.Handler {
	return http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {
		requests.Add()                  // inc requests
		defer responses.Add()           // inc responses when we're done
		defer recordLatency(time.Now()) // record latency when we're done

		h.ServeHTTP(w, r)
	})
}
func Wrap(h http.Handler) http.Handler {
	return http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {
		requests.Add()                  // inc requests
		defer responses.Add()           // inc responses when we're done
		defer recordLatency(time.Now()) // record latency when we're done

		h.ServeHTTP(w, r)
	})
}
// Wrap returns a handler which records the number of requests received and
// responses sent to the given handler, as well as latency quantiles for
// responses over a five-minute window.
//
// These counters are published as the following metrics:
//
//     HTTP.Requests
//     HTTP.Responses
//     HTTP.Latency.{P50,P75,P90,P95,P99,P999}
//
// By tracking incoming requests and outgoing responses, one can monitor not
// only the requests per second, but also the number of requests being processed
// at any given point in time.