metrics

package
v0.10.2 Latest Latest
Warning

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

Go to latest
Published: Jan 11, 2023 License: Apache-2.0 Imports: 2 Imported by: 1

Documentation

Index

Constants

This section is empty.

Variables

View Source
var Dummy = &dummy{}

Dummy is a dummy stats recorder.

Functions

This section is empty.

Types

type EventType added in v0.4.0

type EventType string

EventType is the event type handled by the controller.

const (
	//AddEvent is the add event.
	AddEvent EventType = "add"
	// DeleteEvent is the delete event.
	DeleteEvent EventType = "delete"
	// RequeueEvent is a requeued event (unknown state when handling again).
	RequeueEvent EventType = "requeue"
)

type Prometheus

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

Prometheus implements the metrics recording in a prometheus registry.

func NewPrometheus

func NewPrometheus(registry prometheus.Registerer) *Prometheus

NewPrometheus returns a new Prometheus metrics backend with metrics prefixed by the namespace.

func NewPrometheusWithBuckets

func NewPrometheusWithBuckets(buckets []float64, registry prometheus.Registerer) *Prometheus

NewPrometheusWithBuckets returns a new Prometheus metrics backend with metrics prefixed by the namespace and with custom buckets for the duration/latency metrics. This kind should be used when the default buckets don't work. This could happen when the time to process an event is not on the range of 5ms-10s duration. Check https://godoc.org/github.com/prometheus/client_golang/prometheus#pkg-variables

func (*Prometheus) IncResourceEventProcessed added in v0.4.0

func (p *Prometheus) IncResourceEventProcessed(controller string, eventType EventType)

IncResourceEventProcessed satisfies metrics.Recorder interface.

func (*Prometheus) IncResourceEventProcessedError added in v0.4.0

func (p *Prometheus) IncResourceEventProcessedError(controller string, eventType EventType)

IncResourceEventProcessedError satisfies metrics.Recorder interface.

func (*Prometheus) IncResourceEventQueued added in v0.4.0

func (p *Prometheus) IncResourceEventQueued(controller string, eventType EventType)

IncResourceEventQueued satisfies metrics.Recorder interface.

func (*Prometheus) ObserveDurationResourceEventProcessed added in v0.4.0

func (p *Prometheus) ObserveDurationResourceEventProcessed(controller string, eventType EventType, start time.Time)

ObserveDurationResourceEventProcessed satisfies metrics.Recorder interface.

type Recorder

type Recorder interface {
	// IncResourceEvent increments in one the metric records of a queued event.
	IncResourceEventQueued(controller string, eventType EventType)
	// IncResourceEventProcessed increments in one the metric records processed event.
	IncResourceEventProcessed(controller string, eventType EventType)
	// IncResourceEventProcessedError increments in one the metric records of a processed event in error.
	IncResourceEventProcessedError(controller string, eventType EventType)
	// ObserveDurationResourceEventProcessed measures the duration it took to process a event.
	ObserveDurationResourceEventProcessed(controller string, eventType EventType, start time.Time)
}

Recorder knows how to record metrics all over the application.

Jump to

Keyboard shortcuts

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