-
Notifications
You must be signed in to change notification settings - Fork 4k
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
Refactor to format VPA Updater log more efficiently #6883
base: master
Are you sure you want to change the base?
Refactor to format VPA Updater log more efficiently #6883
Conversation
Hi @nikimanoledaki. Thanks for your PR. I'm waiting for a kubernetes member to verify that this patch is reasonable to test. If it is, they should reply with Once the patch is verified, the new status will be reflected by the I understand the commands that are listed here. 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-sigs/prow repository. |
/lgtm |
/assign @kwiesmueller |
/ok-to-test |
Hi @kwiesmueller 👋 Added the refactor from the previous PR, let me know if it needs any changes, thank you! :) |
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.
Thanks! Just a few nits.
@@ -171,26 +171,26 @@ func (calc *UpdatePriorityCalculator) GetSortedPods(admission PodEvictionAdmissi | |||
func (calc *UpdatePriorityCalculator) GetProcessedRecommendationTargets(r *vpa_types.RecommendedPodResources) string { | |||
sb := &strings.Builder{} | |||
for _, cr := range r.ContainerRecommendations { | |||
sb.WriteString(fmt.Sprintf("%s: ", cr.ContainerName)) | |||
fmt.Fprintf(sb, "%s: ", cr.ContainerName) |
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.
Could this just be a
WriteString(name)
WriteString(: )
?
if cr.Target != nil { | ||
sb.WriteString("target: ") |
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 the WriteString here was already the most efficient way.
if !cr.Target.Memory().IsZero() { | ||
sb.WriteString(fmt.Sprintf("%dk ", cr.Target.Memory().ScaledValue(resource.Kilo))) | ||
fmt.Fprintf(sb, "%dk ", cr.Target.Memory().ScaledValue(resource.Kilo)) |
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 what I meant with my original command was that directly calling strconv.Format functions might be more efficient. Maybe that's over optimizing.
Up to you.
} | ||
} | ||
if cr.UncappedTarget != nil { | ||
sb.WriteString("uncappedTarget: ") | ||
fmt.Fprintf(sb, "uncappedTarget: ") |
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.
Same here, I think this can just be WriteString or without f.
} | ||
} | ||
sb.WriteString("\n") | ||
fmt.Fprintf(sb, "\n") |
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.
Same here, I think this can be a write string or write rune
[APPROVALNOTIFIER] This PR is NOT APPROVED This pull-request has been approved by: nikimanoledaki 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 |
The Kubernetes project currently lacks enough contributors to adequately respond to all PRs. This bot triages PRs according to the following rules:
You can:
Please send feedback to sig-contributor-experience at kubernetes/community. /lifecycle stale |
Hi @nikimanoledaki, Are you working on this PR, If yes then update this PR as per the changes suggested by @kwiesmueller |
/remove-lifecycle stale |
/lgtm cancel |
What type of PR is this?
Add one of the following kinds:
/kind cleanup
What this PR does / why we need it:
Which issue(s) this PR fixes:
Follow up to #6723
Special notes for your reviewer:
Does this PR introduce a user-facing change?
Additional documentation e.g., KEPs (Kubernetes Enhancement Proposals), usage docs, etc.: