aboutsummaryrefslogtreecommitdiffstats
path: root/swarm/storage
diff options
context:
space:
mode:
authorElad <theman@elad.im>2018-09-06 18:11:38 +0800
committerBalint Gabor <balint.g@gmail.com>2018-09-06 18:11:38 +0800
commit580145e96db848cb8e2f8bb8f0621bcacbc9521c (patch)
tree4dd4cb521c5401f631b6cc44a8cf8721e2386520 /swarm/storage
parent4c15ffffdd0aaf3b834be88ff7e7d9ea938c45b4 (diff)
downloaddexon-580145e96db848cb8e2f8bb8f0621bcacbc9521c.tar.gz
dexon-580145e96db848cb8e2f8bb8f0621bcacbc9521c.tar.zst
dexon-580145e96db848cb8e2f8bb8f0621bcacbc9521c.zip
swarm/storage: added metrics for db entry count (#17589)
Diffstat (limited to 'swarm/storage')
-rw-r--r--swarm/storage/ldbstore.go6
1 files changed, 6 insertions, 0 deletions
diff --git a/swarm/storage/ldbstore.go b/swarm/storage/ldbstore.go
index b95aa13b0..bd3501ea2 100644
--- a/swarm/storage/ldbstore.go
+++ b/swarm/storage/ldbstore.go
@@ -49,6 +49,10 @@ const (
)
var (
+ dbEntryCount = metrics.NewRegisteredCounter("ldbstore.entryCnt", nil)
+)
+
+var (
keyIndex = byte(0)
keyOldData = byte(1)
keyAccessCnt = []byte{2}
@@ -495,6 +499,7 @@ func (s *LDBStore) delete(idx uint64, idxKey []byte, po uint8) {
batch.Delete(idxKey)
batch.Delete(getDataKey(idx, po))
s.entryCnt--
+ dbEntryCount.Dec(1)
s.bucketCnt[po]--
cntKey := make([]byte, 2)
cntKey[0] = keyDistanceCnt
@@ -566,6 +571,7 @@ func (s *LDBStore) doPut(chunk *Chunk, index *dpaDBIndex, po uint8) {
index.Idx = s.dataIdx
s.bucketCnt[po] = s.dataIdx
s.entryCnt++
+ dbEntryCount.Inc(1)
s.dataIdx++
cntKey := make([]byte, 2)