metrics

package
v1.1.16 Latest Latest
Warning

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

Go to latest
Published: Sep 3, 2021 License: Apache-2.0 Imports: 12 Imported by: 0

Documentation

Index

Constants

View Source
const (
	ControllerName = hivev1.MetricsControllerName
)

Variables

This section is empty.

Functions

func Add

func Add(mgr manager.Manager) error

Add creates a new metrics Calculator and adds it to the Manager.

Types

type Calculator

type Calculator struct {
	Client client.Client

	// Interval is the length of time we sleep between metrics calculations.
	Interval time.Duration
}

Calculator runs in a goroutine and periodically calculates and publishes Prometheus metrics which will be exposed at our /metrics endpoint. Note that this is not a standard controller watching Kube resources, it runs periodically and then goes to sleep.

This should be used for metrics which do not fit well into controller reconcile loops, things that are calculated globally rather than metrics related to specific reconciliations.

func (*Calculator) Start

func (mc *Calculator) Start(ctx context.Context) error

Start begins the metrics calculation loop.

type ReconcileObserver

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

ReconcileObserver is used to track, log, and report metrics for controller reconcile time and outcome. Each controller should instantiate one near the start of the reconcile loop, and defer a call to ObserveControllerReconcileTime.

func NewReconcileObserver

func NewReconcileObserver(controllerName hivev1.ControllerName, logger log.FieldLogger) *ReconcileObserver

func (*ReconcileObserver) ObserveControllerReconcileTime

func (ro *ReconcileObserver) ObserveControllerReconcileTime()

type ReconcileOutcome

type ReconcileOutcome string

ReconcileOutcome is used in controller "reconcile complete" log entries, and the metricControllerReconcileTime above for controllers where we would like to monitor performance for different types of Reconcile outcomes. To help with prometheus cardinality this set of outcomes should be kept small and only used for coarse and very high value categories. Controllers must report an outcome but can report unspecified if this categorization is not needed.

const (
	ReconcileOutcomeUnspecified        ReconcileOutcome = "unspecified"
	ReconcileOutcomeNoOp               ReconcileOutcome = "no-op"
	ReconcileOutcomeSkippedSync        ReconcileOutcome = "skipped-sync"
	ReconcileOutcomeFullSync           ReconcileOutcome = "full-sync"
	ReconcileOutcomeClusterSyncCreated ReconcileOutcome = "clustersync-created"
)

Jump to

Keyboard shortcuts

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