Package statsd provides a Go dogstatsd client. Dogstatsd extends Statsd, adding tags
and histograms.
$ go get github.com/DataDog/datadog-go/statsd
// Create the client
c, err := statsd.New("127.0.0.1:8125")
if err != nil {
log.Fatal(err)
}
// Prefix every metric with the app name
c.Namespace = "flubber."
// Send the EC2 availability zone as a tag with every metric
c.Tags = append(c.Tags, "us-east-1a")
err = c.Gauge("request.duration", 1.2, nil, 1)
Dogstatsd accepts packets with multiple statsd payloads in them. Using the BufferingClient via NewBufferingClient will buffer up commands and send them when the buffer is reached or after 100msec.
Run the tests with:
$ go test
Please see: http://godoc.org/github.com/DataDog/datadog-go/statsd
go-dogstatsd is released under the MIT license.
Original code by ooyala.