From c9baaf5ba1fea6f7865aa116ea138f2343919c40 Mon Sep 17 00:00:00 2001 From: Julius Volz Date: Fri, 29 Apr 2016 11:49:55 +0200 Subject: [PATCH] Increase receivable UDP datagram size to 65535 bytes. Fixes https://github.com/prometheus/statsd_exporter/issues/35 --- exporter.go | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/exporter.go b/exporter.go index 3a46397..c09fe07 100644 --- a/exporter.go +++ b/exporter.go @@ -293,10 +293,9 @@ func buildEvent(statType, metric string, value float64) (Event, error) { } func (l *StatsDListener) Listen(e chan<- Events) { - // TODO: evaluate proper size according to MTU - var buf [512]byte + buf := make([]byte, 65535) for { - n, _, err := l.conn.ReadFromUDP(buf[0:]) + n, _, err := l.conn.ReadFromUDP(buf) if err != nil { log.Fatal(err) }