Browse Source

telemetry: remove unused arg (#13161)

pull/13173/head
Evan Culver 3 years ago committed by GitHub
parent
commit
0378372bde
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
  1. 7
      lib/telemetry.go
  2. 4
      lib/telemetry_test.go

7
lib/telemetry.go

@ -317,7 +317,7 @@ func circonusSink(cfg TelemetryConfig, hostname string) (metrics.MetricSink, err
return sink, nil 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 := metrics.DefaultConfig(cfg.MetricsPrefix)
metricsConf.EnableHostname = !cfg.DisableHostname metricsConf.EnableHostname = !cfg.DisableHostname
metricsConf.FilterDefault = cfg.FilterDefault 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) memSink := metrics.NewInmemSink(10*time.Second, time.Minute)
metrics.DefaultInmemSignal(memSink) metrics.DefaultInmemSignal(memSink)
metricsConf := metrics.DefaultConfig(cfg.MetricsPrefix)
metricsConfig := &MetricsConfig{ metricsConfig := &MetricsConfig{
Handler: memSink, Handler: memSink,
@ -379,7 +378,7 @@ func InitTelemetry(cfg TelemetryConfig, logger hclog.Logger) (*MetricsConfig, er
} }
for { for {
logger.Warn("retrying configure metric sinks", "retries", waiter.Failures()) logger.Warn("retrying configure metric sinks", "retries", waiter.Failures())
_, err := configureSinks(cfg, metricsConf.HostName, memSink) _, err := configureSinks(cfg, memSink)
if err == nil { if err == nil {
logger.Info("successfully configured metrics sinks") logger.Info("successfully configured metrics sinks")
return 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 { if isRetriableError(errs) && cfg.RetryFailedConfiguration {
logger.Warn("failed configure sinks", "error", multierror.Flatten(errs)) logger.Warn("failed configure sinks", "error", multierror.Flatten(errs))
ctx, cancel = context.WithCancel(context.Background()) ctx, cancel = context.WithCancel(context.Background())

4
lib/telemetry_test.go

@ -21,7 +21,7 @@ func newCfg() TelemetryConfig {
func TestConfigureSinks(t *testing.T) { func TestConfigureSinks(t *testing.T) {
cfg := newCfg() cfg := newCfg()
sinks, err := configureSinks(cfg, "hostname", nil) sinks, err := configureSinks(cfg, nil)
require.Error(t, err) require.Error(t, err)
// 3 sinks: statsd, statsite, inmem // 3 sinks: statsd, statsite, inmem
require.Equal(t, 3, len(sinks)) require.Equal(t, 3, len(sinks))
@ -29,7 +29,7 @@ func TestConfigureSinks(t *testing.T) {
cfg = TelemetryConfig{ cfg = TelemetryConfig{
DogstatsdAddr: "", DogstatsdAddr: "",
} }
_, err = configureSinks(cfg, "hostname", nil) _, err = configureSinks(cfg, nil)
require.NoError(t, err) require.NoError(t, err)
} }

Loading…
Cancel
Save