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

Use zap instead of klog #1606

Merged
merged 2 commits into from
Apr 20, 2023
Merged

Use zap instead of klog #1606

merged 2 commits into from
Apr 20, 2023

Conversation

xrstf
Copy link
Contributor

@xrstf xrstf commented Mar 27, 2023

What this PR does / why we need it:
This PR replaces klog with Zap. Why?

  • We (as in Kubermatic GmbH) use Zap pretty much everywhere.
  • Zap support exists in controller-runtime as well.
  • klog is terribly useless for structured/contextual logging.
  • I personally just immensely dislike klog. :-D

There were a few log messages on level 3, which is somewhere between INFO and DEBUG. I made a gut choice for all of those, trying to make the logs useful but not too verbose.

klog still remains for the debug HTTP client (as it depends on numeric log levels, something we cannot do with Zap) and for the e2e tests (their logs are kind of boring and don't need Zap that much).

What type of PR is this?
/kind feature

Does this PR introduce a user-facing change? Then add your Release Note here:

Logging was replaced with Zap; the klog-related CLI flags like `-logtostderr`, `-v` etc. have been removed; use `-log-debug=true/false` and `-log-format=text/json` instead.

Documentation:

NONE

@kubermatic-bot kubermatic-bot added docs/none Denotes a PR that doesn't need documentation (changes). release-note Denotes a PR that will be considered when it comes time to generate release notes. do-not-merge/work-in-progress Indicates that a PR should not merge because it is a work in progress. kind/feature Categorizes issue or PR as related to a new feature. dco-signoff: yes Denotes that all commits in the pull request have the valid DCO signoff message. sig/cluster-management Denotes a PR or issue as being assigned to SIG Cluster Management. sig/virtualization Denotes a PR or issue as being assigned to SIG Virtualization. size/XXL Denotes a PR that changes 1000+ lines, ignoring generated files. labels Mar 27, 2023
@xrstf xrstf force-pushed the zap branch 8 times, most recently from 5494e3a to e7787af Compare March 28, 2023 13:05
@xrstf xrstf force-pushed the zap branch 3 times, most recently from a4a6921 to 927a0ee Compare April 17, 2023 12:00
@xrstf xrstf changed the title WIP - Use zap instead of klog Use zap instead of klog Apr 17, 2023
@kubermatic-bot kubermatic-bot removed the do-not-merge/work-in-progress Indicates that a PR should not merge because it is a work in progress. label Apr 17, 2023
Copy link
Member

@ahmedwaleedmalik ahmedwaleedmalik left a comment

Choose a reason for hiding this comment

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

/approve

@kubermatic-bot kubermatic-bot added the lgtm Indicates that a PR is ready to be merged. label Apr 19, 2023
@kubermatic-bot
Copy link
Contributor

LGTM label has been added.

Git tree hash: 4a183fc0e06e9448bd1c76b0fcfc0095648e5f02

@mfranczy
Copy link
Contributor

/approve
/lgtm

@kubermatic-bot
Copy link
Contributor

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: ahmedwaleedmalik, mfranczy, xrstf

The full list of commands accepted by this bot can be found here.

The pull request process is described here

Needs approval from an approver in each of these files:

Approvers can indicate their approval by writing /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

@kubermatic-bot kubermatic-bot added the approved Indicates a PR has been approved by an approver from all required OWNERS files. label Apr 19, 2023
@kubermatic-triage-bot
Copy link

/retest
This bot automatically retries jobs that failed/flaked on approved PRs

Review the full test history

Silence the bot with an /lgtm cancel or /hold comment for consistent failures.

3 similar comments
@kubermatic-triage-bot
Copy link

/retest
This bot automatically retries jobs that failed/flaked on approved PRs

Review the full test history

Silence the bot with an /lgtm cancel or /hold comment for consistent failures.

@kubermatic-triage-bot
Copy link

/retest
This bot automatically retries jobs that failed/flaked on approved PRs

Review the full test history

Silence the bot with an /lgtm cancel or /hold comment for consistent failures.

@kubermatic-triage-bot
Copy link

/retest
This bot automatically retries jobs that failed/flaked on approved PRs

Review the full test history

Silence the bot with an /lgtm cancel or /hold comment for consistent failures.

@kubermatic-bot
Copy link
Contributor

kubermatic-bot commented Apr 19, 2023

@xrstf: The following test failed, say /retest to rerun all failed tests or /retest-required to rerun all mandatory failed tests:

Test name Commit Details Required Rerun command
pull-machine-controller-e2e-openstack 9b58708 link false /test pull-machine-controller-e2e-openstack

Full PR test history

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. I understand the commands that are listed here.

@ahmedwaleedmalik
Copy link
Member

ahmedwaleedmalik commented Apr 19, 2023

/hold
To avoid retries.

@xrstf I'm not sure what's wrong with the VCD tests. You can create a ticket to fix these tests and then probably override them here on this PR.

pull-machine-controller-e2e-openstack is optional so we can ignore that.

@kubermatic-bot kubermatic-bot added the do-not-merge/hold Indicates that a PR should not merge because someone has issued a /hold command. label Apr 19, 2023
@xrstf xrstf mentioned this pull request Apr 20, 2023
@xrstf
Copy link
Contributor Author

xrstf commented Apr 20, 2023

/override pull-machine-controller-e2e-vmware-cloud-director
/unhold

@kubermatic-bot kubermatic-bot removed the do-not-merge/hold Indicates that a PR should not merge because someone has issued a /hold command. label Apr 20, 2023
@kubermatic-bot
Copy link
Contributor

@xrstf: Overrode contexts on behalf of xrstf: pull-machine-controller-e2e-vmware-cloud-director

In response to this:

/override pull-machine-controller-e2e-vmware-cloud-director
/unhold

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.

@kubermatic-bot kubermatic-bot merged commit 052a4ca into kubermatic:main Apr 20, 2023
@xrstf xrstf deleted the zap branch April 20, 2023 11:06
eiabea pushed a commit to anexia-it/machine-controller that referenced this pull request May 8, 2023
* add logging bootstrapping

* replace klog everywhere in the controllers
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
approved Indicates a PR has been approved by an approver from all required OWNERS files. dco-signoff: yes Denotes that all commits in the pull request have the valid DCO signoff message. docs/none Denotes a PR that doesn't need documentation (changes). kind/feature Categorizes issue or PR as related to a new feature. lgtm Indicates that a PR is ready to be merged. release-note Denotes a PR that will be considered when it comes time to generate release notes. sig/cluster-management Denotes a PR or issue as being assigned to SIG Cluster Management. sig/virtualization Denotes a PR or issue as being assigned to SIG Virtualization. size/XXL Denotes a PR that changes 1000+ lines, ignoring generated files.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants