Skip to content
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

The trace_id between requests is getting mixed up #3061

Closed
ionling opened this issue Oct 27, 2023 · 4 comments · Fixed by #3069
Closed

The trace_id between requests is getting mixed up #3061

ionling opened this issue Oct 27, 2023 · 4 comments · Fixed by #3069
Labels
question Further information is requested

Comments

@ionling
Copy link
Contributor

ionling commented Oct 27, 2023

What happened:

The trace_id between requests is getting mixed up.

What you expected to happen:

The trace_id between requests is independent.

How to reproduce it (as minimally and precisely as possible):

Use a log.Filter as the global logger
and enable both tracing.Server() and logging.Server() middlewares.

Anything else we need to know?:

this is cauased by log.WithContext().

f.ctx = ctx

Environment:

  • Kratos version (use kratos -v): v2.6.3
  • Go version (use go version): 1.20
@ionling ionling added the bug Something isn't working label Oct 27, 2023
@shenqidebaozi shenqidebaozi added question Further information is requested and removed bug Something isn't working labels Oct 27, 2023
@shenqidebaozi
Copy link
Member

The method provided by global log is different from the helper, so it does not support printing traceid in logging

@ionling
Copy link
Contributor Author

ionling commented Nov 1, 2023

The log.WithContext() function changes the ctx field of the log.Filter input,
This can cause some problems in some situations.

Is this intended?

@shenqidebaozi
Copy link
Member

Let's reorganize the issue. Your problem is that after using the log filter, cannot be printed trace_id? Can a minimum replication environment be provided

@shenqidebaozi
Copy link
Member

alternatively, if you know how to fix it, you can directly submit a merge request

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
question Further information is requested
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants