prom

package
v0.0.0-...-1d69502 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Aug 3, 2020 License: Unlicense Imports: 6 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Handler

func Handler(next http.Handler) http.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

func Observe(method, path string, status int, dur time.Duration)

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.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL