core/rawdb: replace preimage hits metric with miss

Signed-off-by: jsvisa <delweng@gmail.com>
This commit is contained in:
jsvisa 2025-03-01 03:35:31 +00:00
parent 4038c59845
commit 3a6067c9e4
2 changed files with 3 additions and 3 deletions

View file

@ -27,6 +27,7 @@ import (
// ReadPreimage retrieves a single preimage of the provided hash.
func ReadPreimage(db ethdb.KeyValueReader, hash common.Hash) []byte {
data, _ := db.Get(preimageKey(hash))
preimageMissCounter.Inc(1)
return data
}
@ -38,7 +39,6 @@ func WritePreimages(db ethdb.KeyValueWriter, preimages map[common.Hash][]byte) {
}
}
preimageCounter.Inc(int64(len(preimages)))
preimageHitCounter.Inc(int64(len(preimages)))
}
// ReadCode retrieves the contract code of the provided code hash.

View file

@ -145,8 +145,8 @@ var (
FixedCommitteeRootKey = []byte("fixedRoot-") // bigEndian64(syncPeriod) -> committee root hash
SyncCommitteeKey = []byte("committee-") // bigEndian64(syncPeriod) -> serialized committee
preimageCounter = metrics.NewRegisteredCounter("db/preimage/total", nil)
preimageHitCounter = metrics.NewRegisteredCounter("db/preimage/hits", nil)
preimageCounter = metrics.NewRegisteredCounter("db/preimage/total", nil)
preimageMissCounter = metrics.NewRegisteredCounter("db/preimage/miss", nil)
)
// LegacyTxLookupEntry is the legacy TxLookupEntry definition with some unnecessary