From ed6a18c56c684f4320b012d6b7bb9fe93d6771cd Mon Sep 17 00:00:00 2001 From: Solly Ross Date: Thu, 10 Jan 2019 14:05:45 -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 | 8 -------- 3 files changed, 1 insertion(+), 26 deletions(-) diff --git a/pkg/internal/controller/controller.go b/pkg/internal/controller/controller.go index 6a44ea9fc3..f97bdd7cda 100644 --- a/pkg/internal/controller/controller.go +++ b/pkg/internal/controller/controller.go @@ -248,6 +248,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 bc83d4f84b..0faa12c3f6 100644 --- a/pkg/internal/controller/controller_test.go +++ b/pkg/internal/controller/controller_test.go @@ -533,16 +533,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("metric queue length not reset") - } - return nil - }()).Should(Succeed()) - + var reconcileErrs dto.Metric ctrlmetrics.ReconcileErrors.Reset() Expect(func() error { ctrlmetrics.ReconcileErrors.WithLabelValues(ctrl.Name).Write(&reconcileErrs) @@ -564,13 +555,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("metric queue length 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 1411a8d846..53c0bb332c 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"}) - // ReconcileTotal is a prometheus counter metrics which holds the total // number of reconciliations per controller. It has two labels. controller label refers // to the controller name and result label refers to the reconcile result i.e @@ -55,7 +48,6 @@ var ( func init() { metrics.Registry.MustRegister( - QueueLength, ReconcileTotal, ReconcileErrors, ReconcileTime,