Skip to content
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

add a metric for eviction number in cluster queue #1955

Merged
merged 2 commits into from
May 8, 2024

Conversation

lowang-bh
Copy link
Member

@lowang-bh lowang-bh commented Apr 6, 2024

What type of PR is this?

/kind feature

What this PR does / why we need it:

Expose a metrics to record workloads eviction number in cluster queue

Which issue(s) this PR fixes:

Fixes #1741

Special notes for your reviewer:

Does this PR introduce a user-facing change?

Add metric `evicted_workloads`: the number of evicted workloads per 'cluster_queue'

@k8s-ci-robot k8s-ci-robot added do-not-merge/release-note-label-needed Indicates that a PR should not merge because it's missing one of the release note labels. cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. labels Apr 6, 2024
@k8s-ci-robot k8s-ci-robot added the needs-ok-to-test Indicates a PR that requires an org member to verify it is safe to test. label Apr 6, 2024
@k8s-ci-robot
Copy link
Contributor

Hi @lowang-bh. Thanks for your PR.

I'm waiting for a kubernetes-sigs 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/test-infra repository.

@k8s-ci-robot k8s-ci-robot added the size/M Denotes a PR that changes 30-99 lines, ignoring generated files. label Apr 6, 2024
Copy link

netlify bot commented Apr 6, 2024

Deploy Preview for kubernetes-sigs-kueue canceled.

Name Link
🔨 Latest commit c3dce09
🔍 Latest deploy log https://app.netlify.com/sites/kubernetes-sigs-kueue/deploys/663b87a37fbbb70008d61228

@k8s-ci-robot k8s-ci-robot added release-note Denotes a PR that will be considered when it comes time to generate release notes. and removed do-not-merge/release-note-label-needed Indicates that a PR should not merge because it's missing one of the release note labels. labels Apr 6, 2024
@lowang-bh
Copy link
Member Author

/assign @alculquicondor @astefanutti

@kannon92
Copy link
Contributor

kannon92 commented Apr 8, 2024

/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 Apr 8, 2024
pkg/metrics/metrics.go Outdated Show resolved Hide resolved
pkg/metrics/metrics.go Outdated Show resolved Hide resolved
pkg/metrics/metrics.go Outdated Show resolved Hide resolved
pkg/controller/core/workload_controller.go Outdated Show resolved Hide resolved
@alculquicondor
Copy link
Contributor

cc @mimowo

pkg/metrics/metrics.go Outdated Show resolved Hide resolved
pkg/metrics/metrics.go Outdated Show resolved Hide resolved
@@ -107,21 +107,34 @@ The label 'result' can have the following values:
}, []string{"cluster_queue"},
)

EvictedWorkloads = prometheus.NewGaugeVec(
Copy link
Contributor

Choose a reason for hiding this comment

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

Please add some test for the metric, either unit test or integration. I know we have some integration tests for metrics already, so extending an existing integration test to assert of the metrics sounds good to me.

Copy link
Member Author

Choose a reason for hiding this comment

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

Have added the unit test.

Copy link
Contributor

Choose a reason for hiding this comment

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

Thanks. My last ask would be that the unit test verifies ReportEvictedWorkloads works ok, still it would be good to assert in integration tests to make sure it is called.

@k8s-ci-robot k8s-ci-robot added size/S Denotes a PR that changes 10-29 lines, ignoring generated files. needs-rebase Indicates a PR cannot be merged because it has merge conflicts with HEAD. and removed size/M Denotes a PR that changes 30-99 lines, ignoring generated files. labels Apr 10, 2024
@k8s-ci-robot k8s-ci-robot removed the needs-rebase Indicates a PR cannot be merged because it has merge conflicts with HEAD. label Apr 21, 2024
@alculquicondor
Copy link
Contributor

/assign @mimowo

@mimowo
Copy link
Contributor

mimowo commented Apr 22, 2024

@lowang-bh is there any progress on the remaining comments:

Let us know if there are any complications with them, we would like to include this feature in 0.7

@lowang-bh lowang-bh force-pushed the evictionMetric branch 4 times, most recently from 6793dd8 to fb00e3f Compare April 27, 2024 09:13
@k8s-ci-robot k8s-ci-robot added the needs-rebase Indicates a PR cannot be merged because it has merge conflicts with HEAD. label Apr 27, 2024
@k8s-ci-robot k8s-ci-robot removed the needs-rebase Indicates a PR cannot be merged because it has merge conflicts with HEAD. label Apr 27, 2024
@lowang-bh lowang-bh force-pushed the evictionMetric branch 2 times, most recently from 38abe80 to 8380b67 Compare April 27, 2024 14:52
@k8s-ci-robot k8s-ci-robot added the needs-rebase Indicates a PR cannot be merged because it has merge conflicts with HEAD. label May 7, 2024
@@ -293,6 +294,9 @@ var _ = ginkgo.Describe("SchedulerWithWaitForPodsReady", func() {
})
g.Expect(k8sClient.Status().Update(ctx, prodWl)).Should(gomega.Succeed())
}, util.Timeout, util.Interval).Should(gomega.Succeed(), "Job reconciler should add an Evicted condition with InactiveWorkload to the Workload")

// ReconcileGenericJob didn't run here
// util.ExpectEvictedWorkloadsTotalMetric(prodClusterQ.Name, kueue.WorkloadEvictedByDeactivation, 1)
Copy link
Contributor

Choose a reason for hiding this comment

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

I think this requires some investigation, or explanation why we don't see the metric bumped.

Copy link
Contributor

Choose a reason for hiding this comment

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

l looked closer into this, and it appears to be fixed here: #2131. The metric should also be bumped into the new section in the workload_controller now.

Additionally, IIUC we can now remove the block above, please do so: TODO: Once we move a logic to issue the Eviction with InactiveWorkload reason, we need to remove the below updates..

Copy link
Member Author

Choose a reason for hiding this comment

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

l looked closer into this, and it appears to be fixed here: #2131. The metric should also be bumped into the new section in the workload_controller now.

Done.

@mimowo
Copy link
Contributor

mimowo commented May 8, 2024

@lowang-bh friendly ping if you can find time to rebase and address the remaining comments.

Signed-off-by: lowang-bh <[email protected]>

Update pkg/metrics/metrics.go

Co-authored-by: Aldo Culquicondor <[email protected]>

Update pkg/metrics/metrics.go

Co-authored-by: Aldo Culquicondor <[email protected]>

add testcase about EvictedWorkloads, and record metrics when patch condition succeed

Signed-off-by: lowang-bh <[email protected]>

update metrics.md for docs

Signed-off-by: lowang-bh <[email protected]>

add EvictedWorkloadsTotal metrics test in integration

Signed-off-by: lowang-bh <[email protected]>
Copy link
Contributor

@mimowo mimowo left a comment

Choose a reason for hiding this comment

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

/lgtm
Thanks

@k8s-ci-robot k8s-ci-robot added the lgtm "Looks good to me", indicates that a PR is ready to be merged. label May 8, 2024
@k8s-ci-robot
Copy link
Contributor

LGTM label has been added.

Git tree hash: ecc5316bb277453c56086e3b0ab44fcc0eee124f

@mimowo
Copy link
Contributor

mimowo commented May 8, 2024

/approve
/assign @alculquicondor

Copy link
Contributor

@alculquicondor alculquicondor left a comment

Choose a reason for hiding this comment

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

/approve

@k8s-ci-robot
Copy link
Contributor

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: alculquicondor, lowang-bh, mimowo

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 May 8, 2024
@k8s-ci-robot k8s-ci-robot merged commit 57a6823 into kubernetes-sigs:main May 8, 2024
15 checks passed
@k8s-ci-robot k8s-ci-robot added this to the v0.7 milestone May 8, 2024
@alculquicondor
Copy link
Contributor

/kind feature
/release-note-edit

Add metric `evicted_workloads`: the number of evicted workloads per 'cluster_queue'

@k8s-ci-robot k8s-ci-robot added the kind/feature Categorizes issue or PR as related to a new feature. label May 30, 2024
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. 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. needs-rebase Indicates a PR cannot be merged because it has merge conflicts with HEAD. 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/L Denotes a PR that changes 100-499 lines, ignoring generated files.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Expose an eviction / re-queue related prometheus metric
6 participants