Documentation ¶
Index ¶
Constants ¶
const (
ControllerName = hivev1.MetricsControllerName
)
Variables ¶
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 GetClusterDeploymentType ¶
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.
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" )