Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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
contextual logging #108995
contextual logging #108995
Changes from all commits
3fe5b3e
ab318cf
ef30d84
b390d01
7de1b05
File filter
Filter by extension
Conversations
Jump to
There are no files selected for viewing
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.
this will work as long as scheduler enablement of the feature is only done via a
--feature-gates
flag. I don't see a field in the scheduler config for enabling feature gates at the moment, so that seems workable.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.
this works because it is after
utilfeature.DefaultMutableFeatureGate.SetFromMap(kubeletConfig.FeatureGates)
and afterInitLogs()
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.
Should we also update the README that lists expected outputs for running example?
Adding a example on how to enable contextual logging would also be useful.
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.
That README indeed had to be updated. We need automated checking of command lines...
As the example update depends on feature gate support, I combined those two commits.
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.
Note that we do have some k8s SIGs projects that vendor this... https://cs.k8s.io/?q=NewJSONLogger&i=nope&files=&excludeFiles=&repos=
We may want to add an action required release note saying that this interface has changed.
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.
I don't think we normally announce API changes in staging repos in the release notes, do we?
It's not relevant for end-users and developers who update their dependencies will notice because their code won't compile anymore, which then can be solved easily by looking at a diff.
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.
My understanding from the zapcore docs is that
zapcore.Level(-127)
is almost the lowest possible priority debug level (the lowest being -128).from https://pkg.go.dev/go.uber.org/zap/zapcore#LevelEnabler ... honestly the off-by-1 was probably a typo.
This change will allow us to shed any logs below the verbosity threshold... makes sense to me.
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.
n.b.
zapcore.ErrorLevel
= 2https://pkg.go.dev/go.uber.org/zap/zapcore#Level
V=2 is our default log level so passing 0 results in the current k8s default behaviour, higher values = more logs.
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.
Is it possible that a consequence of this is that logs could be escalated to the Error stream when they previously were Info?
Answering my own question: no, not possible, because
config.VerbosityLevel
is an unsigned int:kubernetes/staging/src/k8s.io/component-base/config/types.go
Line 188 in 7c46f40