chore: add telemetry measurement to x/auth PreBlocker (#24541)
This commit is contained in:
parent
553f8955c3
commit
2e7bed9e72
@ -66,6 +66,8 @@ Ref: https://keepachangelog.com/en/1.0.0/
|
||||
|
||||
### Improvements
|
||||
|
||||
* (telemetry) [#24541](https://github.com/cosmos/cosmos-sdk/pull/24541) Telemetry now includes a pre_blocker metric key. x/upgrade should migrate to this key in v0.54.0.
|
||||
* (x/auth) [#24541](https://github.com/cosmos/cosmos-sdk/pull/24541) x/auth's PreBlocker now emits telemetry under the pre_blocker metric key.
|
||||
* (x/bank) [#24431](https://github.com/cosmos/cosmos-sdk/pull/24431) Reduce the number of `ValidateDenom` calls in `bank.SendCoins` and `Coin`.
|
||||
* The `AmountOf()` method on`sdk.Coins` no longer will `panic` if given an invalid denom and will instead return a zero value.
|
||||
* (x/staking) [#24391](https://github.com/cosmos/cosmos-sdk/pull/24391) Replace panics with error results; more verbose error messages
|
||||
|
||||
@ -8,6 +8,7 @@ import (
|
||||
|
||||
// Common metric key constants
|
||||
const (
|
||||
MetricKeyPreBlocker = "pre_blocker"
|
||||
MetricKeyBeginBlocker = "begin_blocker"
|
||||
MetricKeyEndBlocker = "end_blocker"
|
||||
MetricLabelNameModule = "module"
|
||||
|
||||
@ -16,6 +16,7 @@ import (
|
||||
"github.com/cosmos/cosmos-sdk/client"
|
||||
"github.com/cosmos/cosmos-sdk/codec"
|
||||
codectypes "github.com/cosmos/cosmos-sdk/codec/types"
|
||||
"github.com/cosmos/cosmos-sdk/telemetry"
|
||||
"github.com/cosmos/cosmos-sdk/testutil/simsx"
|
||||
sdk "github.com/cosmos/cosmos-sdk/types"
|
||||
"github.com/cosmos/cosmos-sdk/types/module"
|
||||
@ -99,6 +100,8 @@ type AppModule struct {
|
||||
// PreBlock cleans up expired unordered transaction nonces from state.
|
||||
// Please ensure to add `x/auth`'s module name to the OrderPreBlocker list in your application.
|
||||
func (am AppModule) PreBlock(ctx context.Context) (appmodule.ResponsePreBlock, error) {
|
||||
start := telemetry.Now()
|
||||
defer telemetry.ModuleMeasureSince(types.ModuleName, start, telemetry.MetricKeyPreBlocker)
|
||||
err := am.accountKeeper.RemoveExpiredUnorderedNonces(sdk.UnwrapSDKContext(ctx))
|
||||
if err != nil {
|
||||
return nil, err
|
||||
|
||||
@ -22,6 +22,8 @@ import (
|
||||
// The purpose is to ensure the binary is switched EXACTLY at the desired block, and to allow
|
||||
// a migration to be executed if needed upon this switch (migration defined in the new binary)
|
||||
// skipUpgradeHeightArray is a set of block heights for which the upgrade must be skipped
|
||||
//
|
||||
// Note: The MetricKey will change to MetricKeyPreBlocker in v0.54.0.
|
||||
func PreBlocker(ctx context.Context, k *keeper.Keeper) (appmodule.ResponsePreBlock, error) {
|
||||
defer telemetry.ModuleMeasureSince(types.ModuleName, telemetry.Now(), telemetry.MetricKeyBeginBlocker)
|
||||
|
||||
|
||||
Loading…
Reference in New Issue
Block a user