Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 7 additions & 2 deletions app/app.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
}

Expand Down Expand Up @@ -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{}
Expand Down Expand Up @@ -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{
Expand Down
6 changes: 4 additions & 2 deletions utils/metrics/labels.go
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
package metrics

const (
CONCURRENT = "concurrent"
SYNCHRONOUS = "synchronous"
CONCURRENT = "concurrent"
SYNCHRONOUS = "synchronous"
GovMsgInBlock = "gov-msg-in-block"
FailedToBuild = "failed-to-build"
)
40 changes: 26 additions & 14 deletions utils/metrics/metrics_util.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This was moved to sei-cosmos

// 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)},
)
}
6 changes: 3 additions & 3 deletions x/oracle/simulation/operations.go
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down Expand Up @@ -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,
Expand Down Expand Up @@ -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,
Expand Down