diff --git a/swarm/storage/localstore.go b/swarm/storage/localstore.go index 2cbb269aa7..88b27bd6ef 100644 --- a/swarm/storage/localstore.go +++ b/swarm/storage/localstore.go @@ -211,6 +211,11 @@ func (self *LocalStore) GetOrCreateRequest(key Key) (chunk *Chunk, created bool) 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 func (self *LocalStore) Close() { self.DbStore.Close() diff --git a/swarm/swarm.go b/swarm/swarm.go index 6b235118f8..0670446965 100644 --- a/swarm/swarm.go +++ b/swarm/swarm.go @@ -58,7 +58,7 @@ var ( startCounter = metrics.NewRegisteredCounter("stack,start", nil) stopCounter = metrics.NewRegisteredCounter("stack,stop", 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 @@ -420,6 +420,7 @@ func (self *Swarm) periodicallyUpdateGauges() { func (self *Swarm) updateGauges() { uptimeGauge.Update(time.Since(startTime).Nanoseconds()) + requestsCacheGauge.Update(int64(self.lstore.RequestsCacheLen())) } // implements the node.Service interface