Sin descripción

Richard Crowley 8b1a49ea96 Use library with GitHub path. hace 14 años
cmd 8b1a49ea96 Use library with GitHub path. hace 14 años
.gitignore 0818b952c0 Removed a binary. hace 14 años
LICENSE f7cf4d7405 Initial import. hace 14 años
Makefile 8b1a49ea96 Use library with GitHub path. hace 14 años
README.md 033e0dc4eb Installation and usage. hace 14 años
counter.go 9192d930ec Use atomics for counters and gauges. hace 14 años
counter_test.go 4461e83a4e Cleanup imports. hace 14 años
ewma.go 93a07b730f More memory-efficient meters. hace 14 años
ewma_test.go 4461e83a4e Cleanup imports. hace 14 años
gauge.go 9192d930ec Use atomics for counters and gauges. hace 14 años
gauge_test.go 4461e83a4e Cleanup imports. hace 14 años
healthcheck.go b897f10231 Added healthcheck metrics. hace 14 años
histogram.go 9250caeb9f Removing Sum API. hace 14 años
histogram_test.go 4461e83a4e Cleanup imports. hace 14 años
log.go 2c958a22b8 Fixing log formats. hace 14 años
memory.md 033e0dc4eb Installation and usage. hace 14 años
meter.go b0edbfcbb4 Remove Clear API. hace 14 años
meter_test.go 4461e83a4e Cleanup imports. hace 14 años
metrics.go f7cf4d7405 Initial import. hace 14 años
registry.go b897f10231 Added healthcheck metrics. hace 14 años
sample.go f068d88f36 Correct timestamp usage in exponential decay. hace 14 años
sample_test.go 4461e83a4e Cleanup imports. hace 14 años
syslog.go 2c958a22b8 Fixing log formats. hace 14 años
timer.go c64d95acf6 Added Timer metrics. hace 14 años
timer_test.go c64d95acf6 Added Timer metrics. hace 14 años

README.md

go-metrics

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

This code is not safe on 32-bit architectures.

Usage

Create and update metrics:

r := metrics.NewRegistry()

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

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

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

m := metrics.NewMeter()
r.RegisterMeter("bang", m)
m.Mark(47)

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

metrics.Log(r, 60, log.New(os.Stderr, "metrics: ", log.Lmicroseconds))

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

w, err := syslog.Dial("unixgram", "/dev/log", syslog.LOG_INFO, "metrics")
if nil != err { log.Fatalln(err) }
metrics.Syslog(r, 60, w)

Installation

goinstall github.com/rcrowley/go-metrics