WithInstrumentation returns a router with instrumentation support.
(instrh func(handlerName string, handler http.HandlerFunc) http.HandlerFunc)
| 58 | |
| 59 | // WithInstrumentation returns a router with instrumentation support. |
| 60 | func (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. |
| 71 | func (r *Router) WithPrefix(prefix string) *Router { |
no outgoing calls