metrics

package
Version: v0.1.0 Latest Latest
Warning

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

Go to latest
Published: Sep 6, 2019 License: Apache-2.0 Imports: 3 Imported by: 1

Documentation

Index

Constants

This section is empty.

Variables

View Source
var Dummy = &dummy{}

Dummy is a dummy metrics service.

Functions

This section is empty.

Types

type HandleKind

type HandleKind string

HandleKind is the kind of handler call on the controller.

const (
	// AddHandleKind represents the `Add` Handler call.
	AddHandleKind HandleKind = "add"
	// DeleteHandleKind represents the `Delete` Handler call.
	DeleteHandleKind HandleKind = "delete"
)

type Recorder

type Recorder interface {
	// WithID will set the ID name to the recorder and every metric
	// measured with the obtained recorder will be identified with
	// the name.
	WithID(id string) Recorder
	// IncControllerQueuedTotal increments the total number of objects queued on the controller queue.
	IncControllerQueuedTotal()
	// ObserveControllerOnQueueLatency will measure the duration the object has been queued
	// before being handled and this means the object just been dequeued.
	ObserveControllerOnQueueLatency(start time.Time)
	// ObserveControllerStorageGetLatency will measure the duration getting the object
	// from the storage.
	ObserveControllerStorageGetLatency(start time.Time, success bool)
	// ObserveControllerListLatency will measure the duration getting the list of object IDs
	// using the listerwatcher.
	ObserveControllerListLatency(start time.Time, success bool)
	// ObserveControllerHandleLatency will measure the duration to handle a object.
	ObserveControllerHandleLatency(start time.Time, kind HandleKind, success bool)
}

Recorder is the metrics service that knows how to record the metrics of the controller.

func NewPrometheus

func NewPrometheus(reg prometheus.Registerer) Recorder

NewPrometheus returns a metrics.Recorder that implements it using Prometheus as the metrics backend.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
t or T : Toggle theme light dark auto
y or Y : Canonical URL