dashboard: fix names in constructor

This commit is contained in:
Anton Evangelatov 2018-05-18 23:00:30 +02:00
parent 4a54cc776b
commit a62d5123cd

View file

@ -81,7 +81,7 @@ type client struct {
} }
// New creates a new dashboard instance with the given configuration. // New creates a new dashboard instance with the given configuration.
func New(config *Config, commit string, _ethServ *eth.Ethereum, _lesserv *les.LightEthereum) (*Dashboard, error) { func New(config *Config, commit string, ethServ *eth.Ethereum, lesServ *les.LightEthereum) (*Dashboard, error) {
now := time.Now() now := time.Now()
db := &Dashboard{ db := &Dashboard{
conns: make(map[uint32]*client), conns: make(map[uint32]*client),
@ -98,8 +98,8 @@ func New(config *Config, commit string, _ethServ *eth.Ethereum, _lesserv *les.Li
DiskWrite: emptyChartEntries(now, diskWriteSampleLimit, config.Refresh), DiskWrite: emptyChartEntries(now, diskWriteSampleLimit, config.Refresh),
}, },
commit: commit, commit: commit,
ethServ: _ethServ, ethServ: ethServ,
lesServ: _lesserv, lesServ: lesServ,
} }
return db, nil return db, nil
} }
@ -313,7 +313,7 @@ func (db *Dashboard) collectData() {
prevDiskRead = curDiskRead prevDiskRead = curDiskRead
prevDiskWrite = curDiskWrite prevDiskWrite = curDiskWrite
// extract metrics from downloaded and push to registry // extract measurements from eth.Downloader and push to metrics registry
p := db.ethServ.Downloader().Progress() p := db.ethServ.Downloader().Progress()
metrics.GetOrRegisterGauge("currentBlock", nil).Update(int64(p.CurrentBlock)) metrics.GetOrRegisterGauge("currentBlock", nil).Update(int64(p.CurrentBlock))
@ -322,14 +322,6 @@ func (db *Dashboard) collectData() {
metrics.GetOrRegisterGauge("pulledStates", nil).Update(int64(p.PulledStates)) metrics.GetOrRegisterGauge("pulledStates", nil).Update(int64(p.PulledStates))
metrics.GetOrRegisterGauge("knownStates", nil).Update(int64(p.KnownStates)) metrics.GetOrRegisterGauge("knownStates", nil).Update(int64(p.KnownStates))
syncing := db.ethServ.BlockChain().CurrentHeader().Number.Uint64() >= p.HighestBlock
if syncing {
metrics.GetOrRegisterGauge("isSyncing", nil).Update(1)
} else {
metrics.GetOrRegisterGauge("isSyncing", nil).Update(0)
}
now := time.Now() now := time.Now()
runtime.ReadMemStats(&mem) runtime.ReadMemStats(&mem)