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

🐛 logging: Avoid adding multiple objects to the same logger in for loops #7534

Merged
merged 1 commit into from
Nov 11, 2022

Conversation

sbueringer
Copy link
Member

Signed-off-by: Stefan Büringer [email protected]

What this PR does / why we need it:
Was debugging ClusterCacheTracker and found log statements with 20 Machines as k/v pairs.

Which issue(s) this PR fixes (optional, in fixes #<issue number>(, fixes #<issue_number>, ...) format, will close the issue(s) when PR gets merged):
Fixes #

@k8s-ci-robot k8s-ci-robot added the cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. label Nov 11, 2022
@k8s-ci-robot k8s-ci-robot added needs-rebase Indicates a PR cannot be merged because it has merge conflicts with HEAD. size/S Denotes a PR that changes 10-29 lines, ignoring generated files. labels Nov 11, 2022
@sbueringer
Copy link
Member Author

/assign @fabriziopandini @killianmuldoon

@k8s-ci-robot k8s-ci-robot added size/L Denotes a PR that changes 100-499 lines, ignoring generated files. and removed needs-rebase Indicates a PR cannot be merged because it has merge conflicts with HEAD. size/S Denotes a PR that changes 10-29 lines, ignoring generated files. labels Nov 11, 2022
@sbueringer sbueringer closed this Nov 11, 2022
@k8s-ci-robot k8s-ci-robot added size/XS Denotes a PR that changes 0-9 lines, ignoring generated files. and removed size/L Denotes a PR that changes 100-499 lines, ignoring generated files. labels Nov 11, 2022
@sbueringer sbueringer reopened this Nov 11, 2022
@k8s-ci-robot k8s-ci-robot added size/S Denotes a PR that changes 10-29 lines, ignoring generated files. and removed size/XS Denotes a PR that changes 0-9 lines, ignoring generated files. labels Nov 11, 2022
Copy link
Contributor

@killianmuldoon killianmuldoon left a comment

Choose a reason for hiding this comment

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

/lgtm

@k8s-ci-robot k8s-ci-robot added the lgtm "Looks good to me", indicates that a PR is ready to be merged. label Nov 11, 2022
Copy link
Member

@fabriziopandini fabriziopandini left a comment

Choose a reason for hiding this comment

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

nice catch
/lgtm

@fabriziopandini
Copy link
Member

/approve

@k8s-ci-robot
Copy link
Contributor

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: fabriziopandini

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

@k8s-ci-robot k8s-ci-robot added the approved Indicates a PR has been approved by an approver from all required OWNERS files. label Nov 11, 2022
@k8s-ci-robot k8s-ci-robot merged commit dba1c70 into kubernetes-sigs:main Nov 11, 2022
@k8s-ci-robot k8s-ci-robot added this to the v1.3 milestone Nov 11, 2022
@sbueringer sbueringer deleted the pr-improve-logging branch November 11, 2022 16:56
@sbueringer
Copy link
Member Author

Let's cherry-pick this bugfix as well

/cherry-pick release-1.2

@k8s-infra-cherrypick-robot

@sbueringer: #7534 failed to apply on top of branch "release-1.2":

Applying: logging: Avoid adding multiple objects to the same logger in for loops
Using index info to reconstruct a base tree...
M	controlplane/kubeadm/internal/controllers/controller.go
M	internal/controllers/machine/machine_controller.go
M	internal/controllers/machinedeployment/machinedeployment_rollout_ondelete.go
M	internal/controllers/machineset/machineset_controller.go
M	internal/controllers/topology/cluster/patches/engine.go
M	test/extension/handlers/topologymutation/handler.go
Falling back to patching base and 3-way merge...
Auto-merging test/extension/handlers/topologymutation/handler.go
CONFLICT (content): Merge conflict in test/extension/handlers/topologymutation/handler.go
Auto-merging internal/controllers/topology/cluster/patches/engine.go
Auto-merging internal/controllers/machineset/machineset_controller.go
CONFLICT (content): Merge conflict in internal/controllers/machineset/machineset_controller.go
Auto-merging internal/controllers/machinedeployment/machinedeployment_rollout_ondelete.go
CONFLICT (content): Merge conflict in internal/controllers/machinedeployment/machinedeployment_rollout_ondelete.go
Auto-merging internal/controllers/machine/machine_controller.go
CONFLICT (content): Merge conflict in internal/controllers/machine/machine_controller.go
Auto-merging controlplane/kubeadm/internal/controllers/controller.go
CONFLICT (content): Merge conflict in controlplane/kubeadm/internal/controllers/controller.go
error: Failed to merge in the changes.
hint: Use 'git am --show-current-patch=diff' to see the failed patch
Patch failed at 0001 logging: Avoid adding multiple objects to the same logger in for loops
When you have resolved this problem, run "git am --continue".
If you prefer to skip this patch, run "git am --skip" instead.
To restore the original branch and stop patching, run "git am --abort".

In response to this:

Let's cherry-pick this bugfix as well

/cherry-pick release-1.2

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.

@sbueringer
Copy link
Member Author

sbueringer commented Nov 14, 2022

Took a closer look. Looks like this cherry-pick doesn't make sense as the issues don't exist on release-1.2 as we only made the log changes (that introduced the issues) on main.

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. cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. lgtm "Looks good to me", indicates that a PR is ready to be merged. size/S Denotes a PR that changes 10-29 lines, ignoring generated files.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants