Skip to content
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

fix: custommetrics: always extract the headers but only write it when we have metrics #2154

Merged

Conversation

chrischdi
Copy link
Member

What this PR does / why we need it:

This PR removes the hasResources check to initialise all custom resource metric headers at startup.
By doing this, there will be no delay in adding custom resource metrics on startup (because of trying to list resources and timeout after 10s and then doing the same for the next bunch of CRs)

Instead the metrics writer now checks if there are are metrics in the first element of the store for the given header and outputs depending on that.

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

Does not affect the cardinality.

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 #2142

@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 Aug 18, 2023
@k8s-ci-robot k8s-ci-robot added the size/L Denotes a PR that changes 100-499 lines, ignoring generated files. label Aug 18, 2023
@chrischdi chrischdi force-pushed the pr-custom-metrics-missing-header branch from b28e2a1 to 64c05ae Compare August 18, 2023 14:56
@mrueg
Copy link
Member

mrueg commented Aug 18, 2023

Can you rename the commit message to be prefixed with: feat(custommetrics) or similar?

/assign @rexagod

@mrueg
Copy link
Member

mrueg commented Aug 18, 2023

/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 Aug 18, 2023
@chrischdi chrischdi force-pushed the pr-custom-metrics-missing-header branch from 64c05ae to e57a28a Compare August 18, 2023 15:43
@chrischdi chrischdi changed the title custom-metrics: always extract the headers but only write it when we have metrics fix: always extract the headers but only write it when we have metrics Aug 18, 2023
@chrischdi chrischdi changed the title fix: always extract the headers but only write it when we have metrics fix: custommetrics: always extract the headers but only write it when we have metrics Aug 18, 2023
@chihshenghuang
Copy link
Contributor

i can confirm this PR fixed the first issue i mentioned at #2141 , thanks @chrischdi

@mrueg
Copy link
Member

mrueg commented Aug 25, 2023

/lgtm

/hold
for others to review.

@k8s-ci-robot k8s-ci-robot added the do-not-merge/hold Indicates that a PR should not merge because someone has issued a /hold command. label Aug 25, 2023
@k8s-ci-robot k8s-ci-robot added lgtm "Looks good to me", indicates that a PR is ready to be merged. approved Indicates a PR has been approved by an approver from all required OWNERS files. labels Aug 25, 2023
@rexagod
Copy link
Member

rexagod commented Aug 28, 2023

/lgtm
This makes so much sense, thank you! 🎉

@k8s-ci-robot
Copy link
Contributor

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: chrischdi, mrueg, rexagod

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

@dgrisonnet
Copy link
Member

/unhold

@k8s-ci-robot k8s-ci-robot removed the do-not-merge/hold Indicates that a PR should not merge because someone has issued a /hold command. label Aug 28, 2023
@k8s-ci-robot k8s-ci-robot merged commit 535085e into kubernetes:main Aug 28, 2023
12 of 14 checks passed
@chrischdi chrischdi deleted the pr-custom-metrics-missing-header branch August 28, 2023 17:46
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. lgtm "Looks good to me", indicates that a PR is ready to be merged. size/L Denotes a PR that changes 100-499 lines, ignoring generated files. triage/accepted Indicates an issue or PR is ready to be actively worked on.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

CustomResource: no metrics if no resource exists for CRD when ksm starts
6 participants