diff --git a/metrics/librato/librato.go b/metrics/librato/librato.go index 45bf6cf297a7..9323290bc51b 100644 --- a/metrics/librato/librato.go +++ b/metrics/librato/librato.go @@ -42,9 +42,10 @@ func Librato(r metrics.Registry, d time.Duration, e string, t string, s string, func (re *Reporter) Run() { log.Printf("WARNING: This client has been DEPRECATED! It has been moved to https://github.com/mihasya/go-metrics-librato and will be removed from rcrowley/go-metrics on August 5th 2015") - ticker := time.Tick(re.Interval) + ticker := time.NewTicker(re.Interval) + defer ticker.Stop() metricsApi := &LibratoClient{re.Email, re.Token} - for now := range ticker { + for now := range ticker.C { var metrics Batch var err error if metrics, err = re.BuildRequest(now, re.Registry); err != nil { diff --git a/metrics/registry_test.go b/metrics/registry_test.go index 416c82d0b207..d277ae5c3e47 100644 --- a/metrics/registry_test.go +++ b/metrics/registry_test.go @@ -270,7 +270,10 @@ func TestChildPrefixedRegistryOfChildRegister(t *testing.T) { if err != nil { t.Fatal(err.Error()) } - r2.Register("baz", NewCounter()) + err = r2.Register("baz", NewCounter()) + if err != nil { + t.Fatal(err.Error()) + } c := NewCounter() Register("bars", c) @@ -278,7 +281,7 @@ func TestChildPrefixedRegistryOfChildRegister(t *testing.T) { r2.Each(func(name string, m interface{}) { i++ if name != "prefix.prefix2.baz" { - //t.Fatal(name) + t.Fatal(name) } }) if i != 1 { @@ -293,7 +296,10 @@ func TestWalkRegistries(t *testing.T) { if err != nil { t.Fatal(err.Error()) } - r2.Register("baz", NewCounter()) + err = r2.Register("baz", NewCounter()) + if err != nil { + t.Fatal(err.Error()) + } c := NewCounter() Register("bars", c) @@ -301,5 +307,4 @@ func TestWalkRegistries(t *testing.T) { if prefix != "prefix.prefix2." { t.Fatal(prefix) } - } diff --git a/metrics/timer.go b/metrics/timer.go index 89e22208fde0..a63c9dfb6c2d 100644 --- a/metrics/timer.go +++ b/metrics/timer.go @@ -76,10 +76,7 @@ func NewTimer() Timer { } // NilTimer is a no-op Timer. -type NilTimer struct { - h Histogram - m Meter -} +type NilTimer struct{} // Count is a no-op. func (NilTimer) Count() int64 { return 0 }