From 89c375bc745fd3101aedd6ee5241b63fea9d85f2 Mon Sep 17 00:00:00 2001 From: JD Nurme Date: Tue, 14 Dec 2021 21:22:32 +0000 Subject: [PATCH] updated with fixes based on comments by dgrisonnet --- .../metrics/prometheus/controllers/metrics.go | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/staging/src/k8s.io/component-base/metrics/prometheus/controllers/metrics.go b/staging/src/k8s.io/component-base/metrics/prometheus/controllers/metrics.go index dcf13e1add8..afa692bb196 100644 --- a/staging/src/k8s.io/component-base/metrics/prometheus/controllers/metrics.go +++ b/staging/src/k8s.io/component-base/metrics/prometheus/controllers/metrics.go @@ -35,11 +35,11 @@ type ControllerMetrics struct { func newControllerMetrics() *ControllerMetrics { controllerInstanceCount := k8smetrics.NewGaugeVec( &k8smetrics.GaugeOpts{ - Name: "managed_controller_instance_count", + Name: "managed_controller_instances", Help: "Instances of individual controllers currently running", StabilityLevel: k8smetrics.ALPHA, }, - []string{"controller_name", "controller_manager"}, + []string{"name", "manager"}, ) legacyregistry.MustRegister(controllerInstanceCount) return &ControllerMetrics{ @@ -50,11 +50,11 @@ func newControllerMetrics() *ControllerMetrics { // ControllerStarted sets the controllerInstanceCount to 1. // 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. -func (a *ControllerMetrics) ControllerStarted(controllerName string, controllerManager string) { - a.controllerInstanceCount.With(k8smetrics.Labels{"controller_name": controllerName, "controller_manager": controllerManager}).Set(float64(1)) +func (a *ControllerMetrics) ControllerStarted(name string, manager string) { + a.controllerInstanceCount.With(k8smetrics.Labels{"name": name, "manager": manager}).Set(float64(1)) } // ControllerStopped sets the controllerInstanceCount to 0. -func (a *ControllerMetrics) ControllerStopped(controllerName string, controllerManager string) { - a.controllerInstanceCount.With(k8smetrics.Labels{"controller_name": controllerName, "controller_manager": controllerManager}).Set(float64(0)) +func (a *ControllerMetrics) ControllerStopped(name string, manager string) { + a.controllerInstanceCount.With(k8smetrics.Labels{"name": name, "manager": manager}).Set(float64(0)) }