From d40677a9314c5a5707eb89b403f7861ee7679670 Mon Sep 17 00:00:00 2001 From: Julien Robert Date: Fri, 12 Apr 2024 13:09:53 +0200 Subject: [PATCH] chore: make telemetry consistent (#20025) --- baseapp/abci.go | 2 +- x/circuit/module.go | 3 --- x/crisis/module.go | 2 -- x/epochs/keeper/abci.go | 3 +-- 4 files changed, 2 insertions(+), 8 deletions(-) diff --git a/baseapp/abci.go b/baseapp/abci.go index 0abc1725d2d7..148205e360e6 100644 --- a/baseapp/abci.go +++ b/baseapp/abci.go @@ -177,7 +177,7 @@ func (app *BaseApp) Query(_ context.Context, req *abci.RequestQuery) (resp *abci telemetry.IncrCounter(1, "query", "count") telemetry.IncrCounter(1, "query", req.Path) - defer telemetry.MeasureSince(time.Now(), req.Path) + defer telemetry.MeasureSince(telemetry.Now(), req.Path) if req.Path == QueryPathBroadcastTx { return sdkerrors.QueryResult(errorsmod.Wrap(sdkerrors.ErrInvalidRequest, "can't route a broadcast tx message"), app.trace), nil diff --git a/x/circuit/module.go b/x/circuit/module.go index 8f7e4b4e389b..32dd06677651 100644 --- a/x/circuit/module.go +++ b/x/circuit/module.go @@ -15,7 +15,6 @@ import ( "github.com/cosmos/cosmos-sdk/client" "github.com/cosmos/cosmos-sdk/codec" - "github.com/cosmos/cosmos-sdk/telemetry" "github.com/cosmos/cosmos-sdk/types/module" ) @@ -92,12 +91,10 @@ func (am AppModule) ValidateGenesis(bz json.RawMessage) error { // InitGenesis performs genesis initialization for the circuit module. func (am AppModule) InitGenesis(ctx context.Context, data json.RawMessage) error { - start := telemetry.Now() var genesisState types.GenesisState if err := am.cdc.UnmarshalJSON(data, &genesisState); err != nil { return err } - telemetry.MeasureSince(start, "InitGenesis", "crisis", "unmarshal") return am.keeper.InitGenesis(ctx, &genesisState) } diff --git a/x/crisis/module.go b/x/crisis/module.go index 7da203a6a0f5..0a17ce54908b 100644 --- a/x/crisis/module.go +++ b/x/crisis/module.go @@ -12,7 +12,6 @@ import ( "cosmossdk.io/core/registry" "github.com/cosmos/cosmos-sdk/codec" - "github.com/cosmos/cosmos-sdk/telemetry" "github.com/cosmos/cosmos-sdk/types/module" "github.com/cosmos/cosmos-sdk/x/crisis/keeper" "github.com/cosmos/cosmos-sdk/x/crisis/types" @@ -121,7 +120,6 @@ func (am AppModule) InitGenesis(ctx context.Context, data json.RawMessage) error if err := am.cdc.UnmarshalJSON(data, &genesisState); err != nil { return err } - telemetry.MeasureSince(telemetry.Now(), "InitGenesis", "crisis", "unmarshal") am.keeper.InitGenesis(ctx, &genesisState) if !am.skipGenesisInvariants { diff --git a/x/epochs/keeper/abci.go b/x/epochs/keeper/abci.go index 826a0da5e6d8..e05399e9b02e 100644 --- a/x/epochs/keeper/abci.go +++ b/x/epochs/keeper/abci.go @@ -3,7 +3,6 @@ package keeper import ( "context" "fmt" - "time" "cosmossdk.io/x/epochs/types" @@ -12,7 +11,7 @@ import ( // BeginBlocker of epochs module. func (k Keeper) BeginBlocker(ctx context.Context) error { - defer telemetry.ModuleMeasureSince(types.ModuleName, time.Now(), telemetry.MetricKeyBeginBlocker) + defer telemetry.ModuleMeasureSince(types.ModuleName, telemetry.Now(), telemetry.MetricKeyBeginBlocker) logger := k.Logger() headerInfo := k.environment.HeaderService.GetHeaderInfo(ctx)