A extremely simple Statsd client for Go.
go get -u github.com/gumieri/go-statsd
This project is a Go library. Intended to be used by another Go programs.
import "github.com/gumieri/statsd"
client := statsd.New("localhost", 8125)
err := client.Send(&statsd.Metric{
Name: "test", // string
Value: 1, // float64
Type: statsd.Counter, // statsd.Gauge, statsd.Millisecond, statsd.Histogram or statsd.Set
SampleRate: 0.33, // float64
Tags: []statsd.Tag{
{Key: "oneKey", Value: "oneValue"},
{Key: "twoKey", Value: "twoValue"},
},
})
There is also a TrySend
which does not return any error:
client.TrySend(&statsd.Metric{
Name: "test",
Value: 1,
Type: statsd.Counter,
})
Note is released under the MIT License.