-
Notifications
You must be signed in to change notification settings - Fork 2.1k
chore: Reduce code duplication for metadata metric families #2751
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
base: main
Are you sure you want to change the base?
Conversation
[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 |
8ad867d
to
233ab4e
Compare
233ab4e
to
263b162
Compare
var ( | ||
descAnnotationsHelp = "Kubernetes annotations converted to Prometheus labels." | ||
descLabelsHelp = "Kubernetes labels converted to Prometheus labels." | ||
descCreationHelp = "Unix creation timestamp" |
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
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.
/triage accepted |
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 #