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

Consider supporting log tracing in request scope #612

Open
wrayzheng opened this issue Aug 11, 2020 · 0 comments
Open

Consider supporting log tracing in request scope #612

wrayzheng opened this issue Aug 11, 2020 · 0 comments
Labels
enhancement New feature or request
Milestone

Comments

@wrayzheng
Copy link
Contributor

Is your feature request related to a problem? Please describe.
Since BFE is an application designed for high concurrency, in most cases, large numbers of requests are processed at the same time.
When I want to inspect the debug log throughout the lifecycle of a request, I found that there is no way to tell apart from the logs of thousands of other requests.

Describe the solution you'd like
Associate the log with a request id to identify which request it is related, or provide a mechanism to make it easy to enable the log tracing of any request.

Describe alternatives you've considered
As far as I know, there are generally two ways to do it. One way is to store the request id in a request scoped context, and pass the context object through the call stack; wherever we print a log, we append the request id retrieved from the context.(see: https://blog.golang.org/context) Another way is to store the request id in the goroutine local storage, which requires third-party implementation and is not recommended officially.(see: https://github.com/jtolio/gls)

I prefer the former way because it conforms to golang code style, though it requires numerous modifications of the source code.

@iyangsj iyangsj added the enhancement New feature or request label Aug 11, 2020
@iyangsj iyangsj added this to the Proposal milestone Aug 11, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

2 participants