-
Notifications
You must be signed in to change notification settings - Fork 1.2k
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
logger.WithValues bypasses KubeAwareEncoder #1290
Comments
huh, yeah, looks like the autogenerated /triage accepted |
@DirectXMan12: Please ensure the request meets the requirements listed here. If this request no longer meets these requirements, the label can be removed In response to this:
Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes/test-infra repository. |
/kind bug |
Does this only occur when you have the logger set to verbose? |
Nope, also for the |
I have investigated the issue a little bit and it seems like there is not much that can be done. When calling |
Issues go stale after 90d of inactivity. If this issue is safe to close now please do so with Send feedback to sig-contributor-experience at kubernetes/community. |
Stale issues rot after 30d of inactivity. If this issue is safe to close now please do so with Send feedback to sig-contributor-experience at kubernetes/community. |
Rotten issues close after 30d of inactivity. Send feedback to sig-contributor-experience at kubernetes/community. |
@fejta-bot: Closing this issue. In response to this:
Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes/test-infra repository. |
/reopen |
@timebertt: Reopened this issue. In response to this:
Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes/test-infra repository. |
The Kubernetes project currently lacks enough contributors to adequately respond to all issues and PRs. This bot triages issues and PRs according to the following rules:
You can:
Please send feedback to sig-contributor-experience at kubernetes/community. /lifecycle stale |
/remove-lifecycle stale |
Hi! I am interested in this issue; And there are some related changes on upstream go-logr/logr, logr introduces
And zapr has already supported that: https://github.com/go-logr/zapr/blob/master/zapr.go#L171-L178 Maybe we could turn the implementation from "zapcore encoder level" to "logrSink level". Within the invoke of How do you think about it? |
Hi @timebertt, @DirectXMan12, @Szymongib , I think we could finally resolve this issue with the latest logr. PTAL ❤️ |
I would try to resolve this issue. |
/assign |
Yeah, that would be awesome. Your plan sounds good to me :) |
The Kubernetes project currently lacks enough contributors to adequately respond to all issues and PRs. This bot triages issues and PRs according to the following rules:
You can:
Please send feedback to sig-contributor-experience at kubernetes/community. /lifecycle stale |
/remove-lifecycle stale |
The Kubernetes project currently lacks enough contributors to adequately respond to all issues and PRs. This bot triages issues and PRs according to the following rules:
You can:
Please send feedback to sig-contributor-experience at kubernetes/community. /lifecycle stale |
This issue has not been updated in over 1 year, and should be re-triaged. You can:
For more details on the triage process, see https://www.kubernetes.dev/docs/guide/issue-triage/ /remove-triage accepted |
any updates? |
any updates on this? |
Hi team! I am happy to be back to work with #1883, please let me know if anything I should do so. 🤔 |
When calling
WithValues
on a zap-backed logger, the value bypasses theKubeAwareEncoder
, meaning it will be fully marshalled using the underlying encoder (e.g. json encoder).For example:
If I add a key and value to the example controller here:
it will use the
KubeAwareEncoder
(which is the desired behaviour)But if I use
WithValues
, which helps avoiding to add the values for every log statement in a controller, like this:it will bypass the
KubeAwareEncoder
and fully marshal the object into json, which will make the logs very hard to search:I didn't find any issue/discussion related to a fix for this, other than this note from @DirectXMan12:
controller-runtime/pkg/log/zap/kube_helpers.go
Line 87 in 43331a6
So I'm opening this issue to see what can be done here to fix this behaviour.
The text was updated successfully, but these errors were encountered: