Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func Handler ¶
Handler is HTTP middleware that collects stats about the request. It collects request counts by path, method and status, and request duration by path and method.
It gets the path via the request context, you must provide it with handlers.WithRoute() before this handler is called. Failure to do so will result in a panic.
We do not have any default behaviour when that occurs because we have no idea of the cardinality of the request path. High cardinality is something we must avoid at all costs.
A typical setup is to expose the path template, as defined in your router of, choice. This will result in capturing metrics for /users/{id} instead of /users/42, /users/43, etc.
func HandlerFunc ¶
func HandlerFunc(next http.HandlerFunc) http.Handler
HandlerFunc is like Prometheus but takes n http.HandlerFunc, for convenience.
func Observe ¶
Observe records n HTTP request.
It collects request counts by path, method and status, and request duration by path and method.
Be careful with the path you pass in, high cardinality is something we must avoid at all costs.
A typical setup is to use the path template, as defined in your router of choice. This will result in capturing metrics for /users/{id} instead of /users/42, /users/43, etc.
Types ¶
This section is empty.