From 5554a40c5302e5386e9ee8449a12252573e1af24 Mon Sep 17 00:00:00 2001 From: Evan Culver Date: Thu, 19 May 2022 19:17:30 -0700 Subject: [PATCH] telemetry: remove unused arg (#13161) --- lib/telemetry.go | 7 +++---- lib/telemetry_test.go | 4 ++-- 2 files changed, 5 insertions(+), 6 deletions(-) diff --git a/lib/telemetry.go b/lib/telemetry.go index 6183c6fac..2a90fe79e 100644 --- a/lib/telemetry.go +++ b/lib/telemetry.go @@ -317,7 +317,7 @@ func circonusSink(cfg TelemetryConfig, hostname string) (metrics.MetricSink, err return sink, nil } -func configureSinks(cfg TelemetryConfig, hostName string, memSink metrics.MetricSink) (metrics.FanoutSink, error) { +func configureSinks(cfg TelemetryConfig, memSink metrics.MetricSink) (metrics.FanoutSink, error) { metricsConf := metrics.DefaultConfig(cfg.MetricsPrefix) metricsConf.EnableHostname = !cfg.DisableHostname metricsConf.FilterDefault = cfg.FilterDefault @@ -365,7 +365,6 @@ func InitTelemetry(cfg TelemetryConfig, logger hclog.Logger) (*MetricsConfig, er memSink := metrics.NewInmemSink(10*time.Second, time.Minute) metrics.DefaultInmemSignal(memSink) - metricsConf := metrics.DefaultConfig(cfg.MetricsPrefix) metricsConfig := &MetricsConfig{ Handler: memSink, @@ -379,7 +378,7 @@ func InitTelemetry(cfg TelemetryConfig, logger hclog.Logger) (*MetricsConfig, er } for { logger.Warn("retrying configure metric sinks", "retries", waiter.Failures()) - _, err := configureSinks(cfg, metricsConf.HostName, memSink) + _, err := configureSinks(cfg, memSink) if err == nil { logger.Info("successfully configured metrics sinks") return @@ -392,7 +391,7 @@ func InitTelemetry(cfg TelemetryConfig, logger hclog.Logger) (*MetricsConfig, er } } - if _, errs := configureSinks(cfg, metricsConf.HostName, memSink); errs != nil { + if _, errs := configureSinks(cfg, memSink); errs != nil { if isRetriableError(errs) && cfg.RetryFailedConfiguration { logger.Warn("failed configure sinks", "error", multierror.Flatten(errs)) ctx, cancel = context.WithCancel(context.Background()) diff --git a/lib/telemetry_test.go b/lib/telemetry_test.go index 8f0ec176d..6a29788fd 100644 --- a/lib/telemetry_test.go +++ b/lib/telemetry_test.go @@ -21,7 +21,7 @@ func newCfg() TelemetryConfig { func TestConfigureSinks(t *testing.T) { cfg := newCfg() - sinks, err := configureSinks(cfg, "hostname", nil) + sinks, err := configureSinks(cfg, nil) require.Error(t, err) // 3 sinks: statsd, statsite, inmem require.Equal(t, 3, len(sinks)) @@ -29,7 +29,7 @@ func TestConfigureSinks(t *testing.T) { cfg = TelemetryConfig{ DogstatsdAddr: "", } - _, err = configureSinks(cfg, "hostname", nil) + _, err = configureSinks(cfg, nil) require.NoError(t, err) }