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: 16 Imported by: 15

Documentation

Index

Constants

View Source
const (
	ControllerName = hivev1.MetricsControllerName
)

Variables

View Source
var (

	// MetricClusterDeploymentDeprovisioningUnderwaySeconds is a prometheus metric for the number of seconds
	// between when a still deprovisioning cluster was created and now.
	MetricClusterDeploymentDeprovisioningUnderwaySeconds = prometheus.NewGaugeVec(
		prometheus.GaugeOpts{
			Name: "hive_cluster_deployment_deprovision_underway_seconds",

			Help: "Length of time a cluster has been deprovisioning.",
		},
		[]string{"cluster_deployment", "namespace", "cluster_type"},
	)
)

Functions

func Add

func Add(mgr manager.Manager) error

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

func GetClusterDeploymentType

func GetClusterDeploymentType(obj metav1.Object) string

GetClusterDeploymentType returns the value of the hive.openshift.io/cluster-type label if set, otherwise a default value.

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 added in v1.0.12

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 added in v1.0.12

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

func (*ReconcileObserver) ObserveControllerReconcileTime added in v1.0.12

func (ro *ReconcileObserver) ObserveControllerReconcileTime()

func (*ReconcileObserver) SetOutcome added in v1.0.12

func (ro *ReconcileObserver) SetOutcome(outcome ReconcileOutcome)

type ReconcileOutcome added in v1.0.12

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