From acaae1614e2e6ac13e9ec8a8b05d71c8c37ea540 Mon Sep 17 00:00:00 2001 From: Jay Yu <103467857+jayy04@users.noreply.github.com> Date: Tue, 10 Oct 2023 16:14:40 -0400 Subject: [PATCH] Remove in memory sink from fanout and add latency sampling methods --- telemetry/metrics.go | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/telemetry/metrics.go b/telemetry/metrics.go index 690acf41d9c3..8aa7dfdd258b 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 }