Skip to content

feat(vpa/updater): Add a new counter metric to measure the total number of failed Pods evictions attempts #8430

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

Conversation

vitanovs
Copy link
Contributor

What type of PR is this?

/kind feature

What this PR does / why we need it:

This PR features a new failed_eviction_attempts_total counter metric in the vpa-updater so that we can track both the successful Pod(s) evictions, via evicted_pods_total and the failed attempts. Having this additional metric will allow us to calculate the success/failure rates of the evictions.

The implementation approach follows the already existing pattern of the in-place resource updates metrics, where we have a

to track both patch requests outcomes.

Which issue(s) this PR fixes:

Fixes #8427

Does this PR introduce a user-facing change?

Added a new counter metric to the VPA Updater, measuring the total number of failed Pods evictions.

@k8s-ci-robot k8s-ci-robot added release-note Denotes a PR that will be considered when it comes time to generate release notes. kind/feature Categorizes issue or PR as related to a new feature. cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. do-not-merge/needs-area needs-ok-to-test Indicates a PR that requires an org member to verify it is safe to test. labels Aug 13, 2025
@k8s-ci-robot
Copy link
Contributor

Hi @vitanovs. 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 /ok-to-test on its own line. Until that is done, I will not automatically test new commits in this PR, but the usual testing commands by org members will still work. Regular contributors should join the org to skip this step.

Once the patch is verified, the new status will be reflected by the ok-to-test label.

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.

@k8s-ci-robot k8s-ci-robot added area/vertical-pod-autoscaler size/M Denotes a PR that changes 30-99 lines, ignoring generated files. and removed do-not-merge/needs-area labels Aug 13, 2025
@adrianmoisey
Copy link
Member

/ok-to-test

@k8s-ci-robot k8s-ci-robot added ok-to-test Indicates a non-member PR verified by an org member that is safe to test. and removed needs-ok-to-test Indicates a PR that requires an org member to verify it is safe to test. labels Aug 13, 2025
Comment on lines +141 to +155
collectors := []prometheus.Collector{
controlledCount,
evictableCount,
evictedCount,
vpasWithEvictablePodsCount,
vpasWithEvictedPodsCount,
failedEvictionAttempts,
inPlaceUpdatableCount,
inPlaceUpdatedCount,
vpasWithInPlaceUpdatablePodsCount,
vpasWithInPlaceUpdatedPodsCount,
failedInPlaceUpdateAttempts,
functionLatency,
}
prometheus.MustRegister(collectors...)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

❤️

Thanks for doing this. My brain is very Pythonic, and this reads easier for me!

@vitanovs vitanovs force-pushed the feat/vpa-updater-failed-evictions-counter-metric branch from be353e1 to e839588 Compare August 13, 2025 07:09
@vitanovs vitanovs changed the title Feat/vpa updater failed evictions counter metric feat(vpa/updater): Add a new counter metric to measure the total number of failed Pods evictions attempts Aug 13, 2025
…d Pod evictions

This commit adds a new counter metric measuring the total number of
failed attempts to evict Pods.
…etric

Add a dedicated unit test to verify the utility function updates the
counter correctly.
…n an error occurs

This commit uses the new metric utility to increase the total number of
failed Pod evictions attempts.
@vitanovs vitanovs force-pushed the feat/vpa-updater-failed-evictions-counter-metric branch from e839588 to cc7a83c Compare August 13, 2025 07:20
Copy link
Member

@omerap12 omerap12 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for this! LGTM

@adrianmoisey
Copy link
Member

/approve

@k8s-ci-robot
Copy link
Contributor

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: adrianmoisey, vitanovs

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 /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

@k8s-ci-robot k8s-ci-robot added the approved Indicates a PR has been approved by an approver from all required OWNERS files. label Aug 13, 2025
@vitanovs
Copy link
Contributor Author

Thanks for taking the time to review the PR @omerap12 @adrianmoisey

I see it being approved, but the lacking lgtm prevents the tide check from passing. Is there anything else that I should take care of regarding the change ?

Thanks :))

@omerap12
Copy link
Member

Oh sorry.
/lgtm

@k8s-ci-robot k8s-ci-robot added the lgtm "Looks good to me", indicates that a PR is ready to be merged. label Aug 14, 2025
@k8s-ci-robot k8s-ci-robot merged commit 190f08b into kubernetes:master Aug 14, 2025
7 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
approved Indicates a PR has been approved by an approver from all required OWNERS files. area/vertical-pod-autoscaler cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. kind/feature Categorizes issue or PR as related to a new feature. lgtm "Looks good to me", indicates that a PR is ready to be merged. ok-to-test Indicates a non-member PR verified by an org member that is safe to test. release-note Denotes a PR that will be considered when it comes time to generate release notes. size/M Denotes a PR that changes 30-99 lines, ignoring generated files.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Add a new counter metric measuring failed Pods evictions in vpa-updater
4 participants