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

Upgrade controller logging #4222

Merged
merged 9 commits into from
Sep 2, 2024
Merged

Conversation

theunrepentantgeek
Copy link
Member

@theunrepentantgeek theunrepentantgeek commented Aug 28, 2024

What this PR does / why we need it

Refactors the startup of our controller to separate log initialization from app initialization.
Removes use of the deprecated klogr library in favour of textlogger.
Introduces the new commandline flag --json-logging which switches the output in the obvious way.

Special notes for your reviewer

The package k8s.io/klog/v2/klogr is deprecated in favour of k8s.io/klog/v2/textlogger so we need to switch to that.

Closes #4191

Adding JSON logging as an option (by specifying --json-logging on the command line) enables better integration with structured logging tools.

Closes #1620

By using zap for JSON formatted logging, we get stack traces included in the logs by default.

Closes #3529

Testing

Tested manually on the command line.

How does this PR make you feel

gif

v2/cmd/controller/app/flags.go Outdated Show resolved Hide resolved
v2/cmd/controller/logging/logging.go Outdated Show resolved Hide resolved
v2/cmd/controller/logging/logging.go Outdated Show resolved Hide resolved
v2/cmd/controller/logging/logging.go Outdated Show resolved Hide resolved
v2/cmd/controller/logging/logging.go Outdated Show resolved Hide resolved
v2/cmd/controller/logging/logging.go Outdated Show resolved Hide resolved
v2/cmd/controller/logging/logging.go Outdated Show resolved Hide resolved
v2/internal/genericarmclient/suite_test.go Outdated Show resolved Hide resolved
v2/internal/testcommon/kube_test_context_envtest.go Outdated Show resolved Hide resolved
v2/test/multitenant/suite_test.go Outdated Show resolved Hide resolved
Copy link
Member

@matthchr matthchr left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good, had a few minor comments

v2/cmd/controller/logging/logging.go Outdated Show resolved Hide resolved
v2/cmd/controller/logging/logging.go Outdated Show resolved Hide resolved
v2/cmd/controller/logging/logging.go Outdated Show resolved Hide resolved
v2/cmd/controller/logging/logging.go Outdated Show resolved Hide resolved
@theunrepentantgeek theunrepentantgeek added this pull request to the merge queue Sep 2, 2024
Merged via the queue into main with commit 1ae868d Sep 2, 2024
7 checks passed
@theunrepentantgeek theunrepentantgeek deleted the feature/upgrade-logging branch September 2, 2024 04:57
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
2 participants