metrics

package
v0.1.0 Latest Latest
Warning

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

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

README

DOCUMENTATION DEPRECATION NOTICE: This file is deprecated. Please refer to the new migrated location. Please do not edit this file; instead, make changes to the new location!

The new location is served on the web at https://docs.prow.k8s.io/docs/.

This file will be deleted on 2023-02-28.

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