Do not create a global statsd "previous instance"
this basically reverts #887 at some point we might want to do some special handling of reloading plugins and keeping their state intact, but that will need to be done at a higher level, and in a way that is thread-safe for multiple input plugins of the same type. Unfortunately this is a rather large feature that will not have a quick fix available for it. fixes #1975 fixes #2102
This commit is contained in:
@@ -32,8 +32,6 @@ var dropwarn = "E! Error: statsd message queue full. " +
|
||||
"We have dropped %d messages so far. " +
|
||||
"You may want to increase allowed_pending_messages in the config\n"
|
||||
|
||||
var prevInstance *Statsd
|
||||
|
||||
type Statsd struct {
|
||||
// Address & Port to serve from
|
||||
ServiceAddress string
|
||||
@@ -244,17 +242,10 @@ func (s *Statsd) Start(_ telegraf.Accumulator) error {
|
||||
s.done = make(chan struct{})
|
||||
s.in = make(chan []byte, s.AllowedPendingMessages)
|
||||
|
||||
if prevInstance == nil {
|
||||
s.gauges = make(map[string]cachedgauge)
|
||||
s.counters = make(map[string]cachedcounter)
|
||||
s.sets = make(map[string]cachedset)
|
||||
s.timings = make(map[string]cachedtimings)
|
||||
} else {
|
||||
s.gauges = prevInstance.gauges
|
||||
s.counters = prevInstance.counters
|
||||
s.sets = prevInstance.sets
|
||||
s.timings = prevInstance.timings
|
||||
}
|
||||
s.gauges = make(map[string]cachedgauge)
|
||||
s.counters = make(map[string]cachedcounter)
|
||||
s.sets = make(map[string]cachedset)
|
||||
s.timings = make(map[string]cachedtimings)
|
||||
|
||||
if s.ConvertNames {
|
||||
log.Printf("I! WARNING statsd: convert_names config option is deprecated," +
|
||||
@@ -271,7 +262,6 @@ func (s *Statsd) Start(_ telegraf.Accumulator) error {
|
||||
// Start the line parser
|
||||
go s.parser()
|
||||
log.Printf("I! Started the statsd service on %s\n", s.ServiceAddress)
|
||||
prevInstance = s
|
||||
return nil
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user