MCPcopy Create free account
hub / github.com/prometheus/common / WithInstrumentation

Method WithInstrumentation

route/route.go:60–68  ·  view source on GitHub ↗

WithInstrumentation returns a router with instrumentation support.

(instrh func(handlerName string, handler http.HandlerFunc) http.HandlerFunc)

Source from the content-addressed store, hash-verified

58
59// WithInstrumentation returns a router with instrumentation support.
60func (r *Router) WithInstrumentation(instrh func(handlerName string, handler http.HandlerFunc) http.HandlerFunc) *Router {
61 if r.instrh != nil {
62 newInstrh := instrh
63 instrh = func(handlerName string, handler http.HandlerFunc) http.HandlerFunc {
64 return newInstrh(handlerName, r.instrh(handlerName, handler))
65 }
66 }
67 return &Router{rtr: r.rtr, prefix: r.prefix, instrh: instrh}
68}
69
70// WithPrefix returns a router that prefixes all registered routes with prefix.
71func (r *Router) WithPrefix(prefix string) *Router {

Callers 2

TestInstrumentationFunction · 0.80
TestInstrumentationsFunction · 0.80

Calls

no outgoing calls

Tested by 2

TestInstrumentationFunction · 0.64
TestInstrumentationsFunction · 0.64