Skip to content

Commit

Permalink
update mint metric (#4499)
Browse files Browse the repository at this point in the history
  • Loading branch information
envestcc authored Nov 21, 2024
1 parent 65044c7 commit a243cf6
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 4 deletions.
3 changes: 2 additions & 1 deletion blockchain/blockchain.go
Original file line number Diff line number Diff line change
Expand Up @@ -424,7 +424,8 @@ func (bc *blockchain) MintNewBlock(timestamp time.Time) (*block.Block, error) {
if err != nil {
return nil, errors.Wrapf(err, "failed to create block")
}

_blockMtc.WithLabelValues("MintGas").Set(float64(blk.GasUsed()))
_blockMtc.WithLabelValues("MintActions").Set(float64(len(blk.Actions)))
return &blk, nil
}

Expand Down
6 changes: 3 additions & 3 deletions state/factory/workingset.go
Original file line number Diff line number Diff line change
Expand Up @@ -679,13 +679,12 @@ func (ws *workingSet) pickAndRunActions(
if deadline != nil && time.Now().After(*deadline) {
duration := time.Since(blkCtx.BlockTimeStamp)
log.L().Warn("Stop processing actions due to deadline, please consider increasing hardware", zap.Time("deadline", *deadline), zap.Duration("duration", duration), zap.Int("actions", len(executedActions)), zap.Uint64("gas", fullGas-blkCtx.GasLimit))
_mintAbility.WithLabelValues("action").Set(float64(len(executedActions)))
_mintAbility.WithLabelValues("gas").Set(float64(fullGas - blkCtx.GasLimit))
_mintAbility.WithLabelValues("duration").Set(float64(duration.Milliseconds()))
_mintAbility.WithLabelValues("saturation").Set(1)
break
}
nextAction, ok := actionIterator.Next()
if !ok {
_mintAbility.WithLabelValues("saturation").Set(0)
break
}
if nextAction.Gas() > blkCtx.GasLimit {
Expand Down Expand Up @@ -767,6 +766,7 @@ func (ws *workingSet) pickAndRunActions(
// To prevent loop all actions in act_pool, we stop processing action when remaining gas is below
// than certain threshold
if blkCtx.GasLimit < allowedBlockGasResidue {
_mintAbility.WithLabelValues("saturation").Set(0)
break
}
}
Expand Down

0 comments on commit a243cf6

Please sign in to comment.