go-zero icon indicating copy to clipboard operation
go-zero copied to clipboard

Inconsistent Redis query records in Jaeger tracing

Open JackGod001 opened this issue 1 year ago • 0 comments

Describe the bug The Redis query records for the same request address in the Jaeger trace are inconsistent. Some traces show Redis query operations and some don't, even though the code performs a Redis get operation for each request, and all requests return the same result. To Reproduce Steps to reproduce the behavior, if applicable: https://github.com/JackGod001/go_zero_pgsql

  1. The code is

    func (l *GetUserLogic) GetUser(req *types.GetUserRequest) (resp *types.GetUserResponse, err error) {
     userModel, err := l.svcCtx.UsersModel.FindOne(l.ctx, req.Id)
     if err != nil {
     	logx.WithContext(l.ctx).Errorf("UsersModel.FindOne", err.Error())
     	return nil, err
     }
     return &types.GetUserResponse{
     	Username:  userModel.Username,
     	CreatedAt: userModel.CreatedAt.Format("2006-01-02 15:04:05"),
     }, nil
    

}


2. The error is

In the Jaeger UI, for different traces of the same request address, some show the Redis get operation, while others don't.


**Expected behavior**
All Jaeger traces should contain the Redis query operation for the same request address, as it is actually executed in the code.

**Screenshots**
![image](https://github.com/user-attachments/assets/6e489aa3-39f0-4418-ad8d-72b7b1b2d637)
![image](https://github.com/user-attachments/assets/8aaef0dd-68e4-4c82-8255-d10a77960b4e)

**Environments (please complete the following information):**
- OS: docker
- go-zero version v1.7.0
- goctl version v1.7.0

**More description**

JackGod001 avatar Sep 04 '24 10:09 JackGod001