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

docs: updated VPA CustomResourceStateMetrics docs #2193

Closed

Conversation

sherifkayad
Copy link

What this PR does / why we need it:
docs PR to address #2041

How does this change affect the cardinality of KSM: (increases, decreases or does not change cardinality)
N.A. .. Just a docs PR

Which issue(s) this PR fixes (optional, in fixes #<issue number>(, fixes #<issue_number>, ...) format, will close the issue(s) when PR gets merged):
Fixes #2041

@k8s-ci-robot k8s-ci-robot added the cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. label Sep 13, 2023
@k8s-ci-robot k8s-ci-robot added the needs-triage Indicates an issue or PR lacks a `triage/foo` label and requires one. label Sep 13, 2023
@k8s-ci-robot
Copy link
Contributor

Welcome @sherifkayad!

It looks like this is your first PR to kubernetes/kube-state-metrics 🎉. Please refer to our pull request process documentation to help your PR have a smooth ride to approval.

You will be prompted by a bot to use commands during the review process. Do not be afraid to follow the prompts! It is okay to experiment. Here is the bot commands documentation.

You can also check if kubernetes/kube-state-metrics has its own contribution guidelines.

You may want to refer to our testing guide if you run into trouble with your tests not passing.

If you are having difficulty getting your pull request seen, please follow the recommended escalation practices. Also, for tips and tricks in the contribution process you may want to read the Kubernetes contributor cheat sheet. We want to make sure your contribution gets all the attention it needs!

Thank you, and welcome to Kubernetes. 😃

@k8s-ci-robot k8s-ci-robot added the size/M Denotes a PR that changes 30-99 lines, ignoring generated files. label Sep 13, 2023
@sherifkayad sherifkayad force-pushed the docs-for-vpa-custom-resource branch 2 times, most recently from 6bdf818 to f34ba86 Compare September 14, 2023 07:34
@@ -272,19 +267,51 @@ spec:
target_kind: [spec, targetRef, kind]
target_name: [spec, targetRef, name]
metrics:
- name: "annotations"
help: "Kubernetes annotations converted to Prometheus labels."
- name: "vpa_containerrecommendations_target"
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggest to follow the previous VPA metrics naming format "verticalpodautoscaler_status_recommendation_containerrecommendations_target_cpu". Append resource (cpu/memory) at the end of metrics name due to this is changed to be customized metrics name, we can't have duplicate metrics name at line 270 and line 282 which both are "vpa_containerrecommendations_target".

Copy link
Author

Choose a reason for hiding this comment

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

@chihshenghuang I slightly disagree due to two reasons:

  • The name of the metric will be super long as there is already a prefix appended automatically by the custom resource (check the doc further for the full name)
  • The previous implemention had already the same metric with different labels / selectors for CPU / Memory and I think that to make it close to the original implementation (prior to v2.9.0), it should be like that.

Remember this is just an example and people can freely choose what to do / how to name the metric. I can suggest adding a line or two in the docs that this is also possible of course.

Copy link

Choose a reason for hiding this comment

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

using the same metric name both for cpu and memory will result in two HELP messages for the same type (ie # HELP kube_customresource_vpa_containerrecommendations_target VPA container recommendations for memory and # HELP kube_customresource_vpa_containerrecommendations_target VPA container recommendations for cpu). As a result, client (for example telegraf) fails to fetch metrics with Error in plugin: error reading metrics for http://kube-state-metrics.kube-system.svc.cluster.local:8080/metrics: reading text format failed: text format parsing error in line 11485: second HELP line for metric name "kube_customresource_vpa_containerrecommendations_target".

So +1 for appending resource at the end (ie - name: "vpa_containerrecommendations_target_cpu").
And if we do this, probably commonLabels can be removed

@dashpole
Copy link

/assign @dgrisonnet
/triage accepted

@k8s-ci-robot k8s-ci-robot added triage/accepted Indicates an issue or PR is ready to be actively worked on. and removed needs-triage Indicates an issue or PR lacks a `triage/foo` label and requires one. labels Sep 21, 2023
@k8s-ci-robot
Copy link
Contributor

[APPROVALNOTIFIER] This PR is NOT APPROVED

This pull-request has been approved by: sherifkayad
Once this PR has been reviewed and has the lgtm label, please ask for approval from dgrisonnet. For more information see the Kubernetes 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

@sherifkayad
Copy link
Author

Fixed MD linting issues

/test all

@k8s-ci-robot
Copy link
Contributor

@sherifkayad: Cannot trigger testing until a trusted user reviews the PR and leaves an /ok-to-test message.

In response to this:

Fixed MD linting issues

/test all

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.

@sherifkayad
Copy link
Author

@dashpole @dgrisonnet can you please re-trigger the testing pipeline again?

@CatherineF-dev
Copy link
Contributor

/ok-to-test

@k8s-ci-robot k8s-ci-robot added the ok-to-test Indicates a non-member PR verified by an org member that is safe to test. label Sep 25, 2023
Signed-off-by: Sherif Ayad <sherif.k.ayad@gmail.com>
Copy link

@k0nstantinv k0nstantinv left a comment

Choose a reason for hiding this comment

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

looks ok now

docs/customresourcestate-metrics.md Show resolved Hide resolved
@sherifkayad
Copy link
Author

looks ok now

Can you please re-trigger the tests?

@k0nstantinv
Copy link

looks ok now

Can you please re-trigger the tests?

I’m not sure I’m able to do that :)

@k0nstantinv
Copy link

@CatherineF-dev seems like we need re-trigger tests again, the doc was updated

@CatherineF-dev
Copy link
Contributor

/ok-to-test

@korjek
Copy link

korjek commented Nov 28, 2023

guys, let's move on to have this merged! This would save so much time for me (was lucky enough to bump into this PR after spending some time trying to figure out the correct config) and maybe for other folks when it's merged.

@sherifkayad
Copy link
Author

Would be really good to get this one merged soon

The above configuration was tested on [this](https://github.com/kubernetes/autoscaler/blob/master/vertical-pod-autoscaler/examples/hamster.yaml) VPA configuration, outputting the following metrics:

```
# HELP kube_customresource_vpa_containerrecommendations_target VPA container recommendations for memory.
Copy link
Member

Choose a reason for hiding this comment

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

As you can see here, this will generate two different help outputs for the same title. This should either be postfixed with _cpu / _memory (if you want two help outputs) or

Suggested change
# HELP kube_customresource_vpa_containerrecommendations_target VPA container recommendations for memory.
# HELP kube_customresource_vpa_containerrecommendations_target VPA container recommendations for CPU and memory.

- verbs:
- list
- watch
apiGroups:
Copy link
Member

Choose a reason for hiding this comment

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

Usually permissions are set per apigroup/resource Otherwise you would give permission to an (unlikely, but possible) customresourcedefinitions.autoscaling.k8s.io or verticalpodautoscalers.apiextensions.k8s.io which you did not intend to provide.

@@ -272,19 +267,51 @@ spec:
target_kind: [spec, targetRef, kind]
target_name: [spec, targetRef, name]
metrics:
- name: "annotations"
help: "Kubernetes annotations converted to Prometheus labels."
- name: "vpa_containerrecommendations_target"
Copy link

Choose a reason for hiding this comment

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

using the same metric name both for cpu and memory will result in two HELP messages for the same type (ie # HELP kube_customresource_vpa_containerrecommendations_target VPA container recommendations for memory and # HELP kube_customresource_vpa_containerrecommendations_target VPA container recommendations for cpu). As a result, client (for example telegraf) fails to fetch metrics with Error in plugin: error reading metrics for http://kube-state-metrics.kube-system.svc.cluster.local:8080/metrics: reading text format failed: text format parsing error in line 11485: second HELP line for metric name "kube_customresource_vpa_containerrecommendations_target".

So +1 for appending resource at the end (ie - name: "vpa_containerrecommendations_target_cpu").
And if we do this, probably commonLabels can be removed

The above configuration was tested on [this](https://github.com/kubernetes/autoscaler/blob/master/vertical-pod-autoscaler/examples/hamster.yaml) VPA configuration, outputting the following metrics:

```
# HELP kube_customresource_vpa_containerrecommendations_target VPA container recommendations for memory.
Copy link

@korjek korjek Nov 29, 2023

Choose a reason for hiding this comment

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

# TYPE kube_customresource_vpa_containerrecommendations_target gauge
line is missing in the output

@k8s-triage-robot
Copy link

The Kubernetes project currently lacks enough contributors to adequately respond to all PRs.

This bot triages PRs according to the following rules:

  • After 90d of inactivity, lifecycle/stale is applied
  • After 30d of inactivity since lifecycle/stale was applied, lifecycle/rotten is applied
  • After 30d of inactivity since lifecycle/rotten was applied, the PR is closed

You can:

  • Mark this PR as fresh with /remove-lifecycle stale
  • Close this PR with /close
  • Offer to help out with Issue Triage

Please send feedback to sig-contributor-experience at kubernetes/community.

/lifecycle stale

@k8s-ci-robot k8s-ci-robot added the lifecycle/stale Denotes an issue or PR has remained open with no activity and has become stale. label Feb 27, 2024
@sherifkayad
Copy link
Author

I am not really sure what needs to be done to merge this one. Has been open for a very long time and I would love to see it closed.

@korjek
Copy link

korjek commented Mar 6, 2024

indeed would be great to have this merged, so it's much easier to find correct documentation

@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 4, 2024
@k8s-triage-robot
Copy link

The Kubernetes project currently lacks enough active contributors to adequately respond to all PRs.

This bot triages PRs according to the following rules:

  • After 90d of inactivity, lifecycle/stale is applied
  • After 30d of inactivity since lifecycle/stale was applied, lifecycle/rotten is applied
  • After 30d of inactivity since lifecycle/rotten was applied, the PR is closed

You can:

  • Mark this PR as fresh with /remove-lifecycle rotten
  • Close this PR with /close
  • Offer to help out with Issue Triage

Please send feedback to sig-contributor-experience at kubernetes/community.

/lifecycle rotten

@k8s-ci-robot k8s-ci-robot added lifecycle/rotten Denotes an issue or PR that has aged beyond stale and will be auto-closed. and removed lifecycle/stale Denotes an issue or PR has remained open with no activity and has become stale. labels May 5, 2024
@k8s-triage-robot
Copy link

The Kubernetes project currently lacks enough active contributors to adequately respond to all issues and PRs.

This bot triages PRs according to the following rules:

  • After 90d of inactivity, lifecycle/stale is applied
  • After 30d of inactivity since lifecycle/stale was applied, lifecycle/rotten is applied
  • After 30d of inactivity since lifecycle/rotten was applied, the PR is closed

You can:

  • Reopen this PR with /reopen
  • Mark this PR as fresh with /remove-lifecycle rotten
  • Offer to help out with Issue Triage

Please send feedback to sig-contributor-experience at kubernetes/community.

/close

@k8s-ci-robot
Copy link
Contributor

@k8s-triage-robot: Closed this PR.

In response to this:

The Kubernetes project currently lacks enough active contributors to adequately respond to all issues and PRs.

This bot triages PRs according to the following rules:

  • After 90d of inactivity, lifecycle/stale is applied
  • After 30d of inactivity since lifecycle/stale was applied, lifecycle/rotten is applied
  • After 30d of inactivity since lifecycle/rotten was applied, the PR is closed

You can:

  • Reopen this PR with /reopen
  • Mark this PR as fresh with /remove-lifecycle rotten
  • Offer to help out with Issue Triage

Please send feedback to sig-contributor-experience at kubernetes/community.

/close

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.

@korjek
Copy link

korjek commented Jun 4, 2024

/reopen

@k8s-ci-robot
Copy link
Contributor

@korjek: You can't reopen an issue/PR unless you authored it or you are a collaborator.

In response to this:

/reopen

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.

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. lifecycle/rotten Denotes an issue or PR that has aged beyond stale and will be auto-closed. 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. size/M Denotes a PR that changes 30-99 lines, ignoring generated files. triage/accepted Indicates an issue or PR is ready to be actively worked on.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Missing replacement config for VPA collector in CRM