From 39be42114193a6daa69b2c5dc066fa23556892b1 Mon Sep 17 00:00:00 2001 From: Tom Wilkie Date: Mon, 5 Sep 2016 15:49:20 +0100 Subject: [PATCH] Allow a nil RouteMatcher in instrumentation (#1852) So the instrumentation can be used for things other than gorilla. --- common/middleware/instrument.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/common/middleware/instrument.go b/common/middleware/instrument.go index 0a93d1ee2..676a59f6a 100644 --- a/common/middleware/instrument.go +++ b/common/middleware/instrument.go @@ -51,7 +51,7 @@ func (i Instrument) Wrap(next http.Handler) http.Handler { // prometheus. func (i Instrument) getRouteName(r *http.Request) string { var routeMatch mux.RouteMatch - if i.RouteMatcher.Match(r, &routeMatch) { + if i.RouteMatcher != nil && i.RouteMatcher.Match(r, &routeMatch) { if name := routeMatch.Route.GetName(); name != "" { return name }