Metrics: Export multi registry (#97662)

* export multi registry

* fixup
This commit is contained in:
Will Browne
2024-12-12 09:48:27 +00:00
committed by GitHub
parent 7ad004236e
commit d85353926d
2 changed files with 3 additions and 3 deletions

View File

@ -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,
}

View File

@ -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) {