-
Notifications
You must be signed in to change notification settings - Fork 4.2k
Node removal latency metrics added #8485
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
base: master
Are you sure you want to change the base?
Node removal latency metrics added #8485
Conversation
Adding the "do-not-merge/release-note-label-needed" label because no release-note block was detected, please follow our release note process to remove it. 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. |
|
[APPROVALNOTIFIER] This PR is NOT APPROVED This pull-request has been approved by: ttetyanka 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 |
Welcome @ttetyanka! |
Hi @ttetyanka. 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. |
aff3480
to
ef7c537
Compare
/ok-to-test |
) | ||
|
||
type NodeInfo struct { | ||
Name string |
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.
Looks like we have duplicated information. Name is already in key.
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.
File name not aligned with convention - using underscore between words.
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.
Names of the test file and file implementation do not match.
klog.V(2).Infof( | ||
"Observing deletion for node %s, unneeded for %s (threshold was %s).", | ||
nodeName, duration, info.Threshold, | ||
) | ||
|
||
metrics.UpdateScaleDownNodeDeletionDuration("true", duration-info.Threshold) |
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.
Logging and updating metric don't need and shouldn’t be done under lock.
limitsFinder *resource.LimitsFinder | ||
cachedList []*apiv1.Node | ||
byName map[string]*node | ||
unneededTimeCache map[string]time.Duration |
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 would try to store here latency tracker. I think it would simplify code - eg. we could get rid of this cache and GetUnneededTimeForNode() method. We could save the GetScaleDownUnneededTime result when it is called during unremovableReason() method.
@@ -324,6 +327,9 @@ func (a *Actuator) deleteNodesAsync(nodes []*apiv1.Node, nodeGroup cloudprovider | |||
} | |||
|
|||
for _, node := range nodes { | |||
if a.nodeLatencyTracker != nil { | |||
a.nodeLatencyTracker.ObserveDeletion(node.Name, time.Now()) |
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 could consider covering this logic with test.
@@ -750,3 +760,7 @@ func UpdateInconsistentInstancesMigsCount(migCount int) { | |||
func ObserveBinpackingHeterogeneity(instanceType, cpuCount, namespaceCount string, pegCount int) { | |||
binpackingHeterogeneity.WithLabelValues(instanceType, cpuCount, namespaceCount).Observe(float64(pegCount)) | |||
} | |||
|
|||
func UpdateScaleDownNodeDeletionDuration(deleted string, duration time.Duration) { |
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.
Do we ever pass deleted = false?
Namespace: caNamespace, | ||
Name: "node_deletion_duration_seconds", | ||
Help: "Latency from planning (node marked) to final outcome (deleted, aborted, rescued).", | ||
Buckets: k8smetrics.ExponentialBuckets(10, 2, 12), |
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 would consider having better resolution.
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 don't see any test checking the reported value.
@@ -324,6 +327,9 @@ func (a *Actuator) deleteNodesAsync(nodes []*apiv1.Node, nodeGroup cloudprovider | |||
} | |||
|
|||
for _, node := range nodes { | |||
if a.nodeLatencyTracker != nil { |
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.
It doesn’t seem like the best placement. Deletion still might fail (look at the checks below). I think we would want to report only successful deletion.
What type of PR is this?
What this PR does / why we need it:
Which issue(s) this PR fixes:
Fixes #
Special notes for your reviewer:
Does this PR introduce a user-facing change?
Additional documentation e.g., KEPs (Kubernetes Enhancement Proposals), usage docs, etc.: