Add a metric of AppWrappers counts per state#675
Conversation
Add dependency: sigs.k8s.io/controller-runtime v0.14.6 go get sigs.k8s.io/controller-runtime@v0.14.6 go mod tidy
|
[APPROVALNOTIFIER] This PR is NOT APPROVED This pull-request has been approved by: The full list of commands accepted by this bot can be found here. DetailsNeeds approval from an approver in each of these files:Approvers can indicate their approval by writing |
| awList, err := controller.appWrapperLister.List(labels.Everything()) | ||
|
|
||
| if err != nil { | ||
| klog.Errorf("[updateQueue] Unable to obtain the list of AppWrappers: %+v", err) |
There was a problem hiding this comment.
In case of error, should we update the counters to 0 or leave them as is?
There was a problem hiding this comment.
I think we should leave them as is and retry to update with new value.
There was a problem hiding this comment.
This update is done periodically. So instead of retrying, we can simply wait for the next update on the next tick.
I dug deeper into the implementation of controller.appWrapperLister.List(labels.Everything()), and it seems that since labels.Everything().Empty() returns true, there is no way that controller.appWrapperLister.List() will return an error. So the discussion seems to be purely theoretical.
Issue link
Closes #674
What changes have been made
This PR adds a custom metric to expose how many AppWrappers are per state.
It is built on top of #651. To review only the delta, skip the first 3 commits in this PR.
Verification steps
Same as mentioned in #651, I checked that the metrics are available in the codeflare-operator operator by running it:
and in a new shell:
To see the counts change, I created a sample AppWrapper:
Checks