mirror of
https://github.com/weaveworks/scope.git
synced 2026-07-16 03:49:52 +00:00
Allow a nil RouteMatcher in instrumentation (#1852)
So the instrumentation can be used for things other than gorilla.
This commit is contained in:
@@ -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
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user