Skip to content

Conversation

mrueg
Copy link
Member

@mrueg mrueg commented Aug 28, 2025

What this PR does / why we need it:
There are common metrics shared among all resources for creation, deletion, labels and annotations. We can deduplicate code this way and currently I implemented it for pods (I will apply it to other resources as well).

The downside with the current approach is, that we can flip stability only on and off for all of them, which I think is fine because of the common nature of these metrics.

How does this change affect the cardinality of KSM: (increases, decreases or does not change cardinality)
None
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 #

@k8s-ci-robot k8s-ci-robot added the cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. label Aug 28, 2025
@k8s-ci-robot
Copy link
Contributor

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: mrueg

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 needs-triage Indicates an issue or PR lacks a `triage/foo` label and requires one. approved Indicates a PR has been approved by an approver from all required OWNERS files. labels Aug 28, 2025
@github-project-automation github-project-automation bot moved this to Needs Triage in SIG Instrumentation Aug 28, 2025
@k8s-ci-robot k8s-ci-robot added the size/L Denotes a PR that changes 100-499 lines, ignoring generated files. label Aug 28, 2025
@mrueg mrueg force-pushed the deduplicate-metadata-generators branch 13 times, most recently from 8ad867d to 233ab4e Compare August 29, 2025 08:48
@mrueg mrueg force-pushed the deduplicate-metadata-generators branch from 233ab4e to 263b162 Compare August 29, 2025 12:47
@k8s-ci-robot k8s-ci-robot added size/XL Denotes a PR that changes 500-999 lines, ignoring generated files. and removed size/L Denotes a PR that changes 100-499 lines, ignoring generated files. labels Aug 29, 2025
var (
descAnnotationsHelp = "Kubernetes annotations converted to Prometheus labels."
descLabelsHelp = "Kubernetes labels converted to Prometheus labels."
descCreationHelp = "Unix creation timestamp"
Copy link
Contributor

Choose a reason for hiding this comment

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

qq: why does it have 4 new metrics while the above only deletes 2 metrics (annotation and labels)?

Seems tests are passing, just want to see what happened.

Copy link
Member Author

Choose a reason for hiding this comment

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

I moved the _created _labels _annotations _deleted metrics into the metadata file. This is still WIP, hoping to reduce code duplication. I ran into some issues with the csr resource which relies on info outside of the metadata scope.

@CatherineF-dev
Copy link
Contributor

/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 10, 2025
@rexagod rexagod moved this from Needs Triage to In Progress in SIG Instrumentation Oct 3, 2025
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. size/XL Denotes a PR that changes 500-999 lines, ignoring generated files. triage/accepted Indicates an issue or PR is ready to be actively worked on.
Projects
Status: In Progress
Development

Successfully merging this pull request may close these issues.

3 participants