Skip to content

Commit

Permalink
fix(baseapp): startTime of telemetry metric should be calculated …
Browse files Browse the repository at this point in the history
…before `defer` (#21968)
  • Loading branch information
beepdeepor authored Sep 29, 2024
1 parent e82949d commit d5f24de
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion baseapp/abci.go
Original file line number Diff line number Diff line change
Expand Up @@ -180,7 +180,8 @@ func (app *BaseApp) Query(_ context.Context, req *abci.QueryRequest) (resp *abci

telemetry.IncrCounter(1, "query", "count")
telemetry.IncrCounter(1, "query", req.Path)
defer telemetry.MeasureSince(telemetry.Now(), req.Path)
start := telemetry.Now()
defer telemetry.MeasureSince(start, req.Path)

if req.Path == QueryPathBroadcastTx {
return queryResult(errorsmod.Wrap(sdkerrors.ErrInvalidRequest, "can't route a broadcast tx message"), app.trace), nil
Expand Down

0 comments on commit d5f24de

Please sign in to comment.