Skip to content

Commit

Permalink
⚠️ Remove duplicate QueueLength metric
Browse files Browse the repository at this point in the history
The QueueLength metric is now a duplicate of the workqueue "depth"
metric, so it's no longer needed.
  • Loading branch information
DirectXMan12 committed Jan 10, 2019
1 parent b3610e8 commit ed6a18c
Show file tree
Hide file tree
Showing 3 changed files with 1 addition and 26 deletions.
1 change: 0 additions & 1 deletion pkg/internal/controller/controller.go
Original file line number Diff line number Diff line change
Expand Up @@ -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())
}
18 changes: 1 addition & 17 deletions pkg/internal/controller/controller_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand All @@ -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 {
Expand Down
8 changes: 0 additions & 8 deletions pkg/internal/controller/metrics/metrics.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -55,7 +48,6 @@ var (

func init() {
metrics.Registry.MustRegister(
QueueLength,
ReconcileTotal,
ReconcileErrors,
ReconcileTime,
Expand Down

0 comments on commit ed6a18c

Please sign in to comment.