Skip to content

Commit d932b9a

Browse files
authored
Merge pull request #348 from hkalina/develop-fix-metrics-pr
Fix block processing metrics, remove unused metrics
2 parents 1ccc2f4 + c15d152 commit d932b9a

File tree

1 file changed

+9
-14
lines changed

1 file changed

+9
-14
lines changed

gossip/c_block_callbacks.go

Lines changed: 9 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -50,14 +50,8 @@ var (
5050
snapshotCommitTimer = metrics.GetOrRegisterTimer("chain/snapshot/commits", nil)
5151

5252
blockInsertTimer = metrics.GetOrRegisterTimer("chain/inserts", nil)
53-
blockValidationTimer = metrics.GetOrRegisterTimer("chain/validation", nil)
5453
blockExecutionTimer = metrics.GetOrRegisterTimer("chain/execution", nil)
5554
blockWriteTimer = metrics.GetOrRegisterTimer("chain/write", nil)
56-
57-
_ = metrics.GetOrRegisterMeter("chain/reorg/executes", nil)
58-
_ = metrics.GetOrRegisterMeter("chain/reorg/add", nil)
59-
_ = metrics.GetOrRegisterMeter("chain/reorg/drop", nil)
60-
_ = metrics.GetOrRegisterMeter("chain/reorg/invalidTx", nil)
6155
)
6256

6357
type ExtendedTxPosition struct {
@@ -256,7 +250,7 @@ func consensusCallbackBeginBlockFn(
256250
}
257251

258252
evmProcessor := blockProc.EVMModule.Start(blockCtx, statedb, evmStateReader, onNewLogAll, es.Rules, es.Rules.EvmChainConfig(store.GetUpgradeHeights()))
259-
substart := time.Now()
253+
executionStart := time.Now()
260254

261255
// Execute pre-internal transactions
262256
preInternalTxs := blockProc.PreTxTransactor.PopInternalTxs(blockCtx, bs, es, sealing, statedb)
@@ -399,14 +393,13 @@ func consensusCallbackBeginBlockFn(
399393
storageUpdateTimer.Update(statedb.StorageUpdates)
400394
snapshotAccountReadTimer.Update(statedb.SnapshotAccountReads)
401395
snapshotStorageReadTimer.Update(statedb.SnapshotStorageReads)
402-
triehash := statedb.AccountHashes + statedb.StorageHashes // save to not double count in validation
403-
trieproc := statedb.SnapshotAccountReads + statedb.AccountReads + statedb.AccountUpdates
404-
trieproc += statedb.SnapshotStorageReads + statedb.StorageReads + statedb.StorageUpdates
405-
blockExecutionTimer.Update(time.Since(substart) - trieproc - triehash)
406-
// Update the metrics touched during block validation
407396
accountHashTimer.Update(statedb.AccountHashes)
408397
storageHashTimer.Update(statedb.StorageHashes)
409-
blockValidationTimer.Update(time.Since(substart) - (statedb.AccountHashes + statedb.StorageHashes - triehash))
398+
triehash := statedb.AccountHashes + statedb.StorageHashes
399+
trieproc := statedb.SnapshotAccountReads + statedb.AccountReads + statedb.AccountUpdates
400+
trieproc += statedb.SnapshotStorageReads + statedb.StorageReads + statedb.StorageUpdates
401+
blockExecutionTimer.Update(time.Since(executionStart) - trieproc - triehash)
402+
410403
// Update the metrics touched by new block
411404
headBlockGauge.Update(int64(blockCtx.Idx))
412405
headHeaderGauge.Update(int64(blockCtx.Idx))
@@ -424,12 +417,14 @@ func consensusCallbackBeginBlockFn(
424417
feed.newLogs.Send(logs)
425418
}
426419

420+
commitStart := time.Now()
427421
store.commitEVM(false)
422+
428423
// Update the metrics touched during block commit
429424
accountCommitTimer.Update(statedb.AccountCommits)
430425
storageCommitTimer.Update(statedb.StorageCommits)
431426
snapshotCommitTimer.Update(statedb.SnapshotCommits)
432-
blockWriteTimer.Update(time.Since(substart) - statedb.AccountCommits - statedb.StorageCommits - statedb.SnapshotCommits)
427+
blockWriteTimer.Update(time.Since(commitStart) - statedb.AccountCommits - statedb.StorageCommits - statedb.SnapshotCommits)
433428
blockInsertTimer.UpdateSince(start)
434429

435430
now := time.Now()

0 commit comments

Comments
 (0)