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

✨ Add a separate registry for workqueue metrics #2671

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

sonamkshenoy
Copy link

This PR addresses #2670

A separate registry has been created for work queue metrics, so that we can import just this registry directly as metrics.WorkqueueRegistry without getting loads of other unrelated metrics.
This retains the previous behaviour as all the metrics are still available in the main Registry.

Copy link

linux-foundation-easycla bot commented Feb 1, 2024

CLA Signed

The committers listed above are authorized under a signed CLA.

  • ✅ login: sonamkshenoy / name: Sonam (916073d)

@k8s-ci-robot k8s-ci-robot added the cncf-cla: no Indicates the PR's author has not signed the CNCF CLA. label Feb 1, 2024
@k8s-ci-robot
Copy link
Contributor

[APPROVALNOTIFIER] This PR is NOT APPROVED

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

The full list of commands accepted by this bot can be found 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 needs-ok-to-test Indicates a PR that requires an org member to verify it is safe to test. label Feb 1, 2024
@k8s-ci-robot
Copy link
Contributor

Welcome @sonamkshenoy!

It looks like this is your first PR to kubernetes-sigs/controller-runtime 🎉. Please refer to our pull request process documentation to help your PR have a smooth ride to approval.

You will be prompted by a bot to use commands during the review process. Do not be afraid to follow the prompts! It is okay to experiment. Here is the bot commands documentation.

You can also check if kubernetes-sigs/controller-runtime has its own contribution guidelines.

You may want to refer to our testing guide if you run into trouble with your tests not passing.

If you are having difficulty getting your pull request seen, please follow the recommended escalation practices. Also, for tips and tricks in the contribution process you may want to read the Kubernetes contributor cheat sheet. We want to make sure your contribution gets all the attention it needs!

Thank you, and welcome to Kubernetes. 😃

@k8s-ci-robot
Copy link
Contributor

Hi @sonamkshenoy. Thanks for your PR.

I'm waiting for a kubernetes-sigs member to verify that this patch is reasonable to test. If it is, they should reply with /ok-to-test on its own line. Until that is done, I will not automatically test new commits in this PR, but the usual testing commands by org members will still work. Regular contributors should join the org to skip this step.

Once the patch is verified, the new status will be reflected by the ok-to-test label.

I understand the commands that are listed here.

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/test-infra repository.

@k8s-ci-robot k8s-ci-robot added the size/S Denotes a PR that changes 10-29 lines, ignoring generated files. label Feb 1, 2024
@k8s-ci-robot k8s-ci-robot added cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. and removed cncf-cla: no Indicates the PR's author has not signed the CNCF CLA. labels Feb 1, 2024
@troy0820
Copy link
Member

troy0820 commented Feb 1, 2024

/hold

This does allow the existing behavior while introducing the set of metrics you propose to a different registry. However, this does not allow this to be configurable in the init and set this to what you provided.

In the issue we discussed allowing this to take the defined metrics to be initialized to a new registry to not utilize the internal registry.

If what you need are the metrics defined by this package, to have it be provided to the new registry, is there a way we can do this on the consumer side where you can push them to where ever you want?

It sounded like the problem was you didn't want all the rest of the stuff and the things you did need, you wanted them in a different registry.

@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 Feb 1, 2024
@sonamkshenoy
Copy link
Author

sonamkshenoy commented Feb 1, 2024

Hey @troy0820

Yep, I need just the work queue related metrics in my application. So, in this case (which implements the approach 1), I could have these metrics directly as metrics.WorkqueueRegistry. And I won't need the metrics.Registry anymore.

If what you need are the metrics defined by this package, to have it be provided to the new registry, is there a way we can do this on the consumer side where you can push them to where ever you want?

I'm not sure there is a way I can do this? The init() function in this package gets called before the init() function in our application as it is being imported (and probably called first). Thus, even if we create our metrics, we can't register them with the work queue, unless we remove the SetProvider() function in the init() of this file.

WorkqueueRegistry.MustRegister(longestRunningProcessor)
WorkqueueRegistry.MustRegister(retries)

Registry.Register(WorkqueueRegistry)
Copy link
Member

Choose a reason for hiding this comment

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

I understand the problem, but this means that the workqueue metrics will disappear for all existing users. That is not an option. We need to find a solution that does not break existing users.

/hold

Copy link
Author

Choose a reason for hiding this comment

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

Hey @alvaroaleman , these metrics won't disappear actually. We are adding those metrics back to the main Registry with Registry.Register(WorkqueueRegistry). So this won't affect anything for existing users.

@sonamkshenoy
Copy link
Author

sonamkshenoy commented Feb 2, 2024

Hey @troy0820 @alvaroaleman

There are 2 more options I could think of:

  1. Just capitalise the metrics in this file workqueue.go without any other additions in the code, so that they can be exposed for use to users who can register them with their registry. [Would there be any issue with this?]
  2. Functionality for users to register metrics of their choice as in ✨ Allow users to create custom registries #2672. I guess this is what @troy0820 was referring to?

@k8s-triage-robot
Copy link

The Kubernetes project currently lacks enough contributors to adequately respond to all PRs.

This bot triages PRs according to the following rules:

  • After 90d of inactivity, lifecycle/stale is applied
  • After 30d of inactivity since lifecycle/stale was applied, lifecycle/rotten is applied
  • After 30d of inactivity since lifecycle/rotten was applied, the PR is closed

You can:

  • Mark this PR as fresh with /remove-lifecycle stale
  • Close this PR with /close
  • Offer to help out with Issue Triage

Please send feedback to sig-contributor-experience at kubernetes/community.

/lifecycle stale

@k8s-ci-robot k8s-ci-robot added the lifecycle/stale Denotes an issue or PR has remained open with no activity and has become stale. label May 2, 2024
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. do-not-merge/hold Indicates that a PR should not merge because someone has issued a /hold command. lifecycle/stale Denotes an issue or PR has remained open with no activity and has become stale. needs-ok-to-test Indicates a PR that requires an org member to verify it is safe to test. 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.

None yet

5 participants