diff options
author | Anton Evangelatov <anton.evangelatov@gmail.com> | 2018-07-02 20:51:02 +0800 |
---|---|---|
committer | Péter Szilágyi <peterke@gmail.com> | 2018-07-02 20:51:02 +0800 |
commit | 1990c9e6216fd6b25fdf6447844f36405b75c18e (patch) | |
tree | a06426641caf1e61ea788a5280d7047981e6ac67 /metrics | |
parent | 223d943481d16c4874165288cfb68e7350a9104e (diff) | |
download | dexon-1990c9e6216fd6b25fdf6447844f36405b75c18e.tar.gz dexon-1990c9e6216fd6b25fdf6447844f36405b75c18e.tar.zst dexon-1990c9e6216fd6b25fdf6447844f36405b75c18e.zip |
cmd/geth: export metrics to InfluxDB (#16979)
* cmd/geth: add flags for metrics export
* cmd/geth: update usage fields for metrics flags
* metrics/influxdb: update reporter logger to adhere to geth logging convention
Diffstat (limited to 'metrics')
-rw-r--r-- | metrics/influxdb/influxdb.go | 12 |
1 files changed, 6 insertions, 6 deletions
diff --git a/metrics/influxdb/influxdb.go b/metrics/influxdb/influxdb.go index d5cb4da66..31a5c21b5 100644 --- a/metrics/influxdb/influxdb.go +++ b/metrics/influxdb/influxdb.go @@ -2,10 +2,10 @@ package influxdb import ( "fmt" - "log" uurl "net/url" "time" + "github.com/ethereum/go-ethereum/log" "github.com/ethereum/go-ethereum/metrics" "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) { u, err := uurl.Parse(url) 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 } @@ -51,7 +51,7 @@ func InfluxDBWithTags(r metrics.Registry, d time.Duration, url, database, userna cache: make(map[string]int64), } 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 } @@ -76,15 +76,15 @@ func (r *reporter) run() { select { case <-intervalTicker: 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: _, _, err := r.client.Ping() 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 { - log.Printf("unable to make InfluxDB client. err=%v", err) + log.Warn("Unable to make InfluxDB client", "err", err) } } } |