1
0
Fork 0
arangodb/3rdParty/etcd/third_party/github.com/rcrowley/go-metrics
Max Neunhoeffer 7dc9e89357 Add etcd v0.3.0. 2014-02-26 22:48:54 +01:00
..
cmd Add etcd v0.3.0. 2014-02-26 22:48:54 +01:00
librato Add etcd v0.3.0. 2014-02-26 22:48:54 +01:00
stathat Add etcd v0.3.0. 2014-02-26 22:48:54 +01:00
.gitignore Add etcd v0.3.0. 2014-02-26 22:48:54 +01:00
LICENSE Add etcd v0.3.0. 2014-02-26 22:48:54 +01:00
README.md Add etcd v0.3.0. 2014-02-26 22:48:54 +01:00
counter.go Add etcd v0.3.0. 2014-02-26 22:48:54 +01:00
counter_test.go Add etcd v0.3.0. 2014-02-26 22:48:54 +01:00
debug.go Add etcd v0.3.0. 2014-02-26 22:48:54 +01:00
debug_test.go Add etcd v0.3.0. 2014-02-26 22:48:54 +01:00
ewma.go Add etcd v0.3.0. 2014-02-26 22:48:54 +01:00
ewma_test.go Add etcd v0.3.0. 2014-02-26 22:48:54 +01:00
gauge.go Add etcd v0.3.0. 2014-02-26 22:48:54 +01:00
gauge_test.go Add etcd v0.3.0. 2014-02-26 22:48:54 +01:00
graphite.go Add etcd v0.3.0. 2014-02-26 22:48:54 +01:00
graphite_test.go Add etcd v0.3.0. 2014-02-26 22:48:54 +01:00
healthcheck.go Add etcd v0.3.0. 2014-02-26 22:48:54 +01:00
histogram.go Add etcd v0.3.0. 2014-02-26 22:48:54 +01:00
histogram_test.go Add etcd v0.3.0. 2014-02-26 22:48:54 +01:00
json.go Add etcd v0.3.0. 2014-02-26 22:48:54 +01:00
log.go Add etcd v0.3.0. 2014-02-26 22:48:54 +01:00
memory.md Add etcd v0.3.0. 2014-02-26 22:48:54 +01:00
meter.go Add etcd v0.3.0. 2014-02-26 22:48:54 +01:00
meter_test.go Add etcd v0.3.0. 2014-02-26 22:48:54 +01:00
metrics.go Add etcd v0.3.0. 2014-02-26 22:48:54 +01:00
metrics_test.go Add etcd v0.3.0. 2014-02-26 22:48:54 +01:00
registry.go Add etcd v0.3.0. 2014-02-26 22:48:54 +01:00
registry_test.go Add etcd v0.3.0. 2014-02-26 22:48:54 +01:00
runtime.go Add etcd v0.3.0. 2014-02-26 22:48:54 +01:00
runtime_test.go Add etcd v0.3.0. 2014-02-26 22:48:54 +01:00
sample.go Add etcd v0.3.0. 2014-02-26 22:48:54 +01:00
sample_test.go Add etcd v0.3.0. 2014-02-26 22:48:54 +01:00
syslog.go Add etcd v0.3.0. 2014-02-26 22:48:54 +01:00
timer.go Add etcd v0.3.0. 2014-02-26 22:48:54 +01:00
timer_test.go Add etcd v0.3.0. 2014-02-26 22:48:54 +01:00
writer.go Add etcd v0.3.0. 2014-02-26 22:48:54 +01:00

README.md

go-metrics

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

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

Usage

Create and update metrics:

c := metrics.NewCounter()
metrics.Register("foo", c)
c.Inc(47)

g := metrics.NewGauge()
metrics.Register("bar", g)
g.Update(47)

s := metrics.NewExpDecaySample(1028, 0.015) // or metrics.NewUniformSample(1028)
h := metrics.NewHistogram(s)
metrics.Register("baz", h)
h.Update(47)

m := metrics.NewMeter()
metrics.Register("quux", m)
m.Mark(47)

t := metrics.NewTimer()
metrics.Register("bang", t)
t.Time(func() {})
t.Update(47)

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

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

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

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

Periodically emit every metric to Graphite:

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

Periodically emit every metric to StatHat:

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

stathat.Stathat(metrics.DefaultRegistry, 10e9, "example@example.com")

Installation

go get github.com/rcrowley/go-metrics

StatHat support additionally requires their Go client:

go get github.com/stathat/go