Skip to content

Commit 185a241

Browse files
authored
metric: add more block monitor metrics; (#2961)
1 parent 9967a29 commit 185a241

File tree

2 files changed

+6
-2
lines changed

2 files changed

+6
-2
lines changed

core/blockchain.go

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -72,7 +72,9 @@ var (
7272
justifiedBlockGauge = metrics.NewRegisteredGauge("chain/head/justified", nil)
7373
finalizedBlockGauge = metrics.NewRegisteredGauge("chain/head/finalized", nil)
7474

75-
blockInsertMgaspsGauge = metrics.NewRegisteredGauge("chain/insert/mgasps", nil)
75+
blockInsertMgaspsGauge = metrics.NewRegisteredGauge("chain/insert/mgasps", nil)
76+
blockInsertTxSizeGauge = metrics.NewRegisteredGauge("chain/insert/txsize", nil)
77+
blockInsertGasUsedGauge = metrics.NewRegisteredGauge("chain/insert/gasused", nil)
7678

7779
chainInfoGauge = metrics.NewRegisteredGaugeInfo("chain/info", nil)
7880

@@ -2498,6 +2500,8 @@ func (bc *BlockChain) processBlock(block *types.Block, statedb *state.StateDB, s
24982500
}
24992501
blockWriteTimer.Update(time.Since(wstart) - max(statedb.AccountCommits, statedb.StorageCommits) /* concurrent */ - statedb.SnapshotCommits - statedb.TrieDBCommits)
25002502
blockInsertTimer.UpdateSince(start)
2503+
blockInsertTxSizeGauge.Update(int64(len(block.Transactions())))
2504+
blockInsertGasUsedGauge.Update(int64(block.GasUsed()))
25012505

25022506
return &blockProcessingResult{usedGas: res.GasUsed, procTime: proctime, status: status}, nil
25032507
}

eth/backend.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -737,7 +737,7 @@ func (s *Ethereum) reportRecentBlocksLoop() {
737737
records["ImportedBlockTime"] = common.FormatMilliTime(importedBlockTime)
738738

739739
records["Coinbase"] = cur.Coinbase.String()
740-
blockMsTime := int64(cur.Time * 1000)
740+
blockMsTime := int64(cur.MilliTimestamp())
741741
records["BlockTime"] = common.FormatMilliTime(blockMsTime)
742742
metrics.GetOrRegisterLabel("report-blocks", nil).Mark(records)
743743

0 commit comments

Comments
 (0)