Skip to content

Commit

Permalink
fix(metrics): accurate record waiting chainHead stable delay
Browse files Browse the repository at this point in the history
  • Loading branch information
ta0li committed Jul 20, 2022
1 parent 53f5001 commit 0b745b7
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 7 deletions.
2 changes: 1 addition & 1 deletion metrics/metrics.go
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ var (
ExpiredMsgNumOfLastRound = stats.Int64("expired_msg_num", "Number of expired messages in the last round", stats.UnitDimensionless)
ErrMsgNumOfLastRound = stats.Int64("err_msg_num", "Number of err messages in the last round", stats.UnitDimensionless)

ChainHeadStableDelay = stats.Int64("chain_head_stable_s", "Duration of chain head stabilization", stats.UnitSeconds)
ChainHeadStableDelay = stats.Int64("chain_head_stable_s", "Duration of chain head stabilization", stats.UnitSeconds)
)

var (
Expand Down
2 changes: 1 addition & 1 deletion models/sqlite/shared_params.go
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ type sqliteSharedParams struct {

GasOverEstimation float64 `gorm:"column:gas_over_estimation;type:REAL;NOT NULL"`
MaxFee mtypes.Int `gorm:"column:max_fee;type:varchar(256);NOT NULL"`
GasFeeCap mtypes.Int `gorm:"column:gas_fee_cap;type:varchar(256);NOT NULL"`
GasFeeCap mtypes.Int `gorm:"column:gas_fee_cap;type:varchar(256);default:0;NOT NULL"`
GasOverPremium float64 `gorm:"column:gas_over_premium;type:REAL;"`

SelMsgNum uint64 `gorm:"column:sel_msg_num;type:UNSIGNED BIG INT;NOT NULL"`
Expand Down
7 changes: 2 additions & 5 deletions service/message_state_refresh.go
Original file line number Diff line number Diff line change
Expand Up @@ -165,13 +165,10 @@ func (ms *MessageService) updateMessageState(ctx context.Context, tsKeys map[abi

// delayTrigger wait for stable ts
func (ms *MessageService) delayTrigger(ctx context.Context, ts *venustypes.TipSet) {
defer func() {
ds := time.Now().Unix() - int64(ts.MinTimestamp())
stats.Record(ctx, metrics.ChainHeadStableDelay.M(ds))
}()

select {
case <-time.After(ms.fsRepo.Config().MessageService.WaitingChainHeadStableDuration):
ds := time.Now().Unix() - int64(ts.MinTimestamp())
stats.Record(ctx, metrics.ChainHeadStableDelay.M(ds))
ms.triggerPush <- ts
return
case <-ctx.Done():
Expand Down

0 comments on commit 0b745b7

Please sign in to comment.