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

provide configuration to include custom node and pod labels on metrics #859

Closed
wants to merge 1 commit into from

Conversation

a7i
Copy link
Contributor

@a7i a7i commented Jun 22, 2022

/cc @jklaw90 @damemi

In order to improve our observability/monitoring, we would like to include certain pod labels in our metrics.

use-cases:

  1. We have compliance tags to identify cost-center/teams/projects (e.g. team, project) and we need these associated with eviction metrics
  2. We would like to include labels such as toplogy.kubernetes.io/zone as it relates to our reliability/resilience efforts

I realize that in the new descheduler framework efforts, v1.Node is no longer being passed in EvictPod. If this is a deal breaker, we can just continue with podLabels but flatten out the metricsConfig structure.

@k8s-ci-robot
Copy link
Contributor

Skipping CI for Draft Pull Request.
If you want CI signal for your change, please convert it to an actual PR.
You can still manually trigger a test run with /test all

@k8s-ci-robot
Copy link
Contributor

@a7i: GitHub didn't allow me to request PR reviews from the following users: jklaw90.

Note that only kubernetes-sigs members and repo collaborators can review this PR, and authors cannot review their own PRs.

In response to this:

/cc @jklaw90 @damemi

In order to improve our observability/monitoring, we would like to include certain pod labels in our metrics.

use-cases:

  1. We have compliance tags to identify cost centers (e.g. team, project) and we need these associated with eviction metrics
  2. We would like to include labels such as toplogy.kubernetes.io/zone as it relates to our reliability/resilience efforts

I realize that in the new descheduler framework efforts, v1.Node is no longer being passed in EvictPod. If this is a deal breaker, we can just continue with podLabels but flatten out the metricsConfig structure.

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 do-not-merge/work-in-progress Indicates that a PR should not merge because it is a work in progress. label Jun 22, 2022
@k8s-ci-robot k8s-ci-robot requested a review from damemi June 22, 2022 22:04
@k8s-ci-robot k8s-ci-robot added cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. size/L Denotes a PR that changes 100-499 lines, ignoring generated files. labels Jun 22, 2022
@k8s-ci-robot
Copy link
Contributor

[APPROVALNOTIFIER] This PR is NOT APPROVED

This pull-request has been approved by:
To complete the pull request process, please assign seanmalloy after the PR has been reviewed.
You can assign the PR to them by writing /assign @seanmalloy in a comment when ready.

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

@a7i a7i marked this pull request as ready for review June 23, 2022 02:39
@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 do-not-merge/work-in-progress Indicates that a PR should not merge because it is a work in progress. labels Jun 23, 2022
@a7i
Copy link
Contributor Author

a7i commented Jun 24, 2022

/cc @knelasevero @JaneLiuL

@k8s-ci-robot
Copy link
Contributor

@a7i: GitHub didn't allow me to request PR reviews from the following users: knelasevero.

Note that only kubernetes-sigs members and repo collaborators can review this PR, and authors cannot review their own PRs.

In response to this:

/cc @knelasevero @JaneLiuL

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.

Copy link
Contributor

@damemi damemi 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 the work @a7i. This is an interesting idea. I do have some concerns, though.

As I understand it, prometheus metrics are strict in their definitions such that 2 metrics with different label sets are incompatible. I think this means that, with something like this, we could technically never mark these metrics as stable.

I think if there is a case for adding some known k8s pod/node labels to our metrics, we should just add them, or introduce them as an entirely new metric. If there is another example or precedent for dynamic re-labeling, that would reassure me. But this approach is pretty new and unique to me so I am just a little unsure about it.

For custom arbitrary pod labels, I think there is probably a better way to extract those into your metrics server without piping them through the descheduler. It might be something you're better off instrumenting in the applications themselves. Then, with the info already exported from descheduler's metrics, you can get enough to correlate the data. Have you tried something like that?

@ingvagabund
Copy link
Contributor

ingvagabund commented Jul 7, 2022

Hey @a7i. Thank You for providing detailed description and an example for better understanding.

As I understand it, prometheus metrics are strict in their definitions such that 2 metrics with different label sets are incompatible. I think this means that, with something like this, we could technically never mark these metrics as stable.

From https://kubernetes.io/blog/2021/04/23/kubernetes-release-1.21-metrics-stability-ga/#what-are-stable-metrics-and-why-do-we-need-them:

A stable metric is one which, from a consumption point of view, can be reliably consumed across a number of Kubernetes versions without risk of ingestion failure.

I don't think there's a way to say "this set of labels is guaranteed, the rest is not". So rather than extending the current one I agree with @damemi on creating a new set of metrics instead. Which we might indefinitely keep in the alpha level. Something we might call a customizable metric for custom consumption. Though I'd like to have a conformation from the metrics community that this approach is considered acceptable so we do not end up maintaining something that's not recommended by the community.

I realize that in the new descheduler framework efforts, v1.Node is no longer being passed in EvictPod.

Given the v1.Node object would be only required by the customizable metrics, we might just move the metrics out of the EvictPod. I.e. have the EvictPod return a Status struct with an eviction result (e.g. "maximum number of pods per node reached") and an eviction state (evicted, eviction rejected). Then have higher logic read the Status and record the metrics.

Once all the strategies are migrated, we can move the metrics out. The framework will create a wrapper around the EvictPod method. We can then implement any "special" handling of the eviction status transparently to all plugins. E.g. extend them as needed after we have convincing discussion with the monitoring community. @a7i what's your though on this approach?

@a7i
Copy link
Contributor Author

a7i commented Jul 7, 2022

@ingvagabund and @damemi thanks for taking a look and the feedback, it makes sense to me.

Per your suggestion, I will go ahead and move this to draft and rebase/adjust as necessary once all strategies have migrated.

@a7i a7i marked this pull request as draft July 7, 2022 13:54
@k8s-ci-robot k8s-ci-robot added do-not-merge/work-in-progress Indicates that a PR should not merge because it is a work in progress. needs-rebase Indicates a PR cannot be merged because it has merge conflicts with HEAD. labels Jul 7, 2022
@k8s-ci-robot
Copy link
Contributor

@a7i: PR needs rebase.

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
Copy link
Contributor

@a7i: 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-descheduler-test-e2e-k8s-master-1-25 24f1486 link true /test pull-descheduler-test-e2e-k8s-master-1-25

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.

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/work-in-progress Indicates that a PR should not merge because it is a work in progress. 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/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.

None yet

4 participants