Documentation ¶
Index ¶
Constants ¶
View Source
const (
ControllerName = "metrics"
)
Variables ¶
View Source
var ( // MetricClusterDeploymentProvisionUnderwaySeconds is a prometheus metric for the number of seconds // between when a still provisioning cluster was created and now. MetricClusterDeploymentProvisionUnderwaySeconds = prometheus.NewGaugeVec( prometheus.GaugeOpts{ Name: "hive_cluster_deployment_provision_underway_seconds", Help: "Length of time a cluster has been provisioning.", }, []string{"cluster_deployment", "namespace", "cluster_type"}, ) // 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"}, ) // MetricControllerReconcileTime tracks the length of time our reconcile loops take. controller-runtime // technically tracks this for us, but due to bugs currently also includes time in the queue, which leads to // extremely strange results. For now, track our own metric. MetricControllerReconcileTime = prometheus.NewHistogramVec( prometheus.HistogramOpts{ Name: "hive_controller_reconcile_seconds", Help: "Distribution of the length of time each controllers reconcile loop takes.", Buckets: []float64{0.001, 0.01, 0.1, 1, 10, 30, 60, 120}, }, []string{"controller"}, ) )
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.
func (*Calculator) Start ¶
func (mc *Calculator) Start(stopCh <-chan struct{}) error
Start begins the metrics calculation loop.
Click to show internal directories.
Click to hide internal directories.