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
2 changes: 2 additions & 0 deletions utils/logging/time.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ import (
"fmt"
"time"

"github.com/sei-protocol/sei-chain/utils/metrics"
"github.com/tendermint/tendermint/libs/log"
)

Expand Down Expand Up @@ -35,6 +36,7 @@ func LogIfNotDoneAfter[R any](logger log.Logger, task func() (R, error), after t
// reraise panic in main goroutine
panic(err)
case <-time.After(after):
metrics.IncrLogIfNotDoneAfter(label)
logger.Error(fmt.Sprintf("%s still not finished after %s", label, after))
}
}
Expand Down
14 changes: 14 additions & 0 deletions utils/metrics/metrics_util.go
Original file line number Diff line number Diff line change
Expand Up @@ -92,6 +92,20 @@ func IncrFailedConcurrentDeliverTxCounter() {
)
}

// Counts the number of operations that failed due to operation timeout
// Metric Names:
//
// sei_log_not_done_after_counter
func IncrLogIfNotDoneAfter(label string) {
metrics.IncrCounterWithLabels(
[]string{"sei", "log", "not", "done", "after"},
1,
[]metrics.Label{
telemetry.NewLabel("label", label),
},
)
}

// Measures the time taken to execute a sudo msg
// Metric Names:
//
Expand Down
2 changes: 1 addition & 1 deletion x/dex/contract/runner.go
Original file line number Diff line number Diff line change
Expand Up @@ -123,7 +123,7 @@ func (r *ParallelRunner) Run() {
_, err := logging.LogIfNotDoneAfter(r.sdkCtx.Logger(), func() (struct{}, error) {
<-r.someContractFinished
return struct{}{}, nil
}, LogAfter, "runner wait for some contract to finish")
}, LogAfter, "dex_parallel_runner_wait")
if err != nil {
// this should never happen
panic(err)
Expand Down
2 changes: 1 addition & 1 deletion x/dex/keeper/utils/wasm.go
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,7 @@ func sudoWithoutOutOfGasPanic(ctx sdk.Context, k *keeper.Keeper, contractAddress
}()
return logging.LogIfNotDoneAfter(ctx.Logger(), func() ([]byte, error) {
return k.WasmKeeper.Sudo(ctx, contractAddress, wasmMsg)
}, LogAfter, logName)
}, LogAfter, fmt.Sprintf("wasm_sudo_%s", logName))
}

func hasErrInstantiatingWasmModuleDueToCPUFeature(err error) bool {
Expand Down
4 changes: 2 additions & 2 deletions x/oracle/simulation/operations.go
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ func WeightedOperations(
}

// 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 @@ -122,7 +122,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