swarm/storage: added metrics for db entry count (#17589)
This commit is contained in:
@ -48,6 +48,10 @@ const (
|
||||
maxGCitems = 5000 // max number of items to be gc'd per call to collectGarbage()
|
||||
)
|
||||
|
||||
var (
|
||||
dbEntryCount = metrics.NewRegisteredCounter("ldbstore.entryCnt", nil)
|
||||
)
|
||||
|
||||
var (
|
||||
keyIndex = byte(0)
|
||||
keyOldData = byte(1)
|
||||
@ -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)
|
||||
|
Reference in New Issue
Block a user