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

WIP: add metrics for workloads count #4350

Open
wants to merge 2 commits into
base: main
Choose a base branch
from

Conversation

kannon92
Copy link
Contributor

@kannon92 kannon92 commented Feb 21, 2025

What type of PR is this?

/kind feature

What this PR does / why we need it:

We will provide an operator to manage the configuration of Kueue and we expect to have various customers with varrying frameworks supported for Kueue.

Over time we know we would like to see what kind of Kinds are managed by Kueue and how many.

We want to propose a counter per in-tree framework that counts the number of workloads kueue managed and whether or not the workload is actually enabled.

Which issue(s) this PR fixes:

Fixes: #4336

Special notes for your reviewer:

This is open for comments.

Does this PR introduce a user-facing change?

Add metrics for workloads to display if workloads are supported in Kueue and if so how many workloads kueue is managing.

@k8s-ci-robot k8s-ci-robot added kind/feature Categorizes issue or PR as related to a new feature. release-note Denotes a PR that will be considered when it comes time to generate release notes. cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. labels Feb 21, 2025
@k8s-ci-robot
Copy link
Contributor

[APPROVALNOTIFIER] This PR is NOT APPROVED

This pull-request has been approved by: kannon92
Once this PR has been reviewed and has the lgtm label, please assign tenzen-y for approval. For more information see the Code Review Process.

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

@k8s-ci-robot k8s-ci-robot added the size/L Denotes a PR that changes 100-499 lines, ignoring generated files. label Feb 21, 2025
Copy link

netlify bot commented Feb 21, 2025

Deploy Preview for kubernetes-sigs-kueue canceled.

Name Link
🔨 Latest commit 4639bf5
🔍 Latest deploy log https://app.netlify.com/sites/kubernetes-sigs-kueue/deploys/67b8f85b3a33fd0008e31768

// Metrics counting usage of frameworks

// Counter of jobs that are managed by Kueue
JobWorkloadCounter = prometheus.NewCounterVec(
Copy link
Contributor

Choose a reason for hiding this comment

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

Please don't multiply the metrics by the framework name. Framework name should be a label in the metrics.

Copy link
Member

Choose a reason for hiding this comment

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

Basically, increasing kind of metrics affect scheduling performance since the metrics counter need to take a lock every time.

So, I would recommend adding the kind of workload type like batch/v1 Job to the existing Workload counting metrics as @mimowo mentioned.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Do you all think I should have two metrics.

one for supported frameworks and the other for external?

I wasn’t sure if exposing the GVK for external frameworks would be valid.

Copy link
Member

Choose a reason for hiding this comment

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

I imagined adding framework-type label to the existing Worklaod-related metric like

QuotaReservedWorkloadsTotal = prometheus.NewCounterVec(

@mimowo If you have any other view, let us know.

Copy link
Contributor

Choose a reason for hiding this comment

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

I like the idea of extending the existing workload metrics more than entirely new ones. If this is risky we may use a feature gate for a release or two

Copy link
Contributor

Choose a reason for hiding this comment

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

you can aggregate the metrics at the level of grafana, by summing over the CQ names. Then you will display results by frameworkName

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Are you okay with including external frameworks in that same label?

Copy link
Contributor

Choose a reason for hiding this comment

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

I'm ok with that, every workload needs to belong to some framework, either built-in or external, so otherwise we would need to say "". I guess user needs to have some other way (if she / he wants) to determine which are external and which built-in.

Copy link
Contributor

Choose a reason for hiding this comment

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

Basically, increasing kind of metrics affect scheduling performance since the metrics counter need to take a lock every time

Prometheus metric counter is thread safe no?

Copy link
Member

Choose a reason for hiding this comment

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

Prometheus metric counter is thread safe no?

Yes, that is thread safe. I meant metrics counter take a lock internally. We do not need to take a lock in our side.

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.

/hold
To avoid merging accidentally since the PR seems still far from being ready. It is ok to prototype, but for merging we need first agreement on the metrics and their labels,

/retitle WIP: add metrics for workloads count

@k8s-ci-robot k8s-ci-robot added the do-not-merge/hold Indicates that a PR should not merge because someone has issued a /hold command. label Feb 21, 2025
@k8s-ci-robot k8s-ci-robot changed the title add metrics for workloads count WIP: add metrics for workloads count Feb 21, 2025
@k8s-ci-robot k8s-ci-robot added the do-not-merge/work-in-progress Indicates that a PR should not merge because it is a work in progress. label Feb 21, 2025
@mimowo
Copy link
Contributor

mimowo commented Feb 21, 2025

Leaving the first proper pass to @gabesaba, just raising #4350 (comment) as a top-level remark.

@k8s-ci-robot k8s-ci-robot added size/M Denotes a PR that changes 30-99 lines, ignoring generated files. and removed size/L Denotes a PR that changes 100-499 lines, ignoring generated files. labels Feb 21, 2025
@k8s-ci-robot
Copy link
Contributor

@kannon92: The following test failed, say /retest to rerun all failed tests or /retest-required to rerun all mandatory failed tests:

Test name Commit Details Required Rerun command
pull-kueue-test-unit-main 4639bf5 link true /test pull-kueue-test-unit-main

Full PR test history. Your PR dashboard. Please help us cut down on flakes by linking to an open issue when you hit one in your PR.

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. I understand the commands that are listed here.

@kannon92
Copy link
Contributor Author

I'm trying to find the place to put the count of workloads. Anyone have an idea?

@gabesaba
Copy link
Contributor

/assign

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. do-not-merge/hold Indicates that a PR should not merge because someone has issued a /hold command. do-not-merge/work-in-progress Indicates that a PR should not merge because it is a work in progress. kind/feature Categorizes issue or PR as related to a new feature. 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.

Metric Request: Can we add a metric for report the integrations that Kueue is configured with?
6 participants