go get -u github.com/emitter-io/stats
The package itself provides a general-purpose monitoring capabilities, with tight encoding using our binary codec. While it’s primarily have been built for emitter, it can be used anywhere.
Typical usage consists of creating a metric container, measuring various metrics and sending snapshots over the wire.
// Create a container
m := stats.New()
// Measure few metrics
// Create a snapshot which can be transferred over the wire
bytes := m.Snapshot()
// Restore a snapshot from binary
v, err := stats.Restore(bytes)
// Get the values back
percentiles := v.Quantile(50, 90, 95, 99)
average := v.Mean()
count := v.Count()