add sync_agent_published_resource metric#169
Conversation
|
[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 |
|
@SimonTheLeg: The following tests failed, say
DetailsInstructions 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-sigs/prow repository. I understand the commands that are listed here. |
Summary
Adds a metric on how many published_resources are managed by the agent. Opposed to the initial issue, a gauge was chosen instead of a counter as this metric of course can decrease if a published ressource is delete.
The updating of the metric itself is done directly in the APIExport reconciliation loop as we do trigger this for all ApiExports as well as PublishedResouces with RessourceSchemas and we already to a list call there, which is perfect for determining the number of managed Published Ressources.
With regards to testing: I think we have two options here, both are not perfect. I have split them in separate commits. The unit one is kind of superficial, it just creates fakeclients and then asserts that the metric variable has been changed by the reconciler. Maybe this is good enough? Alternatively, we can have that in a proper e2e test, there the only difficulty was obtaining a free port to fetch the metrics from and it takes a lot longer.
As said, please let me know what you prefer.
What Type of PR Is This?
/kind feature
Related Issue(s)
Fixes #160
Release Notes