Skip to content

scorphus/measures

Folders and files

NameName
Last commit message
Last commit date

Latest commit

ย 

History

13 Commits
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 

Repository files navigation

Measures

A Go package to send application metrics using UDP.

Usage

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
}

License

Simplified BSD ยฉ Measures authors et al

About

๐Ÿ“ Backstage Measures in Go

Resources

License

Stars

Watchers

Forks