fix: correct 17 klog format-string bugs across the codebase#1134
Conversation
|
Pushed a second commit to fix the CI failures: Vet / Unit Test failures — klog v2.140.0 adds proper
Lint / Parallel failures — Removed the |
|
Pushed a third commit that reverts the klog v2.80.1 → v2.140.0 upgrade and the associated Root cause of CI failures: The klog version jump pulled in What remains in this PR: Only the 17 format-string bug fixes — these are real correctness issues where The |
Codecov Report❌ Patch coverage is ❌ Your patch check has failed because the patch coverage (14.28%) is below the target coverage (50.00%). You can increase the patch coverage or adjust the target coverage. Additional details and impacted files@@ Coverage Diff @@
## main #1134 +/- ##
==========================================
+ Coverage 61.50% 61.67% +0.17%
==========================================
Files 785 786 +1
Lines 73413 73689 +276
==========================================
+ Hits 45152 45449 +297
+ Misses 23241 23215 -26
- Partials 5020 5025 +5
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
Can you squash the commits? |
Signed-off-by: Pierluigi Lenoci <pierluigilenoci@gmail.com>
1b3d170 to
a9605b6
Compare
|
Done — the PR already contains a single commit (a9605b6). Ready for review! |
Summary
Fix 17 pre-existing klog format-string bugs across the codebase. These calls use
klog.Info,klog.Warning,klog.Error(non-formatting variants) with%s/%vplaceholders, or use thef-suffixed variants with mismatched argument counts — causing log messages to be silently malformed at runtime.Categories of bugs fixed
klog.Info(...)with format verbs (should beklog.Infof)klog.Info("pod %v added with target scraping", pod.Name)klog.Warning(...)with format verbs (should beklog.Warningf)klog.Warning("failed to patch %s ...", config.Name, err)klog.Error(...)with format verbs (should beklog.Errorf)klog.Error("GetOvercommitRatio getNode fail: %v", err)klog.Warningf/klog.Errorfwith wrong argument countklog.Warningf("[%s] skip resource: %s with total: %.2f", b.pluginName, total)— missingresourceNameklog.Errorfwith format string but no argumentsklog.Errorf("unable to sync caches for %s webhook")— missingpodWebhookNameFiles changed
pkg/agent/evictionmanager/plugin/resource/resources.gopkg/agent/orm/manager_nri.gopkg/agent/orm/resourceprovider.gopkg/agent/sysadvisor/plugin/overcommitmentaware/realtime/realtime.gopkg/controller/monitor/cnr.gopkg/controller/overcommit/node/node.gopkg/controller/vpa/vpa.gopkg/custom-metric/collector/prometheus/collector_promethes.gopkg/scheduler/eventhandlers/handler.gopkg/scheduler/plugins/noderesourcetopology/filter_native.gopkg/scheduler/plugins/noderesourcetopology/reserve.gopkg/util/general/healthz.gopkg/webhook/mutating/pod/pod.gopkg/webhook/mutating/pod/resource_mutator.goSigned-off-by: Pierluigi Lenoci pierluigi.lenoci@gmail.com