Skip to content

Commit

Permalink
fix(baseapp):startTime of telemetry metric should be calculate outs…
Browse files Browse the repository at this point in the history
…ide `defer`
  • Loading branch information
beepdeepor committed Sep 29, 2024
1 parent e82949d commit 39682b0
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion baseapp/abci.go
Original file line number Diff line number Diff line change
Expand Up @@ -180,7 +180,9 @@ 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 39682b0

Please sign in to comment.