CrowdStrike/go-metrics

Name: go-metrics

Owner: Crowdstrike

Description: Go port of Coda Hale's Metrics library

Forked from: rcrowley/go-metrics

Created: 2015-10-13 21:20:45.0

Updated: 2016-07-07 16:03:07.0

Pushed: 2015-09-26 00:51:03.0

Homepage:

Size: 1987

Language: Go

GitHub Committers

UserMost Recent Commit# Commits

Other Committers

UserEmailMost Recent Commit# Commits

README

go-metrics

travis build status

Go port of Coda Hale's Metrics library: https://github.com/dropwizard/metrics.

Documentation: http://godoc.org/github.com/rcrowley/go-metrics.

Usage

Create and update metrics:

 metrics.NewCounter()
ics.Register("foo", c)
c(47)

 metrics.NewGauge()
ics.Register("bar", g)
date(47)

 metrics.NewExpDecaySample(1028, 0.015) // or metrics.NewUniformSample(1028)
 metrics.NewHistogram(s)
ics.Register("baz", h)
date(47)

 metrics.NewMeter()
ics.Register("quux", m)
rk(47)

 metrics.NewTimer()
ics.Register("bang", t)
me(func() {})
date(47)

Periodically log every metric in human-readable form to standard error:

etrics.Log(metrics.DefaultRegistry, 60e9, log.New(os.Stderr, "metrics: ", log.Lmicroseconds))

Periodically log every metric in slightly-more-parseable form to syslog:

 := syslog.Dial("unixgram", "/dev/log", syslog.LOG_INFO, "metrics")
etrics.Syslog(metrics.DefaultRegistry, 60e9, w)

Periodically emit every metric to Graphite using the Graphite client:

rt "github.com/cyberdelia/go-metrics-graphite"

, _ := net.ResolveTCPAddr("tcp", "127.0.0.1:2003")
raphite.Graphite(metrics.DefaultRegistry, 10e9, "metrics", addr)

Periodically emit every metric into InfluxDB:

NOTE: this has been pulled out of the library due to constant fluctuations in the InfluxDB API. In fact, all client libraries are on their way out. see issues #121 and #124 for progress and details.

rt "github.com/rcrowley/go-metrics/influxdb"

nfluxdb.Influxdb(metrics.DefaultRegistry, 10e9, &influxdb.Config{
Host:     "127.0.0.1:8086",
Database: "metrics",
Username: "test",
Password: "test",

Periodically upload every metric to Librato using the Librato client:

Note: the client included with this repository under the librato package has been deprecated and moved to the repository linked above.

rt "github.com/mihasya/go-metrics-librato"

ibrato.Librato(metrics.DefaultRegistry,
10e9,                  // interval
"example@example.com", // account owner email address
"token",               // Librato API token
"hostname",            // source
[]float64{0.95},       // percentiles to send
time.Millisecond,      // time unit

Periodically emit every metric to StatHat:

rt "github.com/rcrowley/go-metrics/stathat"

tathat.Stathat(metrics.DefaultRegistry, 10e9, "example@example.com")
Installation
et github.com/rcrowley/go-metrics

StatHat support additionally requires their Go client:

et github.com/stathat/go
Publishing Metrics

Clients are available for the following destinations:


This work is supported by the National Institutes of Health's National Center for Advancing Translational Sciences, Grant Number U24TR002306. This work is solely the responsibility of the creators and does not necessarily represent the official views of the National Institutes of Health.