From d85353926dd992438a060dd8ebbff07931f73a38 Mon Sep 17 00:00:00 2001 From: Will Browne Date: Thu, 12 Dec 2024 09:48:27 +0000 Subject: [PATCH] Metrics: Export multi registry (#97662) * export multi registry * fixup --- pkg/infra/metrics/service.go | 4 ++-- pkg/infra/metrics/service_test.go | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/pkg/infra/metrics/service.go b/pkg/infra/metrics/service.go index 6b7f1d2354f..3a964dfc58f 100644 --- a/pkg/infra/metrics/service.go +++ b/pkg/infra/metrics/service.go @@ -66,7 +66,7 @@ func ProvideRegisterer() prometheus.Registerer { func ProvideGatherer() prometheus.Gatherer { k8sGatherer := newAddPrefixWrapper(legacyregistry.DefaultGatherer) - return newMultiRegistry(k8sGatherer, prometheus.DefaultGatherer) + return NewMultiRegistry(k8sGatherer, prometheus.DefaultGatherer) } func ProvideRegistererForTest() prometheus.Registerer { @@ -125,7 +125,7 @@ type multiRegistry struct { gatherers []prometheus.Gatherer } -func newMultiRegistry(gatherers ...prometheus.Gatherer) *multiRegistry { +func NewMultiRegistry(gatherers ...prometheus.Gatherer) *multiRegistry { return &multiRegistry{ gatherers: gatherers, } diff --git a/pkg/infra/metrics/service_test.go b/pkg/infra/metrics/service_test.go index af489a23965..6d32dde6480 100644 --- a/pkg/infra/metrics/service_test.go +++ b/pkg/infra/metrics/service_test.go @@ -51,7 +51,7 @@ func TestGathererPrefixWrapper_Gather(t *testing.T) { func TestMultiRegistry_Gather(t *testing.T) { one := &mockGatherer{} two := &mockGatherer{} - g := newMultiRegistry(one, two) + g := NewMultiRegistry(one, two) t.Run("should merge and sort metrics", func(t *testing.T) { one.GatherFunc = func() ([]*dto.MetricFamily, error) {