From 4c17676f29f1cd46d6901b51427fc05ce4e3133b Mon Sep 17 00:00:00 2001 From: Solly Ross Date: Tue, 4 Dec 2018 14:06:18 -0800 Subject: [PATCH] :warning: Remove duplicate QueueLength metric The QueueLength metric is now a duplicate of the workqueue "depth" metric, so it's no longer needed. --- pkg/internal/controller/controller.go | 1 - pkg/internal/controller/controller_test.go | 18 +----------------- pkg/internal/controller/metrics/metrics.go | 7 ------- 3 files changed, 1 insertion(+), 25 deletions(-) diff --git a/pkg/internal/controller/controller.go b/pkg/internal/controller/controller.go index 10db6c245f..9088d00935 100644 --- a/pkg/internal/controller/controller.go +++ b/pkg/internal/controller/controller.go @@ -243,6 +243,5 @@ func (c *Controller) InjectFunc(f inject.Func) error { // updateMetrics updates prometheus metrics within the controller func (c *Controller) updateMetrics(reconcileTime time.Duration) { - ctrlmetrics.QueueLength.WithLabelValues(c.Name).Set(float64(c.Queue.Len())) ctrlmetrics.ReconcileTime.WithLabelValues(c.Name).Observe(reconcileTime.Seconds()) } diff --git a/pkg/internal/controller/controller_test.go b/pkg/internal/controller/controller_test.go index 893f7ee937..587a5a70cf 100644 --- a/pkg/internal/controller/controller_test.go +++ b/pkg/internal/controller/controller_test.go @@ -410,16 +410,7 @@ var _ = Describe("controller", func() { Context("should update prometheus metrics", func() { It("should requeue a Request if there is an error and continue processing items", func(done Done) { - var queueLength, reconcileErrs dto.Metric - ctrlmetrics.QueueLength.Reset() - Expect(func() error { - ctrlmetrics.QueueLength.WithLabelValues(ctrl.Name).Write(&queueLength) - if queueLength.GetGauge().GetValue() != 0.0 { - return fmt.Errorf("metrics not reset") - } - return nil - }()).Should(Succeed()) - + var reconcileErrs dto.Metric ctrlmetrics.ReconcileErrors.Reset() Expect(func() error { ctrlmetrics.ReconcileErrors.WithLabelValues(ctrl.Name).Write(&reconcileErrs) @@ -441,13 +432,6 @@ var _ = Describe("controller", func() { By("Invoking Reconciler which will give an error") Expect(<-reconciled).To(Equal(request)) - Eventually(func() error { - ctrlmetrics.QueueLength.WithLabelValues(ctrl.Name).Write(&queueLength) - if queueLength.GetGauge().GetValue() != 1.0 { - return fmt.Errorf("metrics not updated") - } - return nil - }, 2.0).Should(Succeed()) Eventually(func() error { ctrlmetrics.ReconcileErrors.WithLabelValues(ctrl.Name).Write(&reconcileErrs) if reconcileErrs.GetCounter().GetValue() != 1.0 { diff --git a/pkg/internal/controller/metrics/metrics.go b/pkg/internal/controller/metrics/metrics.go index 944ca8e035..d6756d6f66 100644 --- a/pkg/internal/controller/metrics/metrics.go +++ b/pkg/internal/controller/metrics/metrics.go @@ -22,13 +22,6 @@ import ( ) var ( - // QueueLength is a prometheus metric which counts the current reconcile - // queue length per controller - QueueLength = prometheus.NewGaugeVec(prometheus.GaugeOpts{ - Name: "controller_runtime_reconcile_queue_length", - Help: "Length of reconcile queue per controller", - }, []string{"controller"}) - // ReconcileErrors is a prometheus counter metrics which holds the total // number of errors from the Reconciler ReconcileErrors = prometheus.NewCounterVec(prometheus.CounterOpts{