Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Remove in memory sink from fanout and add latency sampling methods #28

Merged
merged 2 commits into from
Oct 11, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 5 additions & 3 deletions telemetry/metrics.go
Original file line number Diff line number Diff line change
Expand Up @@ -98,7 +98,7 @@ func New(cfg Config) (_ *Metrics, rerr error) {
}()

m := &Metrics{memSink: memSink}
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Don't create the fanout sink, you should be able to use a MetricSink object and either assign promSink or memSink to it.

fanout := metrics.FanoutSink{memSink}
var sink metrics.MetricSink

if cfg.PrometheusRetentionTime > 0 {
m.prometheusEnabled = true
Expand All @@ -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
}

Expand Down