Skip to content

add sync_agent_published_resource metric#169

Merged
kcp-ci-bot merged 3 commits into
kcp-dev:mainfrom
SimonTheLeg:consumption-metrics
Jun 17, 2026
Merged

add sync_agent_published_resource metric#169
kcp-ci-bot merged 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. size/L Denotes a PR that changes 100-499 lines, ignoring generated files. labels Jun 9, 2026
@SimonTheLeg

Copy link
Copy Markdown
Member Author

/retest

because I cannot see logs anymore

@SimonTheLeg SimonTheLeg force-pushed the consumption-metrics branch from 038f77a to fb951aa Compare June 15, 2026 11:18
@SimonTheLeg SimonTheLeg requested a review from xrstf June 15, 2026 11:18

@xrstf xrstf left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

/approve

@kcp-ci-bot kcp-ci-bot added the lgtm Indicates that a PR is ready to be merged. label Jun 16, 2026
@kcp-ci-bot

Copy link
Copy Markdown
Contributor

LGTM label has been added.

DetailsGit tree hash: 3b6b2a33a76e1de39c127c57241fe03416ac166c

@kcp-ci-bot

Copy link
Copy Markdown
Contributor

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: xrstf

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

The pull request process is described 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 approved Indicates a PR has been approved by an approver from all required OWNERS files. label Jun 16, 2026
@xrstf xrstf closed this Jun 17, 2026
@xrstf xrstf reopened this Jun 17, 2026
@kcp-ci-bot kcp-ci-bot merged commit c0afb7d into kcp-dev:main Jun 17, 2026
13 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

approved Indicates a PR has been approved by an approver from all required OWNERS files. dco-signoff: yes Indicates the PR's author has signed the DCO. kind/feature Categorizes issue or PR as related to a new feature. lgtm Indicates that a PR is ready to be merged. 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

3 participants