mirror of
https://github.com/ethereum/go-ethereum.git
synced 2026-07-17 18:30:45 +00:00
metrics: fix issues reported by staticcheck (#20365)
This commit is contained in:
parent
332ac32bc5
commit
462999b381
3 changed files with 13 additions and 10 deletions
|
|
@ -42,9 +42,10 @@ func Librato(r metrics.Registry, d time.Duration, e string, t string, s string,
|
||||||
|
|
||||||
func (re *Reporter) Run() {
|
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")
|
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}
|
metricsApi := &LibratoClient{re.Email, re.Token}
|
||||||
for now := range ticker {
|
for now := range ticker.C {
|
||||||
var metrics Batch
|
var metrics Batch
|
||||||
var err error
|
var err error
|
||||||
if metrics, err = re.BuildRequest(now, re.Registry); err != nil {
|
if metrics, err = re.BuildRequest(now, re.Registry); err != nil {
|
||||||
|
|
|
||||||
|
|
@ -270,7 +270,10 @@ func TestChildPrefixedRegistryOfChildRegister(t *testing.T) {
|
||||||
if err != nil {
|
if err != nil {
|
||||||
t.Fatal(err.Error())
|
t.Fatal(err.Error())
|
||||||
}
|
}
|
||||||
r2.Register("baz", NewCounter())
|
err = r2.Register("baz", NewCounter())
|
||||||
|
if err != nil {
|
||||||
|
t.Fatal(err.Error())
|
||||||
|
}
|
||||||
c := NewCounter()
|
c := NewCounter()
|
||||||
Register("bars", c)
|
Register("bars", c)
|
||||||
|
|
||||||
|
|
@ -278,7 +281,7 @@ func TestChildPrefixedRegistryOfChildRegister(t *testing.T) {
|
||||||
r2.Each(func(name string, m interface{}) {
|
r2.Each(func(name string, m interface{}) {
|
||||||
i++
|
i++
|
||||||
if name != "prefix.prefix2.baz" {
|
if name != "prefix.prefix2.baz" {
|
||||||
//t.Fatal(name)
|
t.Fatal(name)
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
if i != 1 {
|
if i != 1 {
|
||||||
|
|
@ -293,7 +296,10 @@ func TestWalkRegistries(t *testing.T) {
|
||||||
if err != nil {
|
if err != nil {
|
||||||
t.Fatal(err.Error())
|
t.Fatal(err.Error())
|
||||||
}
|
}
|
||||||
r2.Register("baz", NewCounter())
|
err = r2.Register("baz", NewCounter())
|
||||||
|
if err != nil {
|
||||||
|
t.Fatal(err.Error())
|
||||||
|
}
|
||||||
c := NewCounter()
|
c := NewCounter()
|
||||||
Register("bars", c)
|
Register("bars", c)
|
||||||
|
|
||||||
|
|
@ -301,5 +307,4 @@ func TestWalkRegistries(t *testing.T) {
|
||||||
if prefix != "prefix.prefix2." {
|
if prefix != "prefix.prefix2." {
|
||||||
t.Fatal(prefix)
|
t.Fatal(prefix)
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -76,10 +76,7 @@ func NewTimer() Timer {
|
||||||
}
|
}
|
||||||
|
|
||||||
// NilTimer is a no-op Timer.
|
// NilTimer is a no-op Timer.
|
||||||
type NilTimer struct {
|
type NilTimer struct{}
|
||||||
h Histogram
|
|
||||||
m Meter
|
|
||||||
}
|
|
||||||
|
|
||||||
// Count is a no-op.
|
// Count is a no-op.
|
||||||
func (NilTimer) Count() int64 { return 0 }
|
func (NilTimer) Count() int64 { return 0 }
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue