mirror of
https://github.com/ethereum/go-ethereum.git
synced 2026-06-19 21:31:37 +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() {
|
||||
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 {
|
||||
|
|
|
|||
|
|
@ -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)
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -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 }
|
||||
|
|
|
|||
Loading…
Reference in a new issue