Add threaded parsing in statsd input plugin (#6922)

This commit is contained in:
josephpeacock
2020-03-03 14:47:33 -08:00
committed by GitHub
parent f04d84994d
commit ab8438dcc6
2 changed files with 88 additions and 17 deletions

View File

@@ -31,6 +31,8 @@ const (
defaultSeparator = "_"
defaultAllowPendingMessage = 10000
MaxTCPConnections = 250
parserGoRoutines = 5
)
// Statsd allows the importing of statsd and dogstatsd data.
@@ -398,12 +400,14 @@ func (s *Statsd) Start(ac telegraf.Accumulator) error {
}()
}
// Start the line parser
s.wg.Add(1)
go func() {
defer s.wg.Done()
s.parser()
}()
for i := 1; i <= parserGoRoutines; i++ {
// Start the line parser
s.wg.Add(1)
go func() {
defer s.wg.Done()
s.parser()
}()
}
s.Log.Infof("Started the statsd service on %q", s.ServiceAddress)
return nil
}