Skip to content

Commit

Permalink
add statsd.NoopClient as a fail-safe
Browse files Browse the repository at this point in the history
  • Loading branch information
ajatprabha committed Jul 1, 2019
1 parent 0f96cf2 commit ec32050
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions pkg/metrics/statsd_collector.go
Original file line number Diff line number Diff line change
Expand Up @@ -46,8 +46,11 @@ func InitializeStatsdCollector(config *StatsdCollectorConfig, collectorName stri
sampleRate = 1
}

c, _ := statsd.NewBufferedClient(config.StatsdAddr, config.Prefix, 1*time.Second, flushBytes)
// TODO Add logger for error
c, err := statsd.NewBufferedClient(config.StatsdAddr, config.Prefix, 1*time.Second, flushBytes)
if err != nil {
// TODO Add logger for error
c = &statsd.NoopClient{}
}
instance = &statsdClient{client: c, collectorName: collectorName, sampleRate: sampleRate}
return nil
}
Expand Down

0 comments on commit ec32050

Please sign in to comment.