-
Notifications
You must be signed in to change notification settings - Fork 1.3k
[logging] Enable storing/extracing of logger from context #16658
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
Conversation
The go.mod diff is silly, but it's because /hold for discussion, if needed |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
From an instrumentation perspective this seems like an excellent addition! 🎉 Even though it's only 3 lines of code, and all it does is delegate to another library, I would have loved a tiny test of it - if it's not too much trouble to add that would be lovely, but I'll approve and leave that decision with you
@mads-hartmann added a test. Thanks! |
Just to clarify it for myself:
? |
@akosyakov Yes. It uses the context to attach a request-scoped logger & fields to it. This means that any fields we add are part of that request lifecycle. Yes, not yet used by services. I've a follow-up PR which adds it to public-api to demonstrate the usage (not yet complete). This then means we can magically have extra context on the log lines. One of the most powerful parts of this is when we attach the trace ID on the log context, and then we can lookup all logs for a given request, even across services (because the tracing ID is propagated) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
no objections from my side
/unhold |
Description
This adds helpers to:
Why?
With the logger on the context, we gain the ability to have request scoped fields on the logger. This means that we can add more fields to the existing context and these will be logged when we actually use the context logger to log.
To better illustrate this:
I will update the public api to use the context logger in subsequent PR
Related Issue(s)
Fixes #
How to test
Release Notes
Documentation
Build Options:
Experimental feature to run the build with GitHub Actions (and not in Werft).
leeway-target=components:all
Run Leeway with
--dont-test
Publish Options
Installer Options
Add desired feature flags to the end of the line above, space separated
Preview Environment Options:
If enabled this will build
install/preview
If enabled this will create the environment on GCE infra
Valid options are
all
,workspace
,webapp
,ide
,jetbrains
,vscode
,ssh