Avoid serialization of maps when log level < 10

Change-Id: If264c26ae599602d5b4919301f011c2095d706ee
This commit is contained in:
Aldo Culquicondor
2022-11-30 12:53:52 -05:00
parent 6c65bed7ce
commit b62541fe84

View File

@@ -67,10 +67,12 @@ func (r *resourceAllocationScorer) score(
score := r.scorer(requested, allocatable) score := r.scorer(requested, allocatable)
klog.V(10).InfoS("Listing internal info for allocatable resources, requested resources and score", "pod", if klogV := klog.V(10); klogV.Enabled() { // Serializing these maps is costly.
klog.KObj(pod), "node", klog.KObj(node), "resourceAllocationScorer", r.Name, klogV.InfoS("Listing internal info for allocatable resources, requested resources and score", "pod",
"allocatableResource", allocatable, "requestedResource", requested, "resourceScore", score, klog.KObj(pod), "node", klog.KObj(node), "resourceAllocationScorer", r.Name,
) "allocatableResource", allocatable, "requestedResource", requested, "resourceScore", score,
)
}
return score, nil return score, nil
} }