go-zero
go-zero copied to clipboard
Inconsistent Redis query records in Jaeger tracing
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
-
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**


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