forked from forks/go-ethereum
core/rawdb,state: add preimage miss metric (#31295)
1. The metric of preimage/hits are always the same as preimage/total, prefer to replace the hits with miss instead. 2. For the state/read/accounts metric, follow the same naming of others, change into singuar.
This commit is contained in:
parent
d219e9b005
commit
9aba6895b9
3 changed files with 9 additions and 4 deletions
|
|
@ -27,6 +27,11 @@ import (
|
|||
// ReadPreimage retrieves a single preimage of the provided hash.
|
||||
func ReadPreimage(db ethdb.KeyValueReader, hash common.Hash) []byte {
|
||||
data, _ := db.Get(preimageKey(hash))
|
||||
if len(data) == 0 {
|
||||
preimageMissCounter.Inc(1)
|
||||
} else {
|
||||
preimageHitsCounter.Inc(1)
|
||||
}
|
||||
return data
|
||||
}
|
||||
|
||||
|
|
@ -38,7 +43,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.
|
||||
|
|
|
|||
|
|
@ -145,8 +145,9 @@ 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)
|
||||
preimageHitsCounter = metrics.NewRegisteredCounter("db/preimage/hits", nil)
|
||||
preimageMissCounter = metrics.NewRegisteredCounter("db/preimage/miss", nil)
|
||||
)
|
||||
|
||||
// LegacyTxLookupEntry is the legacy TxLookupEntry definition with some unnecessary
|
||||
|
|
|
|||
|
|
@ -19,7 +19,7 @@ package state
|
|||
import "github.com/ethereum/go-ethereum/metrics"
|
||||
|
||||
var (
|
||||
accountReadMeters = metrics.NewRegisteredMeter("state/read/accounts", nil)
|
||||
accountReadMeters = metrics.NewRegisteredMeter("state/read/account", nil)
|
||||
storageReadMeters = metrics.NewRegisteredMeter("state/read/storage", nil)
|
||||
accountUpdatedMeter = metrics.NewRegisteredMeter("state/update/account", nil)
|
||||
storageUpdatedMeter = metrics.NewRegisteredMeter("state/update/storage", nil)
|
||||
|
|
|
|||
Loading…
Reference in a new issue