package metrics import ( "net/http" "github.com/gorilla/mux" ) // currentRoute returns the gorilla/mux path template for the request, if the // request was matched by a mux router. func currentRoute(r *http.Request) string { route := mux.CurrentRoute(r) if route == nil { return "" } if tmpl, err := route.GetPathTemplate(); err == nil { return tmpl } return "" }