@@ -50,22 +50,6 @@ type (
5050 // - "milliseconds"
5151 // - "bytes"
5252 PerUnitHistogramBoundaries map [string ][]float64 `yaml:"perUnitHistogramBoundaries"`
53-
54- // Following configs are added for backwards compatibility when switching from tally to opentelemetry
55- // All configs should be set to true when using opentelemetry framework to have the same behavior as tally.
56-
57- // WithoutUnitSuffix controls the additional of unit suffixes to metric names.
58- // This config only takes effect when using opentelemetry framework.
59- // Note: this config only takes effect when using prometheus via opentelemetry framework
60- WithoutUnitSuffix bool `yaml:"withoutUnitSuffix"`
61- // WithoutCounterSuffix controls the additional of _total suffixes to counter metric names.
62- // This config only takes effect when using opentelemetry framework.
63- // Note: this config only takes effect when using prometheus via opentelemetry framework
64- WithoutCounterSuffix bool `yaml:"withoutCounterSuffix"`
65- // RecordTimerInSeconds controls if Timer metric should be emitted as number of seconds
66- // (instead of milliseconds).
67- // This config only takes effect when using opentelemetry framework for both statsd and prometheus.
68- RecordTimerInSeconds bool `yaml:"recordTimerInSeconds"`
6953 }
7054
7155 // StatsdConfig contains the config items for statsd metrics reporter
@@ -143,6 +127,20 @@ type (
143127 // specify which characters are valid and/or should be replaced before metrics
144128 // are emitted.
145129 SanitizeOptions * SanitizeOptions `yaml:"sanitizeOptions"`
130+
131+ // Following configs are added for backwards compatibility when switching from tally to opentelemetry
132+ // All configs should be set to true when using opentelemetry framework to have the same behavior as tally.
133+
134+ // WithoutUnitSuffix controls the addition of unit suffixes to metric names.
135+ // This config only takes effect when using prometheus via opentelemetry framework.
136+ WithoutUnitSuffix bool `yaml:"withoutUnitSuffix"`
137+ // WithoutCounterSuffix controls the additional of _total suffixes to counter metric names.
138+ // This config only takes effect when using prometheus via opentelemetry framework.
139+ WithoutCounterSuffix bool `yaml:"withoutCounterSuffix"`
140+ // RecordTimerInSeconds controls if Timer metric should be emitted as number of seconds
141+ // (instead of milliseconds).
142+ // This config only takes effect when using prometheus via opentelemetry framework.
143+ RecordTimerInSeconds bool `yaml:"recordTimerInSeconds"`
146144 }
147145)
148146
@@ -463,23 +461,23 @@ func MetricsHandlerFromConfig(logger log.Logger, c *Config) (Handler, error) {
463461
464462 setDefaultPerUnitHistogramBoundaries (& c .ClientConfig )
465463
466- fatalOnListenerError := true
467464 if c .Statsd != nil && c .Statsd .Framework == FrameworkOpentelemetry {
468465 // create opentelemetry provider with just statsd
469466 otelProvider , err := NewOpenTelemetryProviderWithStatsd (logger , c .Statsd , & c .ClientConfig )
470467 if err != nil {
471468 logger .Fatal (err .Error ())
472469 }
473- return NewOtelMetricsHandler (logger , otelProvider , c .ClientConfig )
470+ return NewOtelMetricsHandler (logger , otelProvider , c .ClientConfig , false )
474471 }
475472
476473 if c .Prometheus != nil && c .Prometheus .Framework == FrameworkOpentelemetry {
477474 // create opentelemetry provider with just prometheus
475+ fatalOnListenerError := true
478476 otelProvider , err := NewOpenTelemetryProviderWithPrometheus (logger , c .Prometheus , & c .ClientConfig , fatalOnListenerError )
479477 if err != nil {
480478 logger .Fatal (err .Error ())
481479 }
482- return NewOtelMetricsHandler (logger , otelProvider , c .ClientConfig )
480+ return NewOtelMetricsHandler (logger , otelProvider , c .ClientConfig , c . Prometheus . RecordTimerInSeconds )
483481 }
484482
485483 // fallback to tally if no framework is specified
0 commit comments