A Go package to send application metrics using UDP.
Create an instance of Measures
specifying the client name and server address:
Measures = measures.New("measures-example", "0.0.0.0:3593")
Count something โ a fruit, for example:
Measures.Count("fruits", 1, measures.Dimensions{
"name": "avocado",
"color": "green",
})
You can also measure time spent on something:
func someLengthyOperation() {
defer M.Time("example", time.Now(), nil) // No Dimensions in this case
time.Sleep(359e6)
}
And you can provide Dimensions at once:
func anotherLengthyOperation() {
defer M.Time("example", time.Now(), measures.Dimensions{"number": 359})
time.Sleep(359e6)
}
Or as you have them:
func yetanotherLengthyOperation() {
d := make(measures.Dimensions, 2)
defer M.Time("example", time.Now(), d)
d["number"] = 359
time.Sleep(359e6)
d["isPrime"] = true
}
Simplified BSD ยฉ Measures authors et al