Skip to content

Commit cd73474

Browse files
committed
Replace QueueLength metric with workqueue metric
The QueueLength metric is now a duplicate of the workqueue "depth" metric, so it's no longer needed.
1 parent 147d9f5 commit cd73474

File tree

3 files changed

+1
-25
lines changed

3 files changed

+1
-25
lines changed

pkg/internal/controller/controller.go

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

244244
// updateMetrics updates prometheus metrics within the controller
245245
func (c *Controller) updateMetrics(reconcileTime time.Duration) {
246-
ctrlmetrics.QueueLength.WithLabelValues(c.Name).Set(float64(c.Queue.Len()))
247246
ctrlmetrics.ReconcileTime.WithLabelValues(c.Name).Observe(reconcileTime.Seconds())
248247
}

pkg/internal/controller/controller_test.go

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

411411
Context("should update prometheus metrics", func() {
412412
It("should requeue a Request if there is an error and continue processing items", func(done Done) {
413-
var queueLength, reconcileErrs dto.Metric
414-
ctrlmetrics.QueueLength.Reset()
415-
Expect(func() error {
416-
ctrlmetrics.QueueLength.WithLabelValues(ctrl.Name).Write(&queueLength)
417-
if queueLength.GetGauge().GetValue() != 0.0 {
418-
return fmt.Errorf("metrics not reset")
419-
}
420-
return nil
421-
}()).Should(Succeed())
422-
413+
var reconcileErrs dto.Metric
423414
ctrlmetrics.ReconcileErrors.Reset()
424415
Expect(func() error {
425416
ctrlmetrics.ReconcileErrors.WithLabelValues(ctrl.Name).Write(&reconcileErrs)
@@ -441,13 +432,6 @@ var _ = Describe("controller", func() {
441432

442433
By("Invoking Reconciler which will give an error")
443434
Expect(<-reconciled).To(Equal(request))
444-
Eventually(func() error {
445-
ctrlmetrics.QueueLength.WithLabelValues(ctrl.Name).Write(&queueLength)
446-
if queueLength.GetGauge().GetValue() != 1.0 {
447-
return fmt.Errorf("metrics not updated")
448-
}
449-
return nil
450-
}, 2.0).Should(Succeed())
451435
Eventually(func() error {
452436
ctrlmetrics.ReconcileErrors.WithLabelValues(ctrl.Name).Write(&reconcileErrs)
453437
if reconcileErrs.GetCounter().GetValue() != 1.0 {

pkg/internal/controller/metrics/metrics.go

Lines changed: 0 additions & 7 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
// ReconcileErrors is a prometheus counter metrics which holds the total
3326
// number of errors from the Reconciler
3427
ReconcileErrors = prometheus.NewCounterVec(prometheus.CounterOpts{

0 commit comments

Comments
 (0)