Skip to content

Conversation

@bhope
Copy link
Contributor

@bhope bhope commented Jan 19, 2026

What this PR does / why we need it:

Fixes a bug where metric family types could be mutated across requests when serving different content types.

When serving Prometheus text output, info and stateset metrics were rewritten to gauge by mutating shared metric families. This caused subsequent OpenMetrics requests to return incorrect types. This change ensures per-request sanitization does not affect stored metrics.

How does this change affect the cardinality of KSM:
Does not change cardinality.

Which issue(s) this PR fixes:
Fixes #2805

@k8s-ci-robot k8s-ci-robot added needs-triage Indicates an issue or PR lacks a `triage/foo` label and requires one. cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. needs-rebase Indicates a PR cannot be merged because it has merge conflicts with HEAD. labels Jan 19, 2026
@k8s-ci-robot k8s-ci-robot requested a review from mrueg January 19, 2026 10:07
@k8s-ci-robot
Copy link
Contributor

[APPROVALNOTIFIER] This PR is NOT APPROVED

This pull-request has been approved by: bhope
Once this PR has been reviewed and has the lgtm label, please assign mrueg for approval. For more information see the Code Review Process.

The full list of commands accepted by this bot can be found here.

Details 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
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.

Details

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.

@github-project-automation github-project-automation bot moved this to Needs Triage in SIG Instrumentation Jan 19, 2026
@k8s-ci-robot k8s-ci-robot added the size/M Denotes a PR that changes 30-99 lines, ignoring generated files. label Jan 19, 2026
@bhope bhope changed the title avoid mutating metric families during write fix: avoid mutating metric families during write Jan 19, 2026
@k8s-ci-robot k8s-ci-robot removed the needs-rebase Indicates a PR cannot be merged because it has merge conflicts with HEAD. label Jan 19, 2026
@k8s-ci-robot k8s-ci-robot added size/L Denotes a PR that changes 100-499 lines, ignoring generated files. and removed size/M Denotes a PR that changes 30-99 lines, ignoring generated files. labels Jan 19, 2026
@bhope
Copy link
Contributor Author

bhope commented Jan 20, 2026

@mrueg @rexagod this PR is waiting on workflow approval (CI hasn’t started yet). When you have a moment, could you approve the workflow so checks can run? Happy to get a review once CI is green. Thanks!

@bhope
Copy link
Contributor Author

bhope commented Jan 20, 2026

All CI checks have passed now. Thanks.

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. needs-triage Indicates an issue or PR lacks a `triage/foo` label and requires one. size/L Denotes a PR that changes 100-499 lines, ignoring generated files.

Projects

Status: Needs Triage

Development

Successfully merging this pull request may close these issues.

Unpredictable format of info metrics

2 participants