code refactor for redis plugin
This commit is contained in:
parent
e700338f10
commit
ed6d298cbb
|
@ -149,11 +149,11 @@ func (r *Redis) gatherOnce(slist *list.SafeList, ins *Instance) {
|
||||||
err := ins.client.Ping(context.Background()).Err()
|
err := ins.client.Ping(context.Background()).Err()
|
||||||
slist.PushFront(inputs.NewSample("ping_use_ms", time.Since(begun).Milliseconds(), tags))
|
slist.PushFront(inputs.NewSample("ping_use_ms", time.Since(begun).Milliseconds(), tags))
|
||||||
if err != nil {
|
if err != nil {
|
||||||
slist.PushFront(inputs.NewSample("ping_up", 1, tags))
|
slist.PushFront(inputs.NewSample("up", 0, tags))
|
||||||
log.Println("E! failed to ping redis:", ins.Address, "error:", err)
|
log.Println("E! failed to ping redis:", ins.Address, "error:", err)
|
||||||
return
|
return
|
||||||
} else {
|
} else {
|
||||||
slist.PushFront(inputs.NewSample("ping_up", 0, tags))
|
slist.PushFront(inputs.NewSample("up", 1, tags))
|
||||||
}
|
}
|
||||||
|
|
||||||
r.gatherInfoAll(slist, ins, tags)
|
r.gatherInfoAll(slist, ins, tags)
|
||||||
|
|
Loading…
Reference in New Issue