Skip to content

Shyp/go-simple-metrics

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

7 Commits
 
 
 
 
 
 
 
 

Repository files navigation

go-metrics

This is a stupid simple wrapper around the Librato go library. There are only three functions, the ones we use the most often.

Example Usage

func init() {
    metrics.Namespace = "api"
    source := "prod.web.1"
    metrics.Start(source)
}

metrics.Increment("signup")
start := time.Now()
time.Sleep(3*time.Second)
metrics.Time("long_op", time.Since(start))

metrics.Measure("queue_depth", 57)

Configuration

Set LIBRATO_TOKEN in your environment; this gets passed to the librato client and will publish metrics every ten seconds.

Debugging

Set DEBUG=metrics in your environment to print all metrics to stdout in realtime.