Update dependencies (#5518)
This commit is contained in:
24
vendor/github.com/rcrowley/go-metrics/log.go
generated
vendored
24
vendor/github.com/rcrowley/go-metrics/log.go
generated
vendored
@@ -8,17 +8,37 @@ type Logger interface {
|
||||
Printf(format string, v ...interface{})
|
||||
}
|
||||
|
||||
// Log outputs each metric in the given registry periodically using the given logger.
|
||||
func Log(r Registry, freq time.Duration, l Logger) {
|
||||
LogScaled(r, freq, time.Nanosecond, l)
|
||||
}
|
||||
|
||||
// Output each metric in the given registry periodically using the given
|
||||
// LogOnCue outputs each metric in the given registry on demand through the channel
|
||||
// using the given logger
|
||||
func LogOnCue(r Registry, ch chan interface{}, l Logger) {
|
||||
LogScaledOnCue(r, ch, time.Nanosecond, l)
|
||||
}
|
||||
|
||||
// LogScaled outputs each metric in the given registry periodically using the given
|
||||
// logger. Print timings in `scale` units (eg time.Millisecond) rather than nanos.
|
||||
func LogScaled(r Registry, freq time.Duration, scale time.Duration, l Logger) {
|
||||
ch := make(chan interface{})
|
||||
go func(channel chan interface{}) {
|
||||
for _ = range time.Tick(freq) {
|
||||
channel <- struct{}{}
|
||||
}
|
||||
}(ch)
|
||||
LogScaledOnCue(r, ch, scale, l)
|
||||
}
|
||||
|
||||
// LogScaledOnCue outputs each metric in the given registry on demand through the channel
|
||||
// using the given logger. Print timings in `scale` units (eg time.Millisecond) rather
|
||||
// than nanos.
|
||||
func LogScaledOnCue(r Registry, ch chan interface{}, scale time.Duration, l Logger) {
|
||||
du := float64(scale)
|
||||
duSuffix := scale.String()[1:]
|
||||
|
||||
for _ = range time.Tick(freq) {
|
||||
for _ = range ch {
|
||||
r.Each(func(name string, i interface{}) {
|
||||
switch metric := i.(type) {
|
||||
case Counter:
|
||||
|
||||
Reference in New Issue
Block a user