Add read_buffer_size option to statsd input (#4598)
This commit is contained in:
@@ -76,6 +76,8 @@ type Statsd struct {
|
||||
// see https://github.com/influxdata/telegraf/pull/992
|
||||
UDPPacketSize int `toml:"udp_packet_size"`
|
||||
|
||||
ReadBufferSize int `toml:"read_buffer_size"`
|
||||
|
||||
sync.Mutex
|
||||
// Lock for preventing a data race during resource cleanup
|
||||
cleanup sync.Mutex
|
||||
@@ -411,6 +413,10 @@ func (s *Statsd) udpListen() error {
|
||||
}
|
||||
log.Println("I! Statsd UDP listener listening on: ", s.UDPlistener.LocalAddr().String())
|
||||
|
||||
if s.ReadBufferSize > 0 {
|
||||
s.UDPlistener.SetReadBuffer(s.ReadBufferSize)
|
||||
}
|
||||
|
||||
buf := make([]byte, UDP_MAX_PACKET_SIZE)
|
||||
for {
|
||||
select {
|
||||
|
||||
Reference in New Issue
Block a user