Files
evm/metrics
e77c9c97cc coreth sync: 0.12.4-rc.0 -> 0.12.7 (#975)
* coreth sync: 0.12.4-rc.0 -> 0.12.7

* Review coreth 0.12.7 (#980)

* Apply suggested changes from https://github.com/ava-labs/coreth/pull/381/files

* drop reexec=0

* add txHashes

* bump avalanchego

* remove manager

* fix compat test

* bump version for e2e tests

---------

Co-authored-by: Ceyhun Onur <[email protected]>
2023-11-07 14:35:02 -05:00
..
2022-05-24 21:10:46 +03:00
2022-05-24 21:10:46 +03:00
2023-04-25 12:23:53 -07:00
2022-05-24 21:10:46 +03:00
2023-07-26 09:45:17 -04:00
2023-07-26 09:45:17 -04:00
2023-07-26 09:45:17 -04:00
2023-07-26 09:45:17 -04:00
2022-05-24 21:10:46 +03:00
2022-05-24 21:10:46 +03:00
2022-05-24 21:10:46 +03:00
2022-05-24 21:10:46 +03:00
2022-05-24 21:10:46 +03:00
2022-05-24 21:10:46 +03:00
2022-05-24 21:10:46 +03:00
2023-04-25 12:23:53 -07:00
2022-05-24 21:10:46 +03:00
2022-10-24 16:13:37 -04:00
2023-04-25 12:23:53 -07:00
2022-05-24 21:10:46 +03:00
2022-05-24 21:10:46 +03:00
2022-05-24 21:10:46 +03:00
2022-05-24 21:10:46 +03:00
2022-05-24 21:10:46 +03:00
2022-05-24 21:10:46 +03:00
2022-05-24 21:10:46 +03:00
2022-05-24 21:10:46 +03:00
2022-05-24 21:10:46 +03:00
2023-04-25 12:23:53 -07:00
2022-05-24 21:10:46 +03:00
2022-05-24 21:10:46 +03:00
2023-09-27 10:11:03 -04:00
2022-05-24 21:10:46 +03:00
2022-05-24 21:10:46 +03:00
2022-05-24 21:10:46 +03:00
2023-07-26 09:45:17 -04:00
2023-07-26 09:45:17 -04:00
2022-05-24 21:10:46 +03:00
2022-05-24 21:10:46 +03:00
2022-05-24 21:10:46 +03:00
2022-05-24 21:10:46 +03:00

go-metrics

travis build status

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

Documentation: https://pkg.go.dev/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)

r := NewRegistry()
g := metrics.NewRegisteredFunctionalGauge("cache-evictions", r, func() int64 { return cache.getEvictionsCount() })

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)

Register() is not threadsafe. For threadsafe metric registration use GetOrRegister:

t := metrics.GetOrRegisterTimer("account.create.latency", nil)
t.Time(func() {})
t.Update(47)

NOTE: Be sure to unregister short-lived meters and timers otherwise they will leak memory:

// Will call Stop() on the Meter to allow for garbage collection
metrics.Unregister("quux")
// Or similarly for a Timer that embeds a Meter
metrics.Unregister("bang")

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

go metrics.Log(metrics.DefaultRegistry, 5 * time.Second, 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 using the Graphite client:


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

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

Installation

go get github.com/rcrowley/go-metrics

StatHat support additionally requires their Go client:

go get github.com/stathat/go

Publishing Metrics

Clients are available for the following destinations: