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
Migrate pkg/kubelet/cm/memorymanager to structured logging #99974
Conversation
return false | ||
} | ||
|
||
if len(nodeState1.MemoryMap) != len(nodeState2.MemoryMap) { | ||
klog.Errorf("[memorymanager] node states memory map have different length: %d != %d", len(nodeState1.MemoryMap), len(nodeState2.MemoryMap)) | ||
klog.ErrorS(nil, "[memorymanager] Node states memory map have different length.", "len(state1.MemoryMap)", len(nodeState1.MemoryMap), "len(state2.MemoryMap)", len(nodeState2.MemoryMap)) |
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.
klog.ErrorS(nil, "[memorymanager] Node states memory map have different length.", "len(state1.MemoryMap)", len(nodeState1.MemoryMap), "len(state2.MemoryMap)", len(nodeState2.MemoryMap)) | |
klog.ErrorS(nil, "[memorymanager] Node states memory map have different length", "len1", len(nodeState1.MemoryMap), "len2", len(nodeState2.MemoryMap)) |
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.
not sure here, keys could be state1
or state2
or lengthState1
lengthState2
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.
i have this doubt, maybe x1 and x2 is enough for the context
return false | ||
} | ||
|
||
if nodeState1.NumberOfAssignments != nodeState2.NumberOfAssignments { | ||
klog.Errorf("[memorymanager] node states number of assignments are different: %d != %d", nodeState1.NumberOfAssignments, nodeState2.NumberOfAssignments) | ||
klog.ErrorS(nil,"[memorymanager] Node states number of assignments are different.", "state1.NumberOfAssignments", nodeState1.NumberOfAssignments, "state2.NumberOfAssignments", nodeState2.NumberOfAssignments) |
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.
klog.ErrorS(nil,"[memorymanager] Node states number of assignments are different.", "state1.NumberOfAssignments", nodeState1.NumberOfAssignments, "state2.NumberOfAssignments", nodeState2.NumberOfAssignments) | |
klog.ErrorS(nil,"[memorymanager] Node states number of assignments are different.", "assignment1", nodeState1.NumberOfAssignments, "assignment2", nodeState2.NumberOfAssignments) |
/triage accepted |
return NewPolicyNone() | ||
} | ||
|
||
func (m *fakeManager) Allocate(pod *v1.Pod, container *v1.Container) error { | ||
klog.Infof("[fake memorymanager] Allocate (pod: %s, container: %s", pod.Name, container.Name) | ||
klog.InfoS("[fake memorymanager] Allocate", "podName", pod.Name, "container", container.Name) |
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.
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.
I think these are only strings
d8fb9d3
to
286b6fe
Compare
6ea6650
to
d2a8932
Compare
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 a user facing change, please update pr description so this gets a release note. :)
d2a8932
to
0126fb7
Compare
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.
Couple things but q: if we are deleting [memorymanager] should it also be deleted from fmt.Errorf("[memorymanager] failed to get the default NUMA affinity, no NUMA nodes with enough memory is available") in the same file (pkg/kubelet/cm/memorymanager/policy_static.go )?
cc: @ehashman
0126fb7
to
62f7787
Compare
/retest |
/test pull-kubernetes-unit |
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.
One left :)
/milestone v1.21 |
62f7787
to
3eb25ba
Compare
/retest |
@@ -228,13 +228,13 @@ func (m *manager) RemoveContainer(containerID string) error { | |||
// if error appears it means container entry already does not exist under the container map | |||
podUID, containerName, err := m.containerMap.GetContainerRef(containerID) | |||
if err != nil { | |||
klog.Warningf("[memorymanager] Failed to get container %s from container map error: %v", containerID, err) | |||
klog.ErrorS(err, "Failed to get container from container map", "containerID", containerID) |
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.
You have quite a few Warningf->ErrorS - shouldn't they be InfoS??
Can you please check throughout
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.
I think is correct to migrate Warningf to Info, but in this case should not be this an error log level?
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.
moving it to klog.InfoS(..., "err", err)
, just looks odd to me
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.
InfoS
is the correct level for warnings. See the migration guide: https://github.com/kubernetes/community/blob/master/contributors/devel/sig-instrumentation/migration-to-structured-logging.md#change-log-functions-to-structured-equivalent
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.
@ehashman yes, the point is the Warning is already being wrong here.. but changed according to the migration guide
73e73e4
to
362c520
Compare
ee996c2
to
b078a4f
Compare
Thanks for all of our work on this @knabben and for updating with changes so quickly 👍 /lgtm |
[APPROVALNOTIFIER] This PR is APPROVED This pull-request has been approved by: knabben, mrunalp 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 feature
/sig instrumentation
/sig node
What this PR does / why we need it:
Migrate
pkg/kubelet/cm/memorymanager
to structured loggingWhich issue(s) this PR fixes:
Refs #98976
Special notes for your reviewer:
Does this PR introduce a user-facing change?