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
Fixed improperly migrated logs #105763
Fixed improperly migrated logs #105763
Conversation
@shivanshu1333: This issue is currently awaiting triage. If a SIG or subproject determines this is a relevant issue, they will accept it by applying the The 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. |
/assign @serathius |
Why not using the stringers for logging? |
@serathius kindly re-review, the PR was getting huge and might become difficult to review. |
@@ -104,23 +104,24 @@ func (hcs *server) SyncServices(newServices map[types.NamespacedName]uint16) err | |||
// Remove any that are not needed any more. | |||
for nsn, svc := range hcs.services { | |||
if port, found := newServices[nsn]; !found || port != svc.port { | |||
klog.V(2).InfoS("Closing healthcheck", "service", nsn.String(), "port", svc.port) | |||
klog.V(2).InfoS("Closing healthcheck", "service", nsn, "port", svc.port) |
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.
Just a note, we should use keys like "service" for kubernetes objects that are passed to klog.KObj
func. Here we have weird case where code doesn't pass K8s object, but type.NamespacedName
which can be used to reference an object. We should make sure that passing and K8s object or namespaced name will result in the same log.
At this moment I don't think that type.NamespacedName
implements GetName() string
and GetNamespace() string
methods to be passed to klog.KObj
. Would be good to follow up on this.
cc @pohly
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.
this is the NamespacedName struct
type NamespacedName struct {
Namespace string
Name string
}
and yes, it doesn't implement GetName() and GetNamspace() functions.
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.
We don't need to wrap this in KObj
. That would just cause overhead. Instead we should implement the new logr.Marshaler
interface. I've created #105782 to track this.
/wg structured-logging |
/lgtm |
using label to squash |
@aojea @danwinship PTAL :) |
/approve |
[APPROVALNOTIFIER] This PR is APPROVED This pull-request has been approved by: aojea, shivanshu1333 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 |
What type of PR is this?
/kind cleanup
What this PR does / why we need it:
Fixed incorrectly migrated logs
Migrated some missing logs to structured logging
Which issue(s) this PR fixes:
Ref: #104872
Special notes for your reviewer:
In this PR, I've cleaned up some improperly migrated logs, going forward we need to figure out a way to make every migration follow the guide, #105718 (comment)
Does this PR introduce a user-facing change?
Additional documentation e.g., KEPs (Kubernetes Enhancement Proposals), usage docs, etc.: