diff --git a/app/app.go b/app/app.go index a2c1147196..84f8761d67 100644 --- a/app/app.go +++ b/app/app.go @@ -924,11 +924,13 @@ func (app *App) DeliverTxWithResult(ctx sdk.Context, tx []byte) *abci.ExecTxResu } func (app *App) ProcessBlockSynchronous(ctx sdk.Context, txs [][]byte) []*abci.ExecTxResult { + defer metrics.BlockProcessLatency(time.Now(), metrics.SYNCHRONOUS) + txResults := []*abci.ExecTxResult{} for _, tx := range txs { txResults = append(txResults, app.DeliverTxWithResult(ctx, tx)) + metrics.IncrTxProcessTypeCounter(metrics.SYNCHRONOUS) } - metrics.IncrTxProcessTypeCounter(metrics.SYNCHRONOUS) return txResults } @@ -978,6 +980,8 @@ func (app *App) ProcessBlockConcurrent( completionSignalingMap map[int]acltypes.MessageCompletionSignalMapping, blockingSignalsMap map[int]acltypes.MessageCompletionSignalMapping, ) []*abci.ExecTxResult { + defer metrics.BlockProcessLatency(time.Now(), metrics.CONCURRENT) + var waitGroup sync.WaitGroup resultChan := make(chan ChannelResult) txResults := []*abci.ExecTxResult{} @@ -1075,10 +1079,11 @@ func (app *App) ProcessBlock(ctx sdk.Context, txs [][]byte, req BlockProcessRequ case acltypes.ErrGovMsgInBlock: ctx.Logger().Info(fmt.Sprintf("Gov msg found while building DAG, processing synchronously: %s", err)) txResults = app.ProcessBlockSynchronous(ctx, txs) - + metrics.IncrDagBuildErrorCounter(metrics.GovMsgInBlock) default: ctx.Logger().Error(fmt.Sprintf("Error while building DAG, processing synchronously: %s", err)) txResults = app.ProcessBlockSynchronous(ctx, txs) + metrics.IncrDagBuildErrorCounter(metrics.FailedToBuild) } endBlockResp := app.EndBlock(ctx, abci.RequestEndBlock{ diff --git a/utils/metrics/labels.go b/utils/metrics/labels.go index 85d8ff122b..282c97d060 100644 --- a/utils/metrics/labels.go +++ b/utils/metrics/labels.go @@ -1,6 +1,8 @@ package metrics const ( - CONCURRENT = "concurrent" - SYNCHRONOUS = "synchronous" + CONCURRENT = "concurrent" + SYNCHRONOUS = "synchronous" + GovMsgInBlock = "gov-msg-in-block" + FailedToBuild = "failed-to-build" ) diff --git a/utils/metrics/metrics_util.go b/utils/metrics/metrics_util.go index db7daa5aa7..005c50e873 100644 --- a/utils/metrics/metrics_util.go +++ b/utils/metrics/metrics_util.go @@ -19,29 +19,41 @@ func IncrTxProcessTypeCounter(processType string) { ) } -// Measures the time taken to execute a sudo msg +// Measures the time taken to process a block by the process type // Metric Names: // -// sei_deliver_tx_duration_miliseconds -// sei_deliver_tx_duration_miliseconds_count -// sei_deliver_tx_duration_miliseconds_sum -func MeasureDeliverTxDuration(start time.Time) { - metrics.MeasureSince( - []string{"sei", "deliver", "tx", "milliseconds"}, +// sei_process_block_miliseconds +// sei_process_block_miliseconds_count +// sei_process_block_miliseconds_sum +func BlockProcessLatency(start time.Time, processType string) { + metrics.MeasureSinceWithLabels( + []string{"sei", "process", "block", "milliseconds"}, start.UTC(), + []metrics.Label{telemetry.NewLabel("type", processType)}, ) } // Measures the time taken to execute a sudo msg // Metric Names: // -// sei_dag_build_duration_miliseconds -// sei_dag_build_duration_miliseconds_count -// sei_dag_build_duration_miliseconds_sum -func MeasureBuildDagDuration(start time.Time, method string) { - metrics.MeasureSinceWithLabels( - []string{"sei", "dag", "build", "milliseconds"}, +// sei_tx_process_type_count +func IncrDagBuildErrorCounter(reason string) { + metrics.IncrCounterWithLabels( + []string{"sei", "dag", "build", "error"}, + 1, + []metrics.Label{telemetry.NewLabel("reason", reason)}, + ) +} + +// Measures the time taken to execute a sudo msg +// Metric Names: +// +// sei_deliver_tx_duration_miliseconds +// sei_deliver_tx_duration_miliseconds_count +// sei_deliver_tx_duration_miliseconds_sum +func MeasureDeliverTxDuration(start time.Time) { + metrics.MeasureSince( + []string{"sei", "deliver", "tx", "milliseconds"}, start.UTC(), - []metrics.Label{telemetry.NewLabel("method", method)}, ) } diff --git a/x/oracle/simulation/operations.go b/x/oracle/simulation/operations.go index 6b3dc6c946..e7af90f2a9 100644 --- a/x/oracle/simulation/operations.go +++ b/x/oracle/simulation/operations.go @@ -83,7 +83,7 @@ func WeightedOperations( } // SimulateMsgAggregateExchangeRatePrevote generates a MsgAggregateExchangeRatePrevote with random values. -//nolint: funlen +// nolint: funlen func SimulateMsgAggregateExchangeRatePrevote(ak types.AccountKeeper, bk types.BankKeeper, k keeper.Keeper) simtypes.Operation { return func( r *rand.Rand, app *baseapp.BaseApp, ctx sdk.Context, accs []simtypes.Account, chainID string, @@ -146,7 +146,7 @@ func SimulateMsgAggregateExchangeRatePrevote(ak types.AccountKeeper, bk types.Ba } // SimulateMsgAggregateExchangeRateVote generates a MsgAggregateExchangeRateVote with random values. -//nolint: funlen +// nolint: funlen func SimulateMsgAggregateExchangeRateVote(ak types.AccountKeeper, bk types.BankKeeper, k keeper.Keeper) simtypes.Operation { return func( r *rand.Rand, app *baseapp.BaseApp, ctx sdk.Context, accs []simtypes.Account, chainID string, @@ -213,7 +213,7 @@ func SimulateMsgAggregateExchangeRateVote(ak types.AccountKeeper, bk types.BankK } // SimulateMsgDelegateFeedConsent generates a MsgDelegateFeedConsent with random values. -//nolint: funlen +// nolint: funlen func SimulateMsgDelegateFeedConsent(ak types.AccountKeeper, bk types.BankKeeper, k keeper.Keeper) simtypes.Operation { return func( r *rand.Rand, app *baseapp.BaseApp, ctx sdk.Context, accs []simtypes.Account, chainID string,