From 79844fd704eb6fd873760503ba57cc9c6bae65d5 Mon Sep 17 00:00:00 2001 From: Jeremy Breiding Date: Fri, 17 Jun 2022 15:30:18 -0700 Subject: [PATCH] use correct scope constructor (#3005) --- common/metrics/config.go | 30 +++++++++--------------------- 1 file changed, 9 insertions(+), 21 deletions(-) diff --git a/common/metrics/config.go b/common/metrics/config.go index 70bae96c766..b3722243fbc 100644 --- a/common/metrics/config.go +++ b/common/metrics/config.go @@ -254,7 +254,7 @@ var ( // only one of them will be used for reporting. // // Current priority order is: -// m3 > statsd > prometheus +// statsd > prometheus func NewScope(logger log.Logger, c *Config) tally.Scope { if c.Statsd != nil { return newStatsdScope(logger, c) @@ -386,31 +386,19 @@ func MetricsHandlerFromConfig(logger log.Logger, c *Config) MetricsHandler { } setDefaultPerUnitHistogramBoundaries(&c.ClientConfig) - if c.Prometheus != nil { - switch c.Prometheus.Framework { - case FrameworkOpentelemetry: - otelProvider, err := NewOpenTelemetryProvider(logger, c.Prometheus, &c.ClientConfig) - if err != nil { - logger.Fatal(err.Error()) - } - - return NewOtelMetricsHandler(logger, otelProvider, c.ClientConfig) - case FrameworkTally: - default: - return NewTallyMetricsHandler( - c.ClientConfig, - newPrometheusScope( - logger, - convertPrometheusConfigToTally(c.Prometheus), - &c.ClientConfig, - ), - ) + + if c.Prometheus != nil && c.Prometheus.Framework == FrameworkOpentelemetry { + otelProvider, err := NewOpenTelemetryProvider(logger, c.Prometheus, &c.ClientConfig) + if err != nil { + logger.Fatal(err.Error()) } + + return NewOtelMetricsHandler(logger, otelProvider, c.ClientConfig) } return NewTallyMetricsHandler( c.ClientConfig, - newStatsdScope(logger, c), + NewScope(logger, c), ) }