-
Notifications
You must be signed in to change notification settings - Fork 1.2k
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
Deeply replace the 'MetricKey' with 'NamespacedName'. #4894
Deeply replace the 'MetricKey' with 'NamespacedName'. #4894
Conversation
The metric keys are currently a concatenated version of namespace/name. However, working with strings all throughout the codebase is kinda brittle as in the end, anything could be in them. A much more typesafe method is to use 'NamespacedName' from k8s apimachinery. As it is only a struct with two strings, it is comparable via == and thus can even be used as keys for maps.
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.
@markusthoemmes: 0 warnings.
In response to this:
Today is 🐇 🕳 day 🙂 . This has been something I wanted to do a loooong time ago but now that we're scraping metrics in the autoscaler I think it's even a non-breaking change 🤔.
Proposed Changes
The metric keys are currently a concatenated version of namespace/name. However, working with strings all throughout the codebase is kinda brittle as in the end, anything could be in them.
A much more typesafe method is to use 'NamespacedName' from k8s apimachinery. As it is only a struct with two strings, it is comparable via == and thus can even be used as keys for maps.
Release Note
NONE
/assign @vagababov
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.
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.
/lgtm
[APPROVALNOTIFIER] This PR is APPROVED This pull-request has been approved by: markusthoemmes, vagababov 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 |
Today is 🐇 🕳 day 🙂 . This has been something I wanted to do a loooong time ago but now that we're scraping metrics in the autoscaler I think it's even a non-breaking change 🤔.
Proposed Changes
The metric keys are currently a concatenated version of namespace/name. However, working with strings all throughout the codebase is kinda brittle as in the end, anything could be in them.
A much more typesafe method is to use 'NamespacedName' from k8s apimachinery. As it is only a struct with two strings, it is comparable via == and thus can even be used as keys for maps.
Release Note
/assign @vagababov