metrics

package
v0.0.0-...-1738bad Latest Latest
Warning

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

Go to latest
Published: May 10, 2024 License: Apache-2.0 Imports: 19 Imported by: 0

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

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

func NewMetrics(namespace string) *Metrics

NewMetrics is a constructor for Metrics

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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