mirror of
https://github.com/grafana/grafana.git
synced 2025-09-22 19:23:21 +08:00
Metrics: Export multi registry (#97662)
* export multi registry * fixup
This commit is contained in:
@ -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,
|
||||
}
|
||||
|
@ -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) {
|
||||
|
Reference in New Issue
Block a user