Skip to content

Commit 2f95348

Browse files
danielnelsonJean-Louis Dupond
authored andcommitted
Add read_buffer_size option to statsd input (influxdata#4598)
1 parent 1d620c1 commit 2f95348

File tree

2 files changed

+10
-0
lines changed

2 files changed

+10
-0
lines changed

plugins/inputs/statsd/README.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -58,6 +58,10 @@
5858
## calculation of percentiles. Raising this limit increases the accuracy
5959
## of percentiles but also increases the memory usage and cpu time.
6060
percentile_limit = 1000
61+
62+
## Maximum socket buffer size in bytes, once the buffer fills up, metrics
63+
## will start dropping. Defaults to the OS default.
64+
# read_buffer_size = 65535
6165
```
6266

6367
### Description

plugins/inputs/statsd/statsd.go

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -76,6 +76,8 @@ type Statsd struct {
7676
// see https://github.com/influxdata/telegraf/pull/992
7777
UDPPacketSize int `toml:"udp_packet_size"`
7878

79+
ReadBufferSize int `toml:"read_buffer_size"`
80+
7981
sync.Mutex
8082
// Lock for preventing a data race during resource cleanup
8183
cleanup sync.Mutex
@@ -411,6 +413,10 @@ func (s *Statsd) udpListen() error {
411413
}
412414
log.Println("I! Statsd UDP listener listening on: ", s.UDPlistener.LocalAddr().String())
413415

416+
if s.ReadBufferSize > 0 {
417+
s.UDPlistener.SetReadBuffer(s.ReadBufferSize)
418+
}
419+
414420
buf := make([]byte, UDP_MAX_PACKET_SIZE)
415421
for {
416422
select {

0 commit comments

Comments
 (0)