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 metrics for cleanup controller #399
Add metrics for cleanup controller #399
Conversation
Hi @justinblalock87. 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. |
/cc @msau42 |
/ok-to-test |
pkg/metrics/node-cleanup/metrics.go
Outdated
|
||
var ( | ||
// APIServerRequestsTotal is used to collect accumulated count of apiserver requests. | ||
APIServerRequestsTotal = prometheus.NewCounterVec( |
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.
It looks like client-go may already have metrics we can leverage: https://github.com/kubernetes/client-go/blob/master/tools/metrics/metrics.go. workqueue also has metrics that may be good to gather.
I'm not 100% sure, but I think you can enable those + other standard metrics with k8s.io/component-base/metrics. Example: https://github.com/kubernetes-csi/csi-lib-utils/blob/85029276ff37ed0f2dce8fd14353f058bc527dc9/metrics/metrics.go#L30C3-L30C32
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.
Done.
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.
If you import client-go metrics I think you can remove this one:
https://github.com/kubernetes/kubernetes/blob/99190634ab252604a4496882912ac328542d649d/cmd/kube-proxy/proxy.go#L24
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.
Done.
}, | ||
) | ||
// PersistentVolumeClaimDeleteFailedTotal is used to collect accumulated count of persistent volume claim delete failed attempts. | ||
PersistentVolumeClaimDeleteFailedTotal = prometheus.NewCounter( |
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.
Do you also want a pvc delete total metric?
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.
There is a pvc delete total metric above, do you mean pv delete total? I don't have pv delete total because since the PV Deleter runs on a set interval, if the interval is too low, it calls the apiserver to delete the PV multiple times, skewing the metrics.
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.
Sorry I mean PV delete total. I guess the issue is that the informer lister may be delayed at removing the entry after the delete API call.
One solution we have done in the past, is to create a 2nd level cache. And when we delete the API objects, we'll delete it from the 2nd level cache too: https://github.com/kubernetes-sigs/sig-storage-local-static-provisioner/blob/master/pkg/cache/cache.go
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.
Given that the cache itself may take a while to implement and the current time crunch, can I add a TODO in the controller to implement the cache. I'm not sure that it is feasible with the time constraints.
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.
Sounds fine. In the meantime, I would go ahead and add the metric in and document the caveat of having a short sync period.
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.
Done.
/kind feature |
258c1f6
to
5f99ede
Compare
/remove-kind bug |
5f99ede
to
c2b32d4
Compare
/lgtm |
[APPROVALNOTIFIER] This PR is APPROVED This pull-request has been approved by: justinblalock87, msau42 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 |
What type of PR is this?
/kind feature
What this PR does / why we need it:
Adds metrics to the local PV node cleanup controller.
Release note: