- 
                Notifications
    
You must be signed in to change notification settings  - Fork 4.1k
 
feat: add tracing api and instrument BaseApp #25516
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Conversation
| // implements Queryable. | ||
| func (app *BaseApp) Query(_ context.Context, req *abci.RequestQuery) (resp *abci.ResponseQuery, err error) { | ||
| func (app *BaseApp) Query(ctx context.Context, req *abci.RequestQuery) (resp *abci.ResponseQuery, err error) { | ||
| ctx, span := tracer.Start(ctx, "Query") | 
Check warning
Code scanning / CodeQL
Useless assignment to local variable Warning
          
            
              
                
              
            
            Show autofix suggestion
            Hide autofix suggestion
          
      Copilot Autofix
AI 3 days ago
To fix the problem, the assignment to ctx in ctx, span := tracer.Start(ctx, "Query") should be replaced with the blank identifier _, since the new value is not used afterward. Thus, the line should be updated to _ , span := tracer.Start(ctx, "Query"). This keeps the logic correct and makes clear that the new context is irrelevant, and only span is wanted. No additional imports, method, or definition changes are necessary. Only a single line in baseapp/abci.go needs updating.
- 
    
    
    
Copy modified line R159  
| @@ -156,7 +156,7 @@ | ||
| // Query implements the ABCI interface. It delegates to CommitMultiStore if it | ||
| // implements Queryable. | ||
| func (app *BaseApp) Query(ctx context.Context, req *abci.RequestQuery) (resp *abci.ResponseQuery, err error) { | ||
| ctx, span := tracer.Start(ctx, "Query") | ||
| _, span := tracer.Start(ctx, "Query") | ||
| defer span.End() | ||
| 
             | 
        ||
| // add panic recovery for all queries | 
| 
               | 
          ||
| blockCnt.Add(ctx, 1) | ||
| blockTime.Record(ctx, time.Since(app.blockStartTime).Seconds()) | ||
| app.blockStartTime = time.Now() | 
Check warning
Code scanning / CodeQL
Calling the system time Warning
| fauxMerkleMode: false, | ||
| sigverifyTx: true, | ||
| gasConfig: config.GasConfig{QueryGasLimit: math.MaxUint64}, | ||
| blockStartTime: time.Now(), | 
Check warning
Code scanning / CodeQL
Calling the system time Warning
| // both txbytes and the decoded tx are passed to runTx to avoid the state machine encoding the tx and decoding the transaction twice | ||
| // passing the decoded tx to runTX is optional, it will be decoded if the tx is nil | ||
| func (app *BaseApp) RunTx(mode sdk.ExecMode, txBytes []byte, tx sdk.Tx, txIndex int, txMultiStore storetypes.MultiStore, incarnationCache map[string]any) (gInfo sdk.GasInfo, result *sdk.Result, anteEvents []abci.Event, err error) { | ||
| startTime := time.Now() | 
Check warning
Code scanning / CodeQL
Calling the system time Warning
Description
Closes: #XXXX