-
Notifications
You must be signed in to change notification settings - Fork 263
feat: make logger encoders kube-aware #4125
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
base: master
Are you sure you want to change the base?
Conversation
Signed-off-by: GitHub <[email protected]>
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.
Pull Request Overview
This PR adds Kubernetes-awareness to the CNS v2 logger by wrapping all standard zap encoders with controller-runtime's KubeAwareEncoder. This enhancement enables the logger to properly format Kubernetes object types (like ObjectMeta) when logging in Kubernetes environments.
Key changes:
- Wraps logfmt and JSON encoders with
KubeAwareEncoderfor better Kubernetes object logging - Applies the wrapper consistently across stdout, file, and ETW logging cores
- Adds controller-runtime import to each affected file
Reviewed Changes
Copilot reviewed 3 out of 3 changed files in this pull request and generated no comments.
| File | Description |
|---|---|
| cns/logger/v2/cores/stdout.go | Wraps logfmt encoder with KubeAwareEncoder for stdout logging |
| cns/logger/v2/cores/file.go | Wraps JSON encoder with KubeAwareEncoder for file logging |
| cns/logger/v2/cores/etw_windows.go | Wraps JSON encoder with KubeAwareEncoder for ETW logging on Windows |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
|
This pull request is stale because it has been open for 2 weeks with no activity. Remove stale label or comment or this will be closed in 7 days |
|
/azp run Azure Container Networking PR |
|
Azure Pipelines successfully started running 1 pipeline(s). |
|
This pull request is stale because it has been open for 2 weeks with no activity. Remove stale label or comment or this will be closed in 7 days |
|
Pull request closed due to inactivity. |
|
/azp run Azure Container Networking PR |
|
Azure Pipelines successfully started running 1 pipeline(s). |
wraps the v2 logger encoders with controller-runtime's kube-aware encoder shim