Skip to content

Commit 09a967f

Browse files
Expose controller-runtime metrics externally
1 parent 0f7927c commit 09a967f

File tree

4 files changed

+47
-42
lines changed

4 files changed

+47
-42
lines changed

go.mod

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,8 +12,7 @@ require (
1212
github.com/google/gofuzz v1.2.0
1313
github.com/onsi/ginkgo/v2 v2.22.0
1414
github.com/onsi/gomega v1.36.1
15-
github.com/prometheus/client_golang v1.19.1
16-
github.com/prometheus/client_model v0.6.1
15+
github.com/prometheus/client_golang v1.20.5
1716
go.uber.org/goleak v1.3.0
1817
go.uber.org/zap v1.27.0
1918
golang.org/x/mod v0.21.0
@@ -31,6 +30,8 @@ require (
3130
sigs.k8s.io/yaml v1.4.0
3231
)
3332

33+
require github.com/awslabs/operatorpkg v0.0.0-20241108234832-dacc8b988e70
34+
3435
require (
3536
cel.dev/expr v0.18.0 // indirect
3637
github.com/antlr4-go/antlr/v4 v4.13.0 // indirect
@@ -58,13 +59,16 @@ require (
5859
github.com/inconshreveable/mousetrap v1.1.0 // indirect
5960
github.com/josharian/intern v1.0.0 // indirect
6061
github.com/json-iterator/go v1.1.12 // indirect
62+
github.com/klauspost/compress v1.17.9 // indirect
63+
github.com/kylelemons/godebug v1.1.0 // indirect
6164
github.com/mailru/easyjson v0.7.7 // indirect
6265
github.com/modern-go/concurrent v0.0.0-20180306012644-bacd9c7ef1dd // indirect
6366
github.com/modern-go/reflect2 v1.0.2 // indirect
6467
github.com/munnerz/goautoneg v0.0.0-20191010083416-a7dc8b61c822 // indirect
6568
github.com/pkg/errors v0.9.1 // indirect
6669
github.com/prometheus/common v0.55.0 // indirect
6770
github.com/prometheus/procfs v0.15.1 // indirect
71+
github.com/samber/lo v1.47.0 // indirect
6872
github.com/spf13/cobra v1.8.1 // indirect
6973
github.com/spf13/pflag v1.0.5 // indirect
7074
github.com/stoewer/go-strcase v1.3.0 // indirect

go.sum

Lines changed: 12 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,8 @@ github.com/antlr4-go/antlr/v4 v4.13.0 h1:lxCg3LAv+EUK6t1i0y1V6/SLeUi0eKEKdhQAlS8
44
github.com/antlr4-go/antlr/v4 v4.13.0/go.mod h1:pfChB/xh/Unjila75QW7+VU4TSnWnnk9UTnmpPaOR2g=
55
github.com/asaskevich/govalidator v0.0.0-20190424111038-f61b66f89f4a h1:idn718Q4B6AGu/h5Sxe66HYVdqdGu2l9Iebqhi/AEoA=
66
github.com/asaskevich/govalidator v0.0.0-20190424111038-f61b66f89f4a/go.mod h1:lB+ZfQJz7igIIfQNfa7Ml4HSf2uFQQRzpGGRXenZAgY=
7+
github.com/awslabs/operatorpkg v0.0.0-20241108234832-dacc8b988e70 h1:VeYzU8sJEzx/raHd1+c74PgPrI+uxsHlW55CinIgln4=
8+
github.com/awslabs/operatorpkg v0.0.0-20241108234832-dacc8b988e70/go.mod h1:nq1PLBLCojzjfqSK8SG3ymxqwW6e/cHLJvddKOSFkfw=
79
github.com/beorn7/perks v1.0.1 h1:VlbKKnNfV8bJzeqoa4cOKqO6bYr3WgKZxO8Z16+hsOM=
810
github.com/beorn7/perks v1.0.1/go.mod h1:G2ZrVWU2WbWT9wwq4/hrbKbnv/1ERSJQ0ibhJ6rlkpw=
911
github.com/blang/semver/v4 v4.0.0 h1:1PFHFE6yCCTv8C1TeyNNarDzntLi7wMI5i/pzqYIsAM=
@@ -20,8 +22,8 @@ github.com/davecgh/go-spew v1.1.2-0.20180830191138-d8f796af33cc h1:U9qPSI2PIWSS1
2022
github.com/davecgh/go-spew v1.1.2-0.20180830191138-d8f796af33cc/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
2123
github.com/emicklei/go-restful/v3 v3.11.0 h1:rAQeMHw1c7zTmncogyy8VvRZwtkmkZ4FxERmMY4rD+g=
2224
github.com/emicklei/go-restful/v3 v3.11.0/go.mod h1:6n3XBCmQQb25CM2LCACGz8ukIrRry+4bhvbpWn3mrbc=
23-
github.com/evanphx/json-patch v0.5.2 h1:xVCHIVMUu1wtM/VkR9jVZ45N3FhZfYMMYGorLCR8P3k=
24-
github.com/evanphx/json-patch v0.5.2/go.mod h1:ZWS5hhDbVDyob71nXKNL0+PWn6ToqBHMikGIFbs31qQ=
25+
github.com/evanphx/json-patch v5.6.0+incompatible h1:jBYDEEiFBPxA0v50tFdvOzQQTCvpL6mnFh5mB2/l16U=
26+
github.com/evanphx/json-patch v5.6.0+incompatible/go.mod h1:50XU6AFN0ol/bzJsmQLiYLvXMP4fmwYFNcr97nuDLSk=
2527
github.com/evanphx/json-patch/v5 v5.9.11 h1:/8HVnzMq13/3x9TPvjG08wUGqBTmZBsCWzjTM0wiaDU=
2628
github.com/evanphx/json-patch/v5 v5.9.11/go.mod h1:3j+LviiESTElxA4p3EMKAB9HXj3/XEtnUf6OZxqIQTM=
2729
github.com/felixge/httpsnoop v1.0.4 h1:NFTV2Zj1bL4mc9sqWACXbQFVBBg2W3GPvqp8/ESS2Wg=
@@ -77,13 +79,17 @@ github.com/json-iterator/go v1.1.12 h1:PV8peI4a0ysnczrg+LtxykD8LfKY9ML6u2jnxaEnr
7779
github.com/json-iterator/go v1.1.12/go.mod h1:e30LSqwooZae/UwlEbR2852Gd8hjQvJoHmT4TnhNGBo=
7880
github.com/kisielk/errcheck v1.5.0/go.mod h1:pFxgyoBC7bSaBwPgfKdkLd5X25qrDl4LWUI2bnpBCr8=
7981
github.com/kisielk/gotool v1.0.0/go.mod h1:XhKaO+MFFWcvkIS/tQcRk01m1F5IRFswLeQ+oQHNcck=
82+
github.com/klauspost/compress v1.17.9 h1:6KIumPrER1LHsvBVuDa0r5xaG0Es51mhhB9BQB2qeMA=
83+
github.com/klauspost/compress v1.17.9/go.mod h1:Di0epgTjJY877eYKx5yC51cX2A2Vl2ibi7bDH9ttBbw=
8084
github.com/kr/pretty v0.2.1/go.mod h1:ipq/a2n7PKx3OHsz4KJII5eveXtPO4qwEXGdVfWzfnI=
8185
github.com/kr/pretty v0.3.1 h1:flRD4NNwYAUpkphVc1HcthR4KEIFJ65n8Mw5qdRn3LE=
8286
github.com/kr/pretty v0.3.1/go.mod h1:hoEshYVHaxMs3cyo3Yncou5ZscifuDolrwPKZanG3xk=
8387
github.com/kr/pty v1.1.1/go.mod h1:pFQYn66WHrOpPYNljwOMqo10TkYh1fy3cYio2l3bCsQ=
8488
github.com/kr/text v0.1.0/go.mod h1:4Jbv+DJW3UT/LiOwJeYQe1efqtUx/iVham/4vfdArNI=
8589
github.com/kr/text v0.2.0 h1:5Nx0Ya0ZqY2ygV366QzturHI13Jq95ApcVaJBhpS+AY=
8690
github.com/kr/text v0.2.0/go.mod h1:eLer722TekiGuMkidMxC/pM04lWEeraHUUmBw8l2grE=
91+
github.com/kylelemons/godebug v1.1.0 h1:RPNrshWIDI6G2gRW9EHilWtl7Z6Sb1BR0xunSBf0SNc=
92+
github.com/kylelemons/godebug v1.1.0/go.mod h1:9/0rRGxNHcop5bhtWyNeEfOS8JIWk580+fNqagV/RAw=
8793
github.com/mailru/easyjson v0.7.7 h1:UGYAvKxe3sBsEDzO8ZeWOSlIQfWFlxbzLZe7hwFURr0=
8894
github.com/mailru/easyjson v0.7.7/go.mod h1:xzfreul335JAWq5oZzymOObrkdz5UnU4kGfJJLY9Nlc=
8995
github.com/modern-go/concurrent v0.0.0-20180228061459-e0a39a4cb421/go.mod h1:6dJC0mAP4ikYIbvyc7fijjWJddQyLn8Ig3JB5CqoB9Q=
@@ -102,8 +108,8 @@ github.com/pkg/errors v0.9.1/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINE
102108
github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4=
103109
github.com/pmezard/go-difflib v1.0.1-0.20181226105442-5d4384ee4fb2 h1:Jamvg5psRIccs7FGNTlIRMkT8wgtp5eCXdBlqhYGL6U=
104110
github.com/pmezard/go-difflib v1.0.1-0.20181226105442-5d4384ee4fb2/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4=
105-
github.com/prometheus/client_golang v1.19.1 h1:wZWJDwK+NameRJuPGDhlnFgx8e8HN3XHQeLaYJFJBOE=
106-
github.com/prometheus/client_golang v1.19.1/go.mod h1:mP78NwGzrVks5S2H6ab8+ZZGJLZUq1hoULYBAYBw1Ho=
111+
github.com/prometheus/client_golang v1.20.5 h1:cxppBPuYhUnsO6yo/aoRol4L7q7UFfdm+bR9r+8l63Y=
112+
github.com/prometheus/client_golang v1.20.5/go.mod h1:PIEt8X02hGcP8JWbeHyeZ53Y/jReSnHgO035n//V5WE=
107113
github.com/prometheus/client_model v0.6.1 h1:ZKSh/rekM+n3CeS952MLRAdFwIKqeY8b62p8ais2e9E=
108114
github.com/prometheus/client_model v0.6.1/go.mod h1:OrxVMOVHjw3lKMa8+x6HeMGkHMQyHDk9E3jmP2AmGiY=
109115
github.com/prometheus/common v0.55.0 h1:KEi6DK7lXW/m7Ig5i47x0vRzuBsHuvJdi5ee6Y3G1dc=
@@ -113,6 +119,8 @@ github.com/prometheus/procfs v0.15.1/go.mod h1:fB45yRUv8NstnjriLhBQLuOUt+WW4BsoG
113119
github.com/rogpeppe/go-internal v1.12.0 h1:exVL4IDcn6na9z1rAb56Vxr+CgyK3nn3O+epU5NdKM8=
114120
github.com/rogpeppe/go-internal v1.12.0/go.mod h1:E+RYuTGaKKdloAfM02xzb0FW3Paa99yedzYV+kq4uf4=
115121
github.com/russross/blackfriday/v2 v2.1.0/go.mod h1:+Rmxgy9KzJVeS9/2gXHxylqXiyQDYRxCVz55jmeOWTM=
122+
github.com/samber/lo v1.47.0 h1:z7RynLwP5nbyRscyvcD043DWYoOcYRv3mV8lBeqOCLc=
123+
github.com/samber/lo v1.47.0/go.mod h1:RmDH9Ct32Qy3gduHQuKJ3gW1fMHAnE/fAzQuf6He5cU=
116124
github.com/spf13/cobra v1.8.1 h1:e5/vxKd/rZsfSJMUX1agtjeTDf+qv1/JdBF8gg5k9ZM=
117125
github.com/spf13/cobra v1.8.1/go.mod h1:wHxEcudfqmLYa8iTfL+OuZPbBZkmvliBWKIezN3kD9Y=
118126
github.com/spf13/pflag v1.0.5 h1:iy+VFUOCP1a+8yFto/drg2CJ5u0yRoB7fZw3DKv/JXA=

pkg/internal/controller/controller.go

Lines changed: 20 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -30,9 +30,9 @@ import (
3030
utilruntime "k8s.io/apimachinery/pkg/util/runtime"
3131
"k8s.io/apimachinery/pkg/util/uuid"
3232
"k8s.io/client-go/util/workqueue"
33+
ctrlmetrics "sigs.k8s.io/controller-runtime/pkg/metrics"
3334

3435
"sigs.k8s.io/controller-runtime/pkg/controller/priorityqueue"
35-
ctrlmetrics "sigs.k8s.io/controller-runtime/pkg/internal/controller/metrics"
3636
logf "sigs.k8s.io/controller-runtime/pkg/log"
3737
"sigs.k8s.io/controller-runtime/pkg/reconcile"
3838
"sigs.k8s.io/controller-runtime/pkg/source"
@@ -101,7 +101,7 @@ type Controller[request comparable] struct {
101101
func (c *Controller[request]) Reconcile(ctx context.Context, req request) (_ reconcile.Result, err error) {
102102
defer func() {
103103
if r := recover(); r != nil {
104-
ctrlmetrics.ReconcilePanics.WithLabelValues(c.Name).Inc()
104+
ctrlmetrics.ReconcilePanics.Inc(map[string]string{"controller": c.Name})
105105

106106
if c.RecoverPanic == nil || *c.RecoverPanic {
107107
for _, fn := range utilruntime.PanicHandlers {
@@ -288,8 +288,8 @@ func (c *Controller[request]) processNextWorkItem(ctx context.Context) bool {
288288
// period.
289289
defer c.Queue.Done(obj)
290290

291-
ctrlmetrics.ActiveWorkers.WithLabelValues(c.Name).Add(1)
292-
defer ctrlmetrics.ActiveWorkers.WithLabelValues(c.Name).Add(-1)
291+
ctrlmetrics.ActiveWorkers.Set(1, map[string]string{"controller": c.Name})
292+
defer ctrlmetrics.ActiveWorkers.Set(0, map[string]string{"controller": c.Name})
293293

294294
c.reconcileHandler(ctx, obj, priority)
295295
return true
@@ -303,15 +303,15 @@ const (
303303
)
304304

305305
func (c *Controller[request]) initMetrics() {
306-
ctrlmetrics.ReconcileTotal.WithLabelValues(c.Name, labelError).Add(0)
307-
ctrlmetrics.ReconcileTotal.WithLabelValues(c.Name, labelRequeueAfter).Add(0)
308-
ctrlmetrics.ReconcileTotal.WithLabelValues(c.Name, labelRequeue).Add(0)
309-
ctrlmetrics.ReconcileTotal.WithLabelValues(c.Name, labelSuccess).Add(0)
310-
ctrlmetrics.ReconcileErrors.WithLabelValues(c.Name).Add(0)
311-
ctrlmetrics.TerminalReconcileErrors.WithLabelValues(c.Name).Add(0)
312-
ctrlmetrics.ReconcilePanics.WithLabelValues(c.Name).Add(0)
313-
ctrlmetrics.WorkerCount.WithLabelValues(c.Name).Set(float64(c.MaxConcurrentReconciles))
314-
ctrlmetrics.ActiveWorkers.WithLabelValues(c.Name).Set(0)
306+
ctrlmetrics.ReconcileTotal.Add(0, map[string]string{"controller": c.Name, "result": labelError})
307+
ctrlmetrics.ReconcileTotal.Add(0, map[string]string{"controller": c.Name, "result": labelRequeueAfter})
308+
ctrlmetrics.ReconcileTotal.Add(0, map[string]string{"controller": c.Name, "result": labelRequeue})
309+
ctrlmetrics.ReconcileTotal.Add(0, map[string]string{"controller": c.Name, "result": labelSuccess})
310+
ctrlmetrics.ReconcileErrors.Add(0, map[string]string{"controller": c.Name})
311+
ctrlmetrics.TerminalReconcileErrors.Add(0, map[string]string{"controller": c.Name})
312+
ctrlmetrics.ReconcilePanics.Add(0, map[string]string{"controller": c.Name})
313+
ctrlmetrics.WorkerCount.Set(float64(c.MaxConcurrentReconciles), map[string]string{"controller": c.Name})
314+
ctrlmetrics.ActiveWorkers.Set(0, map[string]string{"controller": c.Name})
315315
}
316316

317317
func (c *Controller[request]) reconcileHandler(ctx context.Context, req request, priority int) {
@@ -335,12 +335,12 @@ func (c *Controller[request]) reconcileHandler(ctx context.Context, req request,
335335
switch {
336336
case err != nil:
337337
if errors.Is(err, reconcile.TerminalError(nil)) {
338-
ctrlmetrics.TerminalReconcileErrors.WithLabelValues(c.Name).Inc()
338+
ctrlmetrics.TerminalReconcileErrors.Inc(map[string]string{"controller": c.Name})
339339
} else {
340340
c.Queue.AddWithOpts(priorityqueue.AddOpts{RateLimited: true, Priority: priority}, req)
341341
}
342-
ctrlmetrics.ReconcileErrors.WithLabelValues(c.Name).Inc()
343-
ctrlmetrics.ReconcileTotal.WithLabelValues(c.Name, labelError).Inc()
342+
ctrlmetrics.ReconcileErrors.Inc(map[string]string{"controller": c.Name})
343+
ctrlmetrics.ReconcileTotal.Inc(map[string]string{"controller": c.Name, "result": labelError})
344344
if !result.IsZero() {
345345
log.Info("Warning: Reconciler returned both a non-zero result and a non-nil error. The result will always be ignored if the error is non-nil and the non-nil error causes requeuing with exponential backoff. For more details, see: https://pkg.go.dev/sigs.k8s.io/controller-runtime/pkg/reconcile#Reconciler")
346346
}
@@ -353,17 +353,17 @@ func (c *Controller[request]) reconcileHandler(ctx context.Context, req request,
353353
// to result.RequestAfter
354354
c.Queue.Forget(req)
355355
c.Queue.AddWithOpts(priorityqueue.AddOpts{After: result.RequeueAfter, Priority: priority}, req)
356-
ctrlmetrics.ReconcileTotal.WithLabelValues(c.Name, labelRequeueAfter).Inc()
356+
ctrlmetrics.ReconcileTotal.Inc(map[string]string{"controller": c.Name, "result": labelRequeueAfter})
357357
case result.Requeue:
358358
log.V(5).Info("Reconcile done, requeueing")
359359
c.Queue.AddWithOpts(priorityqueue.AddOpts{RateLimited: true, Priority: priority}, req)
360-
ctrlmetrics.ReconcileTotal.WithLabelValues(c.Name, labelRequeue).Inc()
360+
ctrlmetrics.ReconcileTotal.Inc(map[string]string{"controller": c.Name, "result": labelRequeue})
361361
default:
362362
log.V(5).Info("Reconcile successful")
363363
// Finally, if no error occurs we Forget this item so it does not
364364
// get queued again until another change happens.
365365
c.Queue.Forget(req)
366-
ctrlmetrics.ReconcileTotal.WithLabelValues(c.Name, labelSuccess).Inc()
366+
ctrlmetrics.ReconcileTotal.Inc(map[string]string{"controller": c.Name, "result": labelSuccess})
367367
}
368368
}
369369

@@ -374,7 +374,7 @@ func (c *Controller[request]) GetLogger() logr.Logger {
374374

375375
// updateMetrics updates prometheus metrics within the controller.
376376
func (c *Controller[request]) updateMetrics(reconcileTime time.Duration) {
377-
ctrlmetrics.ReconcileTime.WithLabelValues(c.Name).Observe(reconcileTime.Seconds())
377+
ctrlmetrics.ReconcileTime.Observe(reconcileTime.Seconds(), map[string]string{"controller": c.Name})
378378
}
379379

380380
// ReconcileIDFromContext gets the reconcileID from the current context.

pkg/internal/controller/metrics/metrics.go renamed to pkg/metrics/metrics.go

Lines changed: 9 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -17,45 +17,45 @@ limitations under the License.
1717
package metrics
1818

1919
import (
20+
opmetrics "github.com/awslabs/operatorpkg/metrics"
2021
"github.com/prometheus/client_golang/prometheus"
2122
"github.com/prometheus/client_golang/prometheus/collectors"
22-
"sigs.k8s.io/controller-runtime/pkg/metrics"
2323
)
2424

2525
var (
2626
// ReconcileTotal is a prometheus counter metrics which holds the total
2727
// number of reconciliations per controller. It has two labels. controller label refers
2828
// to the controller name and result label refers to the reconcile result i.e
2929
// success, error, requeue, requeue_after.
30-
ReconcileTotal = prometheus.NewCounterVec(prometheus.CounterOpts{
30+
ReconcileTotal = opmetrics.NewPrometheusCounter(Registry, prometheus.CounterOpts{
3131
Name: "controller_runtime_reconcile_total",
3232
Help: "Total number of reconciliations per controller",
3333
}, []string{"controller", "result"})
3434

3535
// ReconcileErrors is a prometheus counter metrics which holds the total
3636
// number of errors from the Reconciler.
37-
ReconcileErrors = prometheus.NewCounterVec(prometheus.CounterOpts{
37+
ReconcileErrors = opmetrics.NewPrometheusCounter(Registry, prometheus.CounterOpts{
3838
Name: "controller_runtime_reconcile_errors_total",
3939
Help: "Total number of reconciliation errors per controller",
4040
}, []string{"controller"})
4141

4242
// TerminalReconcileErrors is a prometheus counter metrics which holds the total
4343
// number of terminal errors from the Reconciler.
44-
TerminalReconcileErrors = prometheus.NewCounterVec(prometheus.CounterOpts{
44+
TerminalReconcileErrors = opmetrics.NewPrometheusCounter(Registry, prometheus.CounterOpts{
4545
Name: "controller_runtime_terminal_reconcile_errors_total",
4646
Help: "Total number of terminal reconciliation errors per controller",
4747
}, []string{"controller"})
4848

4949
// ReconcilePanics is a prometheus counter metrics which holds the total
5050
// number of panics from the Reconciler.
51-
ReconcilePanics = prometheus.NewCounterVec(prometheus.CounterOpts{
51+
ReconcilePanics = opmetrics.NewPrometheusCounter(Registry, prometheus.CounterOpts{
5252
Name: "controller_runtime_reconcile_panics_total",
5353
Help: "Total number of reconciliation panics per controller",
5454
}, []string{"controller"})
5555

5656
// ReconcileTime is a prometheus metric which keeps track of the duration
5757
// of reconciliations.
58-
ReconcileTime = prometheus.NewHistogramVec(prometheus.HistogramOpts{
58+
ReconcileTime = opmetrics.NewPrometheusHistogram(Registry, prometheus.HistogramOpts{
5959
Name: "controller_runtime_reconcile_time_seconds",
6060
Help: "Length of time per reconciliation per controller",
6161
Buckets: []float64{0.005, 0.01, 0.025, 0.05, 0.1, 0.15, 0.2, 0.25, 0.3, 0.35, 0.4, 0.45, 0.5, 0.6, 0.7, 0.8, 0.9, 1.0,
@@ -64,28 +64,21 @@ var (
6464

6565
// WorkerCount is a prometheus metric which holds the number of
6666
// concurrent reconciles per controller.
67-
WorkerCount = prometheus.NewGaugeVec(prometheus.GaugeOpts{
67+
WorkerCount = opmetrics.NewPrometheusGauge(Registry, prometheus.GaugeOpts{
6868
Name: "controller_runtime_max_concurrent_reconciles",
6969
Help: "Maximum number of concurrent reconciles per controller",
7070
}, []string{"controller"})
7171

7272
// ActiveWorkers is a prometheus metric which holds the number
7373
// of active workers per controller.
74-
ActiveWorkers = prometheus.NewGaugeVec(prometheus.GaugeOpts{
74+
ActiveWorkers = opmetrics.NewPrometheusGauge(Registry, prometheus.GaugeOpts{
7575
Name: "controller_runtime_active_workers",
7676
Help: "Number of currently used workers per controller",
7777
}, []string{"controller"})
7878
)
7979

8080
func init() {
81-
metrics.Registry.MustRegister(
82-
ReconcileTotal,
83-
ReconcileErrors,
84-
TerminalReconcileErrors,
85-
ReconcilePanics,
86-
ReconcileTime,
87-
WorkerCount,
88-
ActiveWorkers,
81+
Registry.MustRegister(
8982
// expose process metrics like CPU, Memory, file descriptor usage etc.
9083
collectors.NewProcessCollector(collectors.ProcessCollectorOpts{}),
9184
// expose Go runtime metrics like GC stats, memory stats etc.

0 commit comments

Comments
 (0)