mirror of
https://github.com/prometheus/statsd_exporter.git
synced 2024-11-25 08:41:00 +00:00
Merge pull request #22 from Jimdo/config_udp_buffer
Allow configuration of UDP read buffer
This commit is contained in:
commit
6b318a471e
1 changed files with 9 additions and 0 deletions
9
main.go
9
main.go
|
@ -29,6 +29,7 @@ var (
|
||||||
metricsEndpoint = flag.String("web.telemetry-path", "/metrics", "Path under which to expose metrics.")
|
metricsEndpoint = flag.String("web.telemetry-path", "/metrics", "Path under which to expose metrics.")
|
||||||
statsdListenAddress = flag.String("statsd.listen-address", ":9125", "The UDP address on which to receive statsd metric lines.")
|
statsdListenAddress = flag.String("statsd.listen-address", ":9125", "The UDP address on which to receive statsd metric lines.")
|
||||||
mappingConfig = flag.String("statsd.mapping-config", "", "Metric mapping configuration file name.")
|
mappingConfig = flag.String("statsd.mapping-config", "", "Metric mapping configuration file name.")
|
||||||
|
readBuffer = flag.Int("statsd.read-buffer", 0, "Size (in bytes) of the operating system's transmit read buffer associated with the UDP connection. Please make sure the kernel parameters net.core.rmem_max is set to a value greater than the value specified.")
|
||||||
)
|
)
|
||||||
|
|
||||||
func serveHTTP() {
|
func serveHTTP() {
|
||||||
|
@ -112,6 +113,14 @@ func main() {
|
||||||
if err != nil {
|
if err != nil {
|
||||||
log.Fatal(err)
|
log.Fatal(err)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if *readBuffer != 0 {
|
||||||
|
err = conn.SetReadBuffer(*readBuffer)
|
||||||
|
if err != nil {
|
||||||
|
log.Fatal("Error setting UDP read buffer:", err)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
l := &StatsDListener{conn: conn}
|
l := &StatsDListener{conn: conn}
|
||||||
go l.Listen(events)
|
go l.Listen(events)
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue