mirror of
https://github.com/grafana/grafana.git
synced 2025-02-25 18:55:37 -06:00
Metrics: Use correct gatherer in graphite bridge (#100624)
This commit is contained in:
parent
527fc3bb21
commit
5a74a1a0f6
@ -26,12 +26,13 @@ func (lw *logWrapper) Println(v ...any) {
|
||||
lw.logger.Info("graphite metric bridge", v...)
|
||||
}
|
||||
|
||||
func ProvideService(cfg *setting.Cfg, reg prometheus.Registerer) (*InternalMetricsService, error) {
|
||||
func ProvideService(cfg *setting.Cfg, reg prometheus.Registerer, gatherer prometheus.Gatherer) (*InternalMetricsService, error) {
|
||||
initMetricVars(reg)
|
||||
initFrontendMetrics(reg)
|
||||
|
||||
s := &InternalMetricsService{
|
||||
Cfg: cfg,
|
||||
Cfg: cfg,
|
||||
gatherer: gatherer,
|
||||
}
|
||||
return s, s.readSettings()
|
||||
}
|
||||
@ -41,6 +42,7 @@ type InternalMetricsService struct {
|
||||
|
||||
intervalSeconds int64
|
||||
graphiteCfg *graphitebridge.Config
|
||||
gatherer prometheus.Gatherer
|
||||
}
|
||||
|
||||
func (im *InternalMetricsService) Run(ctx context.Context) error {
|
||||
|
@ -5,8 +5,6 @@ import (
|
||||
"strings"
|
||||
"time"
|
||||
|
||||
"github.com/prometheus/client_golang/prometheus"
|
||||
|
||||
"github.com/grafana/grafana/pkg/infra/metrics/graphitebridge"
|
||||
)
|
||||
|
||||
@ -40,7 +38,7 @@ func (im *InternalMetricsService) parseGraphiteSettings() error {
|
||||
URL: address,
|
||||
Prefix: graphiteSection.Key("prefix").MustString("prod.grafana.%(instance_name)s"),
|
||||
CountersAsDelta: true,
|
||||
Gatherer: prometheus.DefaultGatherer,
|
||||
Gatherer: im.gatherer,
|
||||
Interval: time.Duration(im.intervalSeconds) * time.Second,
|
||||
Timeout: 10 * time.Second,
|
||||
Logger: &logWrapper{logger: metricsLogger},
|
||||
|
Loading…
Reference in New Issue
Block a user