erigon-pulse/metrics/metrics.go

23 lines
518 B
Go
Raw Normal View History

// Go port of Coda Hale's Metrics library
2015-07-07 00:54:22 +00:00
//
// <https://github.com/rcrowley/go-metrics>
2015-07-07 00:54:22 +00:00
//
// Coda Hale's original work: <https://github.com/codahale/metrics>
package metrics
import (
2021-07-03 07:44:23 +00:00
"runtime/metrics"
"sync/atomic"
)
// callbacks - storing list of callbacks as type []func()
// use metrics.AddCallback to add your function to metrics collection loop (to avoid multiple goroutines collecting metrics)
var callbacks atomic.Value
func init() {
2021-07-03 07:44:23 +00:00
metrics.All()
callbacks.Store([]func(){})
}
// Calling Load method