Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func TimeRequestHistogram ¶
func TimeRequestHistogram(method string, metric *prometheus.HistogramVec, f func() error) error
TimeRequestHistogram runs 'f' and records how long it took in the given Prometheus histogram metric. If 'f' returns successfully, record a "200". Otherwise, record "500".
If you want more complicated logic for translating errors into statuses, use 'TimeRequestStatus'.
func TimeRequestHistogramStatus ¶
func TimeRequestHistogramStatus(method string, metric *prometheus.HistogramVec, toStatusCode func(error) string, f func() error) error
TimeRequestHistogramStatus runs 'f' and records how long it took in the given Prometheus histogram metric.
toStatusCode is a function that translates errors returned by 'f' into HTTP-like status codes.
Types ¶
This section is empty.
Click to show internal directories.
Click to hide internal directories.