fix(baseapp): startTime of telemetry metric should be calculated before defer (#21968)

This commit is contained in:
beep 2024-09-30 02:19:15 +08:00 committed by GitHub
parent e82949d57d
commit d5f24de7e1
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -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