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

node: metrics: cpumanager: add metrics about pinning #112855

Merged
merged 2 commits into from Oct 31, 2022

Conversation

ffromani
Copy link
Contributor

@ffromani ffromani commented Oct 4, 2022

What type of PR is this?

/kind feature

What this PR does / why we need it:

Add metrics to track the cpumanager allocation/pinning behavior and failures.

Which issue(s) this PR fixes:

Fixes #112854

Special notes for your reviewer:

Does this PR introduce a user-facing change?

Add kubelet metrics to track the cpumanager cpu allocation and pinning

Additional documentation e.g., KEPs (Kubernetes Enhancement Proposals), usage docs, etc.:

Lack of cpumanager metrics emerged during the review of the KEP tracking the promotion to GA of the cpumanager.

@k8s-ci-robot k8s-ci-robot added release-note Denotes a PR that will be considered when it comes time to generate release notes. do-not-merge/work-in-progress Indicates that a PR should not merge because it is a work in progress. size/M Denotes a PR that changes 30-99 lines, ignoring generated files. 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-sig Indicates an issue or PR lacks a `sig/foo` label and requires one. needs-triage Indicates an issue or PR lacks a `triage/foo` label and requires one. needs-priority Indicates a PR lacks a `priority/foo` label and requires one. labels Oct 4, 2022
@ffromani
Copy link
Contributor Author

ffromani commented Oct 4, 2022

/sig node

@k8s-ci-robot k8s-ci-robot added sig/node Categorizes an issue or PR as relevant to SIG Node. area/kubelet sig/instrumentation Categorizes an issue or PR as relevant to SIG Instrumentation. and removed do-not-merge/needs-sig Indicates an issue or PR lacks a `sig/foo` label and requires one. labels Oct 4, 2022
@swatisehgal
Copy link
Contributor

/cc

@swatisehgal
Copy link
Contributor

/triage accepted
/priority important-soon
(as this is important for graduation for CPU Manager to GA)

@k8s-ci-robot k8s-ci-robot added triage/accepted Indicates an issue or PR is ready to be actively worked on. priority/important-soon Must be staffed and worked on either currently, or very soon, ideally in time for the next release. and removed needs-triage Indicates an issue or PR lacks a `triage/foo` label and requires one. needs-priority Indicates a PR lacks a `priority/foo` label and requires one. labels Oct 4, 2022
@ffromani ffromani changed the title WIP: node: metrics: cpumanager: add pinning metrics node: metrics: cpumanager: add pinning metrics Oct 5, 2022
@k8s-ci-robot k8s-ci-robot removed the do-not-merge/work-in-progress Indicates that a PR should not merge because it is a work in progress. label Oct 5, 2022
@ffromani
Copy link
Contributor Author

ffromani commented Oct 5, 2022

/hold
I'd like to spend some time checking/adding e2e tests

@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 Oct 5, 2022
@k8s-ci-robot k8s-ci-robot removed the size/M Denotes a PR that changes 30-99 lines, ignoring generated files. label Oct 5, 2022
@k8s-ci-robot k8s-ci-robot removed the needs-rebase Indicates a PR cannot be merged because it has merge conflicts with HEAD. label Oct 20, 2022
@ffromani
Copy link
Contributor Author

/retest-required

@k8s-ci-robot k8s-ci-robot added the needs-rebase Indicates a PR cannot be merged because it has merge conflicts with HEAD. label Oct 20, 2022
@k8s-ci-robot k8s-ci-robot removed the needs-rebase Indicates a PR cannot be merged because it has merge conflicts with HEAD. label Oct 20, 2022
pkg/kubelet/metrics/metrics.go Outdated Show resolved Hide resolved
pkg/kubelet/cm/cpumanager/policy_static.go Outdated Show resolved Hide resolved
Comment on lines +89 to +92
// Metrics to track the CPU manager behavior
CPUManagerPinningRequestsTotalKey = "cpu_manager_pinning_requests_total"
CPUManagerPinningErrorsTotalKey = "cpu_manager_pinning_errors_total"

Copy link
Contributor

Choose a reason for hiding this comment

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

What impact does adding these as kubelet metrics have if we ultimately decide to move the cpumanager outside of the kubelet as a pluggable component (as @catblade and others have been proposing).

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I can't say atm. it depends on the specifics of the move. Adding metrics to have observability of cpumanager was explicitely mentioned as GA requirement, so I believe that whatever direction we take to extract cpumanager & co, we will need to provide comparable metrics and observability features as prerequisite for GA.

@k8s-ci-robot
Copy link
Contributor

k8s-ci-robot commented Oct 26, 2022

@fromanirh: 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-kubernetes-node-kubelet-serial-cpu-manager 48c4dff17a1d6edf5c22f5297555ad3124013410 link false /test pull-kubernetes-node-kubelet-serial-cpu-manager

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

@ffromani
Copy link
Contributor Author

/retest

Copy link
Contributor

@klueska klueska left a comment

Choose a reason for hiding this comment

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

Other than the comment below, this looks good to me now. I'd still like to hear from @catblade what her thoughts on this are. It feels weird to add these metrics now, just to turn around and remove them next release if the cpumanager is pulled outside.

pkg/kubelet/cm/cpumanager/policy_static.go Outdated Show resolved Hide resolved
In order to improve the observability of the cpumanager,
add and populate metrics to track if the combination of
the kubelet configuration and podspec would trigger
exclusive core allocation and pinning.

We should avoid leaking any node/machine specific information
(e.g. core ids, even though this is admittedly an extreme example);
tracking these metrics seems to be a good first step, because
it allows us to get feedback without exposing details.

Signed-off-by: Francesco Romani <fromani@redhat.com>
Add tests to verify the cpumanager metrics are populated.

Signed-off-by: Francesco Romani <fromani@redhat.com>
@klueska
Copy link
Contributor

klueska commented Oct 31, 2022

Other than the comment below, this looks good to me now. I'd still like to hear from @catblade what her thoughts on this are. It feels weird to add these metrics now, just to turn around and remove them next release if the cpumanager is pulled outside.

Given that we have similar metrics for the devicemanager already, and the proposal from @catblade and others would see this component removed as well, I am inclined to accept this change since it is unclear if / when that proposal will ever be accepted.

@klueska
Copy link
Contributor

klueska commented Oct 31, 2022

/lgtm
/approve

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

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: dashpole, fromanirh, klueska, logicalhan, SergeyKanzhelev

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 Oct 31, 2022
@k8s-ci-robot k8s-ci-robot merged commit d0e8611 into kubernetes:master Oct 31, 2022
SIG Node CI/Test Board automation moved this from PRs - Needs Approver to Done Oct 31, 2022
SIG Node PR Triage automation moved this from Needs Approver to Done Oct 31, 2022
@k8s-ci-robot k8s-ci-robot added this to the v1.26 milestone Oct 31, 2022
@ffromani ffromani deleted the cpumanager-metrics branch October 31, 2022 10:20
@catblade
Copy link

@klueska Apologies-was at KubeCon, so was waiting to return to respond.

The proposal I have, and the code involved, would move the cpu manager into the plugin, so this would not be wasted work. It would just be available in the default plugin. If people chose to use plugins with other functionality, they could, but there is no reason not to merge this (I see it was merged).

@klueska
Copy link
Contributor

klueska commented Nov 2, 2022

Great. Thanks for the confirmation.

ffromani added a commit to ffromani/kubernetes that referenced this pull request Oct 4, 2023
In order to improve the observability of the memory manager,
kickoff the related metrics with the minimal desired set
of allocation and errors count, similarly to what we did
in cpumanager in kubernetes#112855 .

We intentionally take a minimallistic approach, adding metrics
once we have a clear use case for them and high confidence
they will be useful.

Signed-off-by: Francesco Romani <fromani@redhat.com>
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/kubelet area/test 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. priority/important-soon Must be staffed and worked on either currently, or very soon, ideally in time for the next release. release-note Denotes a PR that will be considered when it comes time to generate release notes. sig/instrumentation Categorizes an issue or PR as relevant to SIG Instrumentation. sig/node Categorizes an issue or PR as relevant to SIG Node. sig/testing Categorizes an issue or PR as relevant to SIG Testing. size/L Denotes a PR that changes 100-499 lines, ignoring generated files. triage/accepted Indicates an issue or PR is ready to be actively worked on.
Development

Successfully merging this pull request may close these issues.

Add metrics for cpumanager
8 participants