-
Notifications
You must be signed in to change notification settings - Fork 1.2k
⚠️ Make all metrics opt-in #1589
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
Conversation
This commit stops registering metrics by default. Consumers may now register them explicitly via two newly-exported methods: ```go import ( crmetrics "sigs.k8s.io/controller-runtime/metrics" ) func init() { crmetrics.RegisterClientMetrics() crmetrics.RegisterReflectorMetrics() } ``` Each of these methods accepts varargs to opt *out* of any of the metrics it is responsible for. For example: ```go crmetrics.RegisterClientMetrics(crmetrics.LatencyKey) ``` This will still register `rest_client_requests_total`, but will avoid registering `rest_client_request_latency_seconds`.
[APPROVALNOTIFIER] This PR is NOT APPROVED This pull-request has been approved by: 2uasimojo 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 |
Hi @2uasimojo. 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 Once the patch is verified, the new status will be reflected by the 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. |
/close We're going to do #1587 instead, but I wanted to get this out of my brain. |
@2uasimojo: Closed this PR. In response to this:
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. |
registerReflectorMetrics() | ||
} | ||
// RegisterClientMetrics sets up the client latency metrics from client-go. | ||
// To opt *out* of specific metrics, specify their *Key consts to optOut. |
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.
Realistically this is lousy UX without a better indication that the varargs are opt out rather than in. It would probably be better to flip it.
This commit stops registering metrics by default. Consumers may now register them explicitly via two newly-exported methods:
Each of these methods accepts varargs to opt out of any of the metrics it is responsible for. For example:
This will still register
rest_client_requests_total
, but will avoidregistering
rest_client_request_latency_seconds
.fixes: #1423