updated to add StabilityLevel

This commit is contained in:
JD Nurme 2021-12-10 21:07:14 +00:00
parent bdedfb7653
commit 2987e65a57

View File

@ -35,8 +35,9 @@ type ControllerMetrics struct {
func newControllerMetrics() *ControllerMetrics {
controllerInstanceCount := k8smetrics.NewGaugeVec(
&k8smetrics.GaugeOpts{
Name: "managed_controller_instance_count",
Help: "Instances of individual controllers currently running",
Name: "managed_controller_instance_count",
Help: "Instances of individual controllers currently running",
StabilityLevel: k8smetrics.ALPHA,
},
[]string{"controller_name", "controller_manager"},
)
@ -46,6 +47,11 @@ func newControllerMetrics() *ControllerMetrics {
}
}
// controller_name and controller_manager should be updated to validate against bounded lists
// this will allow us to confirm they are populated with "good" values.
// These values use set instead of inc/dec to avoid accidentally double counting
// a controller that starts but fails to properly signal when it crashes.
// ControllerStarted sets the controllerInstanceCount to 1.
func (a *ControllerMetrics) ControllerStarted(controllerName string, controllerManager string) {
a.controllerInstanceCount.With(k8smetrics.Labels{"controller_name": controllerName, "controller_manager": controllerManager}).Set(float64(1))