mirror of
https://github.com/ethereum/go-ethereum.git
synced 2026-08-19 02:12:23 +00:00
metrics/influxdb: update reporter logger to adhere to geth logging convention
This commit is contained in:
parent
a2a87456d7
commit
5a9222ea25
1 changed files with 6 additions and 6 deletions
|
|
@ -2,10 +2,10 @@ package influxdb
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"fmt"
|
"fmt"
|
||||||
"log"
|
|
||||||
uurl "net/url"
|
uurl "net/url"
|
||||||
"time"
|
"time"
|
||||||
|
|
||||||
|
"github.com/ethereum/go-ethereum/log"
|
||||||
"github.com/ethereum/go-ethereum/metrics"
|
"github.com/ethereum/go-ethereum/metrics"
|
||||||
"github.com/influxdata/influxdb/client"
|
"github.com/influxdata/influxdb/client"
|
||||||
)
|
)
|
||||||
|
|
@ -35,7 +35,7 @@ func InfluxDB(r metrics.Registry, d time.Duration, url, database, username, pass
|
||||||
func InfluxDBWithTags(r metrics.Registry, d time.Duration, url, database, username, password, namespace string, tags map[string]string) {
|
func InfluxDBWithTags(r metrics.Registry, d time.Duration, url, database, username, password, namespace string, tags map[string]string) {
|
||||||
u, err := uurl.Parse(url)
|
u, err := uurl.Parse(url)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
log.Printf("unable to parse InfluxDB url %s. err=%v", url, err)
|
log.Warn("Unable to parse InfluxDB", "url", url, "err", err)
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -51,7 +51,7 @@ func InfluxDBWithTags(r metrics.Registry, d time.Duration, url, database, userna
|
||||||
cache: make(map[string]int64),
|
cache: make(map[string]int64),
|
||||||
}
|
}
|
||||||
if err := rep.makeClient(); err != nil {
|
if err := rep.makeClient(); err != nil {
|
||||||
log.Printf("unable to make InfluxDB client. err=%v", err)
|
log.Warn("Unable to make InfluxDB client", "err", err)
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -76,15 +76,15 @@ func (r *reporter) run() {
|
||||||
select {
|
select {
|
||||||
case <-intervalTicker:
|
case <-intervalTicker:
|
||||||
if err := r.send(); err != nil {
|
if err := r.send(); err != nil {
|
||||||
log.Printf("unable to send to InfluxDB. err=%v", err)
|
log.Warn("Unable to send to InfluxDB", "err", err)
|
||||||
}
|
}
|
||||||
case <-pingTicker:
|
case <-pingTicker:
|
||||||
_, _, err := r.client.Ping()
|
_, _, err := r.client.Ping()
|
||||||
if err != nil {
|
if err != nil {
|
||||||
log.Printf("got error while sending a ping to InfluxDB, trying to recreate client. err=%v", err)
|
log.Warn("Got error while sending a ping to InfluxDB, trying to recreate client", "err", err)
|
||||||
|
|
||||||
if err = r.makeClient(); err != nil {
|
if err = r.makeClient(); err != nil {
|
||||||
log.Printf("unable to make InfluxDB client. err=%v", err)
|
log.Warn("Unable to make InfluxDB client", "err", err)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue