metrics

package
v0.12.2 Latest Latest
Warning

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

Go to latest
Published: Jun 23, 2022 License: Apache-2.0 Imports: 10 Imported by: 847

Documentation

Overview

Package metrics contains controller related metrics utilities

Index

Constants

View Source
const (
	RestClientSubsystem = "rest_client"
	LatencyKey          = "request_latency_seconds"
	ResultKey           = "requests_total"
)

Metrics subsystem and all of the keys used by the rest client.

View Source
const (
	ReflectorSubsystem     = "reflector"
	ListsTotalKey          = "lists_total"
	ListsDurationKey       = "list_duration_seconds"
	ItemsPerListKey        = "items_per_list"
	WatchesTotalKey        = "watches_total"
	ShortWatchesTotalKey   = "short_watches_total"
	WatchDurationKey       = "watch_duration_seconds"
	ItemsPerWatchKey       = "items_per_watch"
	LastResourceVersionKey = "last_resource_version"
)

Metrics subsystem and all keys used by the reflectors.

View Source
const (
	WorkQueueSubsystem         = "workqueue"
	DepthKey                   = "depth"
	AddsKey                    = "adds_total"
	QueueLatencyKey            = "queue_duration_seconds"
	WorkDurationKey            = "work_duration_seconds"
	UnfinishedWorkKey          = "unfinished_work_seconds"
	LongestRunningProcessorKey = "longest_running_processor_seconds"
	RetriesKey                 = "retries_total"
)

Metrics subsystem and all keys used by the workqueue.

Variables

View Source
var DefaultBindAddress = ":8080"

DefaultBindAddress sets the default bind address for the metrics listener The metrics is on by default.

View Source
var (

	// RequestLatency reports the request latency in seconds per verb/URL.
	// Deprecated: This metric is deprecated for removal in a future release: using the URL as a
	// dimension results in cardinality explosion for some consumers. It was deprecated upstream
	// in k8s v1.14 and hidden in v1.17 via https://github.com/kubernetes/kubernetes/pull/83836.
	// It is not registered by default. To register:
	//	import (
	//		clientmetrics "k8s.io/client-go/tools/metrics"
	//		clmetrics "sigs.k8s.io/controller-runtime/metrics"
	//	)
	//
	//	func init() {
	//		clmetrics.Registry.MustRegister(clmetrics.RequestLatency)
	//		clientmetrics.Register(clientmetrics.RegisterOpts{
	//			RequestLatency: clmetrics.LatencyAdapter
	//		})
	//	}
	RequestLatency = prometheus.NewHistogramVec(prometheus.HistogramOpts{
		Subsystem: RestClientSubsystem,
		Name:      LatencyKey,
		Help:      "Request latency in seconds. Broken down by verb and URL.",
		Buckets:   prometheus.ExponentialBuckets(0.001, 2, 10),
	}, []string{"verb", "url"})
)

Functions

func NewListener

func NewListener(addr string) (net.Listener, error)

NewListener creates a new TCP listener bound to the given address.

Types

type LatencyAdapter added in v0.10.0

type LatencyAdapter struct {
	// contains filtered or unexported fields
}

LatencyAdapter implements LatencyMetric.

func (*LatencyAdapter) Observe added in v0.10.0

func (l *LatencyAdapter) Observe(_ context.Context, verb string, u url.URL, latency time.Duration)

Observe increments the request latency metric for the given verb/URL.

type RegistererGatherer added in v0.5.0

type RegistererGatherer interface {
	prometheus.Registerer
	prometheus.Gatherer
}

RegistererGatherer combines both parts of the API of a Prometheus registry, both the Registerer and the Gatherer interfaces.

Registry is a prometheus registry for storing metrics within the controller-runtime.

Jump to

Keyboard shortcuts

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