func InstrumentHandlerDuration(obs prometheus.ObserverVec, next http.Handler) http.HandlerFunc {
	return http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {
		now := time.Now()
		next.ServeHTTP(w, r)
		obs.With(InstrumentLabels(r, "id", "code")).Observe(time.Since(now).Seconds())
	})
}
// InstrumentHandlerDuration is a middleware that wraps the provided
// http.Handler to observe the request duration with the provided ObserverVec.
// The ObserverVec must have zero, one, or two non-const non-curried labels. For
// those, the only allowed label names are "code" and "method". The function
// panics otherwise. The Observe method of the Observer in the ObserverVec is
// called with the request duration in seconds. Partitioning happens by HTTP
// status code and/or HTTP method if the respective instance label names are
// present in the ObserverVec. For unpartitioned observations, use an
// ObserverVec with zero labels. Note that partitioning of Histograms is
// expensive and should be used judiciously.
//
// If the wrapped Handler does not set a status code, a status code of 200 is assumed.
//
// If the wrapped Handler panics, no values are reported.
//
// Note that this method is only guaranteed to never observe negative durations
// if used with Go1.9+.
InstrumentHandlerDuration is a middleware that wraps the provided
http.Handler to observe the request duration with the provided ObserverVec.
The ObserverVec must have zero, one, or two non-const non-curried labels. For
those, the only allowed label names are "code" and "method". The function
panics otherwise. The Observe method of the Observer in the ObserverVec is
called with the request duration in seconds. Partitioning happens by HTTP
status code and/or HTTP method if the respective instance label names are
present in the ObserverVec. For unpartitioned observations, use an
ObserverVec with zero labels. Note that partitioning of Histograms is
expensive and should be used judiciously.

If the wrapped Handler does not set a status code, a status code of 200 is assumed.

If the wrapped Handler panics, no values are reported.

Note that this method is only guaranteed to never observe negative durations
if used with Go1.9+.
// InstrumentHandlerDuration is a middleware that wraps the provided // http . Handler to observe the request duration with the provided ObserverVec . // The ObserverVec must have zero one or two non - const non - curried labels . For // those the only allowed label names are " code " and " method " . The function // panics otherwise . The Observe method of the Observer in the ObserverVec is // called with the request duration in seconds . Partitioning happens by HTTP // status code and / or HTTP method if the respective instance label names are // present in the ObserverVec . For unpartitioned observations use an // ObserverVec with zero labels . Note that partitioning of Histograms is // expensive and should be used judiciously . // // If the wrapped Handler does not set a status code a status code of 200 is assumed . // // If the wrapped Handler panics no values are reported . // // Note that this method is only guaranteed to never observe negative durations // if used with Go1 . 9 + .
func InstrumentHandlerDuration(obs prometheus.ObserverVec, next http.Handler) http.HandlerFunc {
	return http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {
		now := time.Now()
		next.ServeHTTP(w, r)
		obs.With(InstrumentLabels(r, "id", "code")).Observe(time.Since(now).Seconds())
	})
}
func InstrumentHandlerDuration ( obs prometheus . ObserverVec , next http . Handler ) http . HandlerFunc { return http . HandlerFunc ( func ( w http . ResponseWriter , r * http . Request ) { now := time . Now ( ) next . ServeHTTP ( w , r ) obs . With ( InstrumentLabels ( r , " " , " " ) ) . Observe ( time . Since ( now ) . Seconds ( ) ) } ) }
InstrumentHandlerDuration is a middleware that wraps the provided
http.Handler to observe the request duration with the provided ObserverVec.
InstrumentHandlerDuration is a middleware that wraps the provided http . Handler to observe the request duration with the provided ObserverVec .