Skip to content

fix(customresourcestate): generate unique HELP message for each family #2635

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

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

Conversation

Duologic
Copy link
Contributor

What this PR does / why we need it:

The family generator creates a family per GVK, this requires that the
configuration has a unique HELP text per custom metric. This is not
feasible when using wildcards as the generate will reuse the same HELP
text for each GVK it finds.

How does this change affect the cardinality of KSM: (increases, decreases or does not change cardinality)

It does not change cardinality but does change the HELP text on metrics generated by CustomResourceState.

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 #2384, fixes #2453

The family generator creates a family per GVK, this requires that the
configuration has a unique HELP text per custom metric. This is not
feasible when using wildcards as the generate will reuse the same HELP
text for each GVK it finds.
@k8s-ci-robot k8s-ci-robot added cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. needs-triage Indicates an issue or PR lacks a `triage/foo` label and requires one. labels Mar 24, 2025
@k8s-ci-robot
Copy link
Contributor

This issue is currently awaiting triage.

If kube-state-metrics contributors determine this is a relevant issue, they will accept it by applying the triage/accepted label and provide further guidance.

The triage/accepted label can be added by org members by writing /triage accepted in a comment.

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.

@k8s-ci-robot k8s-ci-robot added the size/XS Denotes a PR that changes 0-9 lines, ignoring generated files. label Mar 24, 2025
@k8s-ci-robot k8s-ci-robot added size/S Denotes a PR that changes 10-29 lines, ignoring generated files. and removed size/XS Denotes a PR that changes 0-9 lines, ignoring generated files. labels Mar 24, 2025
@mrueg
Copy link
Member

mrueg commented Mar 28, 2025

/assign @rexagod

@CatherineF-dev
Copy link
Contributor

/lgtm

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

@rexagod Anything I can do to help here?

Copy link
Member

@rexagod rexagod left a comment

Choose a reason for hiding this comment

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

@mrueg Do you see this as a breaking change? We don't offer any guarantees and such on the metric metadata, as such, the metrics stability framework only applies to a metrics' label-set, but this may still break things for the user (unofficial use-cases with grepping, etc.). Additionally, this makes the user hard opt-into a custom HELP text.

@@ -90,10 +90,13 @@ func compileFamily(f Generator, resource Resource) (*compiledFamily, error) {
if errorLogV == 0 {
errorLogV = resource.ErrorLogV
}

help := fmt.Sprintf("%s for %s/%s/%s", f.Help, resource.GroupVersionKind.Group, resource.GroupVersionKind.Version, resource.GroupVersionKind.Kind)
Copy link
Member

Choose a reason for hiding this comment

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

Copy link
Contributor Author

Choose a reason for hiding this comment

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

done

@k8s-ci-robot k8s-ci-robot removed the lgtm "Looks good to me", indicates that a PR is ready to be merged. label May 13, 2025
@k8s-ci-robot
Copy link
Contributor

New changes are detected. LGTM label has been removed.

@k8s-ci-robot
Copy link
Contributor

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: CatherineF-dev, Duologic

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 May 13, 2025
@Duologic Duologic requested a review from rexagod May 20, 2025 13:10
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. cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. needs-triage Indicates an issue or PR lacks a `triage/foo` label and requires one. size/S Denotes a PR that changes 10-29 lines, ignoring generated files.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

kube-state-metrics doesn't produce metric for Custom Resources Custom resource state metrics wildcard not working
5 participants