-
Notifications
You must be signed in to change notification settings - Fork 2k
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] fix: Add allowed labels to all metrics instead of just _labels
metric
#2428
base: main
Are you sure you want to change the base?
Conversation
KSM allows providing a list of labels that should be added to the prometheus metric for the resource. These labels currently are only added to the `kube_<resource>_labels` metric. However, there are several use cases where having these labels on all of the metrics would be helpful. This change adds the allowed labels to all metrics of the resource instead of just the `_labels` metric.
[APPROVALNOTIFIER] This PR is NOT APPROVED This pull-request has been approved by: ronaknnathani 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 |
This issue is currently awaiting triage. If kube-state-metrics contributors determine this is a relevant issue, they will accept it by applying the The 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. |
Welcome @ronaknnathani! |
_labels
metric_labels
metric
@mrueg @CatherineF-dev - just checking if you got a chance to take a look. if this direction is okay, I can update the PR for rest of the resources or also send different PRs for different resources. |
I don't think this is a good idea to add all labels to all metrics as the cardinality will go up by a lot. /hold |
Hi @mrueg We would love to see this feature available for You may be concerned about the cardinality increase. Still, IHMO, this feature could be disabled by default and let the teams decide whether it is an issue. |
I second this. We have the exact same problem. We would like to NOT ingest metrics based on
metric_relabel_configs:
- source_labels: [__name__, label_foo]
action: drop
regex: kube_pod_status_ready;((?!bar).)* |
What this PR does / why we need it:
KSM allows providing a list of labels that should be added to the prometheus metric for the resource. These labels currently are only added to the
kube_<resource>_labels
metric. However, there are several use cases where having these labels on all of the metrics for the resource would be helpful. This change adds the allowed labels to all metrics of the resource instead of just the_labels
metric.Note
Currently, I have only made the change for
Pod
metrics. If this direction looks good, I can update the PR for rest of the resources.How does this change affect the cardinality of KSM: (increases, decreases or does not change cardinality)
Doesn't change the number of metrics.
Increases the labels on each prometheus metric based on allowed labels.
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 #2311
Tests
Tested locally against a
kind
cluster. Just showing a handful of metrics here.