diff --git a/telemetry/metrics.go b/telemetry/metrics.go index a0cb15b11fa1..40914ccdb494 100644 --- a/telemetry/metrics.go +++ b/telemetry/metrics.go @@ -98,7 +98,7 @@ func New(cfg Config) (_ *Metrics, rerr error) { }() m := &Metrics{memSink: memSink} - fanout := metrics.FanoutSink{memSink} + var sink metrics.MetricSink if cfg.PrometheusRetentionTime > 0 { m.prometheusEnabled = true @@ -111,10 +111,12 @@ func New(cfg Config) (_ *Metrics, rerr error) { return nil, err } - fanout = append(fanout, promSink) + sink = promSink + } else { + sink = memSink } - if _, err := metrics.NewGlobal(metricsConf, fanout); err != nil { + if _, err := metrics.NewGlobal(metricsConf, sink); err != nil { return nil, err }