Documentation ¶
Overview ¶
Package metrics contains utilities for working with metrics in prow.
This file is a copy from upstream where it was removed in https://github.com/prometheus/client_golang/pull/600
Index ¶
- func ErrorRate(prefix string) *prometheus.CounterVec
- func ExposeMetrics(component string, pushGateway config.PushGateway, port int)
- func ExposeMetricsWithRegistry(component string, pushGateway config.PushGateway, port int, ...)
- func HttpRequestDuration(prefix string, min, max float64) *prometheus.HistogramVec
- func HttpResponseSize(prefix string, min, max int) *prometheus.HistogramVec
- func RecordError(label string, errorRate *prometheus.CounterVec)
- func TraceHandler(simplifier simplifypath.Simplifier, ...) func(h http.Handler) http.Handler
- type CreateServer
- type Metrics
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func ErrorRate ¶
func ErrorRate(prefix string) *prometheus.CounterVec
ErrorRate returns a counter vector with relevant fields set
func ExposeMetrics ¶
func ExposeMetrics(component string, pushGateway config.PushGateway, port int)
ExposeMetrics chooses whether to serve or push metrics for the service
func ExposeMetricsWithRegistry ¶
func ExposeMetricsWithRegistry(component string, pushGateway config.PushGateway, port int, reg prometheus.Gatherer, createServer CreateServer)
ExposeMetricsWithRegistry chooses whether to serve or push metrics for the service with the registry
func HttpRequestDuration ¶
func HttpRequestDuration(prefix string, min, max float64) *prometheus.HistogramVec
HttpRequestDuration returns a histogram vector with relevant fields set
func HttpResponseSize ¶
func HttpResponseSize(prefix string, min, max int) *prometheus.HistogramVec
HttpResponseSize returns a histogram vector with relevant fields set
func RecordError ¶
func RecordError(label string, errorRate *prometheus.CounterVec)
RecordError records the error to prometheus
func TraceHandler ¶
func TraceHandler(simplifier simplifypath.Simplifier, httpRequestDuration, httpResponseSize *prometheus.HistogramVec) func(h http.Handler) http.Handler
TraceHandler allows the for a custom timer to be used to log metrics for Handler functions It is an abstraction to allow testing of HandleWithMetrics
Types ¶
type CreateServer ¶
type CreateServer func(http.Handler) interrupts.ListenAndServer
type Metrics ¶
type Metrics struct { HTTPRequestDuration *prometheus.HistogramVec HTTPResponseSize *prometheus.HistogramVec ErrorRate *prometheus.CounterVec }
Metrics holds the metrics for Prometheus
func NewMetrics ¶
NewMetrics is a constructor for Metrics