Skip to content

add sync_agent_published_resource metric#169

Open
SimonTheLeg wants to merge 3 commits into
kcp-dev:mainfrom
SimonTheLeg:consumption-metrics
Open

add sync_agent_published_resource metric#169
SimonTheLeg wants to merge 3 commits into
kcp-dev:mainfrom
SimonTheLeg:consumption-metrics

Conversation

@SimonTheLeg

@SimonTheLeg SimonTheLeg commented Jun 9, 2026

Copy link
Copy Markdown
Member

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

NONE

@kcp-ci-bot kcp-ci-bot added kind/feature Categorizes issue or PR as related to a new feature. release-note-none Denotes a PR that doesn't merit a release note. dco-signoff: yes Indicates the PR's author has signed the DCO. labels Jun 9, 2026
@kcp-ci-bot

Copy link
Copy Markdown
Contributor

[APPROVALNOTIFIER] This PR is NOT APPROVED

This pull-request has been approved by:
Once this PR has been reviewed and has the lgtm label, please assign embik for approval. For more information see the Code Review Process.

The full list of commands accepted by this bot can be found here.

Details Needs approval from an approver in each of these files:

Approvers can indicate their approval by writing /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

@kcp-ci-bot kcp-ci-bot added the size/L Denotes a PR that changes 100-499 lines, ignoring generated files. label Jun 9, 2026
@kcp-ci-bot

Copy link
Copy Markdown
Contributor

@SimonTheLeg: The following tests failed, say /retest to rerun all failed tests or /retest-required to rerun all mandatory failed tests:

Test name Commit Details Required Rerun command
pull-api-syncagent-verify 038f77a link true /test pull-api-syncagent-verify
pull-api-syncagent-test-e2e-kcp-0.29 038f77a link true /test pull-api-syncagent-test-e2e-kcp-0.29

Full PR test history

Details

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-sigs/prow repository. I understand the commands that are listed here.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

dco-signoff: yes Indicates the PR's author has signed the DCO. kind/feature Categorizes issue or PR as related to a new feature. release-note-none Denotes a PR that doesn't merit a release note. size/L Denotes a PR that changes 100-499 lines, ignoring generated files.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

feature: add consumption metrics to sync-agent

2 participants