Skip to content

Commit ed6a18c

Browse files
committed
⚠️ Remove duplicate QueueLength metric
The QueueLength metric is now a duplicate of the workqueue "depth" metric, so it's no longer needed.
1 parent b3610e8 commit ed6a18c

File tree

3 files changed

+1
-26
lines changed

3 files changed

+1
-26
lines changed

pkg/internal/controller/controller.go

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -248,6 +248,5 @@ func (c *Controller) InjectFunc(f inject.Func) error {
248248

249249
// updateMetrics updates prometheus metrics within the controller
250250
func (c *Controller) updateMetrics(reconcileTime time.Duration) {
251-
ctrlmetrics.QueueLength.WithLabelValues(c.Name).Set(float64(c.Queue.Len()))
252251
ctrlmetrics.ReconcileTime.WithLabelValues(c.Name).Observe(reconcileTime.Seconds())
253252
}

pkg/internal/controller/controller_test.go

Lines changed: 1 addition & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -533,16 +533,7 @@ var _ = Describe("controller", func() {
533533

534534
Context("should update prometheus metrics", func() {
535535
It("should requeue a Request if there is an error and continue processing items", func(done Done) {
536-
var queueLength, reconcileErrs dto.Metric
537-
ctrlmetrics.QueueLength.Reset()
538-
Expect(func() error {
539-
ctrlmetrics.QueueLength.WithLabelValues(ctrl.Name).Write(&queueLength)
540-
if queueLength.GetGauge().GetValue() != 0.0 {
541-
return fmt.Errorf("metric queue length not reset")
542-
}
543-
return nil
544-
}()).Should(Succeed())
545-
536+
var reconcileErrs dto.Metric
546537
ctrlmetrics.ReconcileErrors.Reset()
547538
Expect(func() error {
548539
ctrlmetrics.ReconcileErrors.WithLabelValues(ctrl.Name).Write(&reconcileErrs)
@@ -564,13 +555,6 @@ var _ = Describe("controller", func() {
564555

565556
By("Invoking Reconciler which will give an error")
566557
Expect(<-reconciled).To(Equal(request))
567-
Eventually(func() error {
568-
ctrlmetrics.QueueLength.WithLabelValues(ctrl.Name).Write(&queueLength)
569-
if queueLength.GetGauge().GetValue() != 1.0 {
570-
return fmt.Errorf("metric queue length not updated")
571-
}
572-
return nil
573-
}, 2.0).Should(Succeed())
574558
Eventually(func() error {
575559
ctrlmetrics.ReconcileErrors.WithLabelValues(ctrl.Name).Write(&reconcileErrs)
576560
if reconcileErrs.GetCounter().GetValue() != 1.0 {

pkg/internal/controller/metrics/metrics.go

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -22,13 +22,6 @@ import (
2222
)
2323

2424
var (
25-
// QueueLength is a prometheus metric which counts the current reconcile
26-
// queue length per controller
27-
QueueLength = prometheus.NewGaugeVec(prometheus.GaugeOpts{
28-
Name: "controller_runtime_reconcile_queue_length",
29-
Help: "Length of reconcile queue per controller",
30-
}, []string{"controller"})
31-
3225
// ReconcileTotal is a prometheus counter metrics which holds the total
3326
// number of reconciliations per controller. It has two labels. controller label refers
3427
// to the controller name and result label refers to the reconcile result i.e
@@ -55,7 +48,6 @@ var (
5548

5649
func init() {
5750
metrics.Registry.MustRegister(
58-
QueueLength,
5951
ReconcileTotal,
6052
ReconcileErrors,
6153
ReconcileTime,

0 commit comments

Comments
 (0)