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

chore: Merge metrics to fire singleton metrics to controller_runtime metric namespace #225

Conversation

jonathan-innis
Copy link
Member

@jonathan-innis jonathan-innis commented Mar 1, 2023

Fixes #

Description

  • Migrate all singleton metrics inside of the controller_runtime namespace by leveraging prometheus AlreadyRegisteredError to grab the already registered collector and fire metrics to the same namespace

How was this change tested?

make presubmit

By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license.

@coveralls
Copy link

coveralls commented Mar 1, 2023

Pull Request Test Coverage Report for Build 4306702662

  • 21 of 48 (43.75%) changed or added relevant lines in 8 files are covered.
  • 3 unchanged lines in 1 file lost coverage.
  • Overall coverage increased (+0.2%) to 80.999%

Changes Missing Coverage Covered Lines Changed/Added Lines %
pkg/controllers/metrics/state/controller.go 0 1 0.0%
pkg/controllers/provisioning/controller.go 0 1 0.0%
pkg/operator/controller/singleton.go 16 41 39.02%
Files with Coverage Reduction New Missed Lines %
pkg/operator/controller/singleton.go 3 20.0%
Totals Coverage Status
Change from base Build 4266917395: 0.2%
Covered Lines: 6390
Relevant Lines: 7889

💛 - Coveralls

@jonathan-innis jonathan-innis marked this pull request as ready for review March 1, 2023 18:20
@jonathan-innis jonathan-innis requested a review from a team as a code owner March 1, 2023 18:20
Copy link
Contributor

@bwagner5 bwagner5 left a comment

Choose a reason for hiding this comment

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

I'd rather start the conversation of upstreaming these controllers rather than doing this hack that we'll have to maintain. It doesn't seem like the maintenance would be that much (I don't see controller-runtime removing these metrics), but maybe some get added that we have to stay in-sync with. Without a clear ask where this is actually helping someone, I'd rather not do this.

@jonathan-innis
Copy link
Member Author

I'd rather start the conversation of upstreaming these controllers rather than doing this hack that we'll have to maintain. It doesn't seem like the maintenance would be that much (I don't see controller-runtime removing these metrics), but maybe some get added that we have to stay in-sync with. Without a clear ask where this is actually helping someone, I'd rather not do this.

I think that conversation should happen either way; however, we've already taken on the burden of maintaining the same controller metrics as controller_runtime (in part because they are really useful for customers to see what's going on across the controllers). So I think that either way, all of these metrics should make it in for us, either under the controller_runtime namespace or under the karpenter_controller namespace.

I think what's more controversial is if they should be under the same namespace using this "hack." While I don't love it, I think that prometheus recognizes this as a supported method of switching over between a metric that is already registered so I don't really worry about them removing that.

Copy link
Contributor

@bwagner5 bwagner5 left a comment

Choose a reason for hiding this comment

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

LGTM

@jonathan-innis jonathan-innis merged commit c4e0862 into kubernetes-sigs:main Mar 2, 2023
@jonathan-innis jonathan-innis deleted the controller-runtime-ns-metrics branch March 2, 2023 19:44
@jonathan-innis
Copy link
Member Author

Linking the relevant controller-runtime issue that tracks the SingletonController: kubernetes-sigs/controller-runtime#2220

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants