mirror of
https://github.com/ethereum/go-ethereum.git
synced 2026-08-18 09:53:48 +00:00
swarm/storage: update requests cache gauge every 5 sec.
This commit is contained in:
parent
74b50623b6
commit
a9dbf154c2
2 changed files with 7 additions and 1 deletions
|
|
@ -211,6 +211,11 @@ func (self *LocalStore) GetOrCreateRequest(key Key) (chunk *Chunk, created bool)
|
||||||
return chunk, true
|
return chunk, true
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// RequestsCacheLen returns the current number of outgoing requests stored in the cache
|
||||||
|
func (self *LocalStore) RequestsCacheLen() int {
|
||||||
|
return self.memStore.requests.Len()
|
||||||
|
}
|
||||||
|
|
||||||
// Close the local store
|
// Close the local store
|
||||||
func (self *LocalStore) Close() {
|
func (self *LocalStore) Close() {
|
||||||
self.DbStore.Close()
|
self.DbStore.Close()
|
||||||
|
|
|
||||||
|
|
@ -58,7 +58,7 @@ var (
|
||||||
startCounter = metrics.NewRegisteredCounter("stack,start", nil)
|
startCounter = metrics.NewRegisteredCounter("stack,start", nil)
|
||||||
stopCounter = metrics.NewRegisteredCounter("stack,stop", nil)
|
stopCounter = metrics.NewRegisteredCounter("stack,stop", nil)
|
||||||
uptimeGauge = metrics.NewRegisteredGauge("stack.uptime", nil)
|
uptimeGauge = metrics.NewRegisteredGauge("stack.uptime", nil)
|
||||||
cacheSizeGauge = metrics.NewRegisteredGauge("storage.db.cache.size", nil)
|
requestsCacheGauge = metrics.NewRegisteredGauge("storage.cache.requests.size", nil)
|
||||||
)
|
)
|
||||||
|
|
||||||
// the swarm stack
|
// the swarm stack
|
||||||
|
|
@ -420,6 +420,7 @@ func (self *Swarm) periodicallyUpdateGauges() {
|
||||||
|
|
||||||
func (self *Swarm) updateGauges() {
|
func (self *Swarm) updateGauges() {
|
||||||
uptimeGauge.Update(time.Since(startTime).Nanoseconds())
|
uptimeGauge.Update(time.Since(startTime).Nanoseconds())
|
||||||
|
requestsCacheGauge.Update(int64(self.lstore.RequestsCacheLen()))
|
||||||
}
|
}
|
||||||
|
|
||||||
// implements the node.Service interface
|
// implements the node.Service interface
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue