Skip to content

Commit 80402e7

Browse files
authored
feat(baseapp): add per message telemetry (#22175)
1 parent 838f155 commit 80402e7

2 files changed

Lines changed: 5 additions & 1 deletion

File tree

CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -89,6 +89,7 @@ Every module contains its own CHANGELOG.md. Please refer to the module you are i
8989
* (x/validate) [#21822](https://github.com/cosmos/cosmos-sdk/pull/21822) New module solely responsible for providing ante/post handlers and tx validators for v2. It can be extended by the app developer to provide extra tx validators.
9090
* In comparison to x/auth/tx/config, there is no app config to skip ante/post handlers, as overwriting them in baseapp or not injecting the x/validate module has the same effect.
9191
* (baseapp) [#21979](https://github.com/cosmos/cosmos-sdk/pull/21979) Create CheckTxHandler to allow extending the logic of CheckTx.
92+
* (baseapp) [[#13981](https://github.com/cosmos/cosmos-sdk/issues/13981)] Add per-message telemetry.
9293

9394
### Improvements
9495

baseapp/baseapp.go

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1030,13 +1030,14 @@ func (app *BaseApp) runTx(mode execMode, txBytes []byte, tx sdk.Tx) (gInfo sdk.G
10301030
func (app *BaseApp) runMsgs(ctx sdk.Context, msgs []sdk.Msg, reflectMsgs []protoreflect.Message, mode execMode) (*sdk.Result, error) {
10311031
events := sdk.EmptyEvents()
10321032
msgResponses := make([]*codectypes.Any, 0, len(msgs))
1033-
10341033
// NOTE: GasWanted is determined by the AnteHandler and GasUsed by the GasMeter.
10351034
for i, msg := range msgs {
10361035
if mode != execModeFinalize && mode != execModeSimulate {
10371036
break
10381037
}
10391038

1039+
start := telemetry.Now()
1040+
10401041
handler := app.msgServiceRouter.Handler(msg)
10411042
if handler == nil {
10421043
return nil, errorsmod.Wrapf(sdkerrors.ErrUnknownRequest, "no message handler found for %T", msg)
@@ -1076,6 +1077,8 @@ func (app *BaseApp) runMsgs(ctx sdk.Context, msgs []sdk.Msg, reflectMsgs []proto
10761077
}
10771078
msgResponses = append(msgResponses, msgResponse)
10781079
}
1080+
1081+
telemetry.MeasureSince(start, "tx", "msg", "processing_time", sdk.MsgTypeURL(msg))
10791082
}
10801083

10811084
data, err := makeABCIData(msgResponses)

0 commit comments

Comments
 (0)