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

🐛 Don't log name and namespace twice #3040

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

inteon
Copy link
Member

@inteon inteon commented Dec 6, 2024

Currently, the logs for my controller look like this:

I1206 09:17:57.766036   13278 controller.go:212] "Successfully finished the reconciliation." logger="Reconcile" controller="test" controllerGroup="test.com" controllerKind="Test" Test="namespace1/resource1" namespace="namespace1" name="resource1" reconcileID="6594dad2-87a7-4525-8549-f7967f7447e5"

Notice that Test="namespace1/resource1" just repeats information that was already available in other key-value pairs (controllerKind="Test", namespace="namespace1" and name="resource1").

After this PR, the logs look like this:

I1206 09:17:57.766036   13278 controller.go:212] "Successfully finished the reconciliation." logger="Reconcile" controller="test" controllerGroup="test.com" controllerKind="Test" namespace="namespace1" name="resource1" reconcileID="6594dad2-87a7-4525-8549-f7967f7447e5"

@k8s-ci-robot k8s-ci-robot added the cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. label Dec 6, 2024
@k8s-ci-robot
Copy link
Contributor

[APPROVALNOTIFIER] This PR is NOT APPROVED

This pull-request has been approved by: inteon
Once this PR has been reviewed and has the lgtm label, please assign vincepri for approval. For more information see the Kubernetes Code Review Process.

The full list of commands accepted by this bot can be found 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 size/XS Denotes a PR that changes 0-9 lines, ignoring generated files. label Dec 6, 2024
@@ -445,9 +444,6 @@ func (blder *TypedBuilder[request]) doController(r reconcile.TypedReconciler[req
log := log

if req, ok := any(in).(*reconcile.Request); ok && req != nil {
if hasGVK {
log = log.WithValues(gvk.Kind, klog.KRef(req.Namespace, req.Name))
Copy link
Member

Choose a reason for hiding this comment

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

The format of the two is different, this was added to be compatible with the format used by other projects in the ecosystem. Removing this would be a breaking change and I don't see a reason to do that. You can always set up your own logging and make the integrated a no-op.
/hold

Copy link
Member

Choose a reason for hiding this comment

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

Agree. I would like to continue to align with the k/k log format

@k8s-ci-robot k8s-ci-robot added the do-not-merge/hold Indicates that a PR should not merge because someone has issued a /hold command. label Dec 6, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. do-not-merge/hold Indicates that a PR should not merge because someone has issued a /hold command. size/XS Denotes a PR that changes 0-9 lines, ignoring generated files.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants