Documentation ¶
Index ¶
- func InitMetrics(initFunctions []func() (prometheus.Collector, error)) (err error)
- func NewCounterVecWithError(opts prometheus.CounterOpts, labelNames []string) (counter *prometheus.CounterVec, err error)
- func NewCounterWithError(opts prometheus.CounterOpts) (counter prometheus.Counter, err error)
- func NewGaugeWithError(opts prometheus.GaugeOpts) (gauge prometheus.Gauge, err error)
- func NewHistogramWithError(opts prometheus.HistogramOpts) (histogram prometheus.Histogram, err error)
- func SendMetrics(job, gatewayURL, gatewayAuthToken string) error
- func SendMetricsInLoop(ctx context.Context, job, gatewayURL, gatewayAuthToken string, ...)
- func UnregisterMetrics() error
- type GatewayClient
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func InitMetrics ¶
func InitMetrics(initFunctions []func() (prometheus.Collector, error)) (err error)
InitMetrics fills the collector variables with some Prometheus metrics and automatically registers them.
func NewCounterVecWithError ¶ added in v1.21.8
func NewCounterVecWithError(opts prometheus.CounterOpts, labelNames []string) (counter *prometheus.CounterVec, err error)
NewCounterVecWithError run promauto.NewCounterVec() catching the panic and returning an error
func NewCounterWithError ¶
func NewCounterWithError(opts prometheus.CounterOpts) (counter prometheus.Counter, err error)
NewCounterWithError run promauto.NewCounter() catching the panic and returning an error
func NewGaugeWithError ¶
func NewGaugeWithError(opts prometheus.GaugeOpts) (gauge prometheus.Gauge, err error)
NewGaugeWithError run promauto.NewGauge() catching the panic and returning an error
func NewHistogramWithError ¶
func NewHistogramWithError(opts prometheus.HistogramOpts) (histogram prometheus.Histogram, err error)
NewHistogramWithError run promauto.NewHistogram() catching the panic and returning an error
func SendMetrics ¶
SendMetrics pushes the metrics to the configured prometheus push gateway
func SendMetricsInLoop ¶
func SendMetricsInLoop(ctx context.Context, job, gatewayURL, gatewayAuthToken string, timeBetweenPush time.Duration)
SendMetricsInLoop pushes the metrics in a loop until context is done
func UnregisterMetrics ¶
func UnregisterMetrics() error
UnregisterMetrics unregister all prometheus collectors safe in the collectors variable
Types ¶
type GatewayClient ¶
GatewayClient is a simple wrapper over http.Client so that prometheus can do HTTP requests with the given authentication header