Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
var LogFailed = Log{ LogSuccess: false, }
LogFailed middleware logs each HTTP request method, path, response code and duration for non-2xx HTTP requests.
var Logging = Log{ LogSuccess: true, }
Logging middleware logs each HTTP request method, path, response code and duration for all HTTP requests.
Functions ¶
func MakeLabelValue ¶ added in v0.16.0
MakeLabelValue converts a Gorilla mux path to a string suitable for use in a Prometheus label value.
Types ¶
type ErrorHandler ¶ added in v1.0.0
ErrorHandler lets you call an alternate http handler upon a certain response code. Note it will assume a 200 if the wrapped handler does not write anything
type Instrument ¶
type Instrument struct { RouteMatcher interface { Match(*http.Request, *mux.RouteMatch) bool } Duration *prometheus.HistogramVec }
Instrument is a Middleware which records timings for every HTTP request
type Interface ¶
Interface is the shared contract for all middlesware, and allows middlesware to wrap handlers.
Identity is an Interface which doesn't do anything.
func Merge ¶
Merge produces a middleware that applies multiple middlesware in turn; ie Merge(f,g,h).Wrap(handler) == f.Wrap(g.Wrap(h.Wrap(handler)))
func PathReplace ¶ added in v0.15.0
PathReplace replcase Request.RequestURI with the specified string.