Skip to content

Auto-generate feature metrics documentation for agent and operator - v2#44715

Merged
joestringer merged 7 commits intocilium:mainfrom
ajmmm:pr/auto-generate-feature-metrics-v2
Mar 31, 2026
Merged

Auto-generate feature metrics documentation for agent and operator - v2#44715
joestringer merged 7 commits intocilium:mainfrom
ajmmm:pr/auto-generate-feature-metrics-v2

Conversation

@ajmmm
Copy link
Copy Markdown
Member

@ajmmm ajmmm commented Mar 10, 2026

Following #44114 CI will now fail if feature metric documentation is out of sync. However, as noted, the developer U/X for this is poor.

This PR:

  • Adds logic to dump feature-metrics directly from the Cilium agent and operator binaries without having to be installed

  • Adds and integrates new scripts and build targets to Documentation folder so that someone can run make -C Documentation update-feature-metrics to re-generate the necessary documentation.

  • Integrates checks on these files into the documentation workflow in Github, and removes the manual checking from the IPv4 smoke test workflow.

  • For the most part, this PR is replicating the existing pattern and logic used to generate cmdref docs.

Note: this replaces an older attempt in: #44556

Added logic to auto-generate Cilium feature metric documentation from command line.

@maintainer-s-little-helper maintainer-s-little-helper bot added the dont-merge/needs-release-note-label The author needs to describe the release impact of these changes. label Mar 10, 2026
@ajmmm
Copy link
Copy Markdown
Member Author

ajmmm commented Mar 10, 2026

/test

@joestringer joestringer self-requested a review March 10, 2026 18:47
@ajmmm ajmmm force-pushed the pr/auto-generate-feature-metrics-v2 branch from e137b97 to ef9ebd4 Compare March 11, 2026 10:55
@ajmmm ajmmm marked this pull request as ready for review March 11, 2026 10:55
@ajmmm ajmmm requested review from a team as code owners March 11, 2026 10:55
@ajmmm ajmmm requested a review from joamaki March 11, 2026 10:55
@ajmmm
Copy link
Copy Markdown
Member Author

ajmmm commented Mar 11, 2026

/test

@ajmmm ajmmm requested a review from nebril March 11, 2026 10:55
Copy link
Copy Markdown
Contributor

@joamaki joamaki left a comment

Choose a reason for hiding this comment

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

operator changes LGTM

Copy link
Copy Markdown
Member

@joestringer joestringer left a comment

Choose a reason for hiding this comment

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

Sorry for the delay. One main question for potential deduplication of metrics dump commands, and a couple of nits below. But overall I like the simplification of the update process proposed by this change.

@ajmmm ajmmm force-pushed the pr/auto-generate-feature-metrics-v2 branch from ef9ebd4 to 277bf6e Compare March 26, 2026 15:23
@ajmmm
Copy link
Copy Markdown
Member Author

ajmmm commented Mar 26, 2026

/test

1 similar comment
@cilium-ariane
Copy link
Copy Markdown

cilium-ariane bot commented Mar 26, 2026

/test

@ajmmm ajmmm requested a review from joestringer March 26, 2026 15:57
@ajmmm
Copy link
Copy Markdown
Member Author

ajmmm commented Mar 26, 2026

/test

1 similar comment
@ajmmm
Copy link
Copy Markdown
Member Author

ajmmm commented Mar 30, 2026

/test

ajmmm added 6 commits March 30, 2026 13:48
Introduce the promdump metrics sub-package as a shared place for the
logic used to dump feature metrics from both the agent and operator.

The helper writes a Prometheus metrics file from a provided gatherer,
which lets the feature metrics packages share the file-generation
path without duplicating it.

Signed-off-by: Alasdair McWilliam <alasdair.mcwilliam@isovalent.com>
Extend the agent and operator feature metrics with a helper that
registers their collectors into a Prometheus registry and returns a
gatherer.

This keeps the dumping logic in promdump generic while letting the
feature metrics packages control exactly which collectors are exposed.

Signed-off-by: Alasdair McWilliam <alasdair.mcwilliam@isovalent.com>
Add shared hidden Cobra handlers for `metrics dump features` in the
agent and operator feature metrics packages.

This keeps the dump implementation close to the agent and operator
feature metric gatherer construction, while leaving binary-specific
CLI registration to follow-up commits.

Signed-off-by: Alasdair McWilliam <alasdair.mcwilliam@isovalent.com>
Wire up the hidden dump handler beneath the existing `metrics`
command so feature metric generation lives next to `metrics list`.
This avoids introducing another top-level command on the operator
while keeping the operator-specific CLI wiring isolated to its own
commit.

Also move the sub-tree command registration from metrics_list.go
into metrics.go so the latter remains focused on the `list`
subcommand.

Signed-off-by: Alasdair McWilliam <alasdair.mcwilliam@isovalent.com>
Add new metrics command to the agent, which is wired up to expose the
hidden `metrics dump features` command for documentation regeneration.
This has been done to maintain command uniformity with the operator,
as per the previous commit.

Signed-off-by: Alasdair McWilliam <alasdair.mcwilliam@isovalent.com>
Add documentation make targets and helper scripts to regenerate and
check the feature metric reference files for the agent and operator.

The update script invokes the hidden `metrics dump features` command
and feeds the generated Prometheus output into the Helm feature
documentation generator.

Note: this has required adding tools/feature-helm-generator to the
top-level make target, so the generator is available to the update
helper script.

Signed-off-by: Alasdair McWilliam <alasdair.mcwilliam@isovalent.com>
This commit adds pkg/metrics/features to the list of directories to
inspect for triggering the documentation workflow. This is helpful now
the Documentation sub-directory contains build targets to update and
check the feature metrics documentation without having to install and
run a Cilium cluster.

As a result, we can now remove the documentation checks from the
IPv4 smoke test workflow.

Signed-off-by: Alasdair McWilliam <alasdair.mcwilliam@isovalent.com>
@ajmmm ajmmm force-pushed the pr/auto-generate-feature-metrics-v2 branch from 277bf6e to 57856aa Compare March 30, 2026 12:48
@ajmmm
Copy link
Copy Markdown
Member Author

ajmmm commented Mar 30, 2026

/test

1 similar comment
@cilium-ariane
Copy link
Copy Markdown

cilium-ariane bot commented Mar 30, 2026

/test

Copy link
Copy Markdown
Member

@joestringer joestringer left a comment

Choose a reason for hiding this comment

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

LGTM, thanks.

@joestringer joestringer added the release-note/misc This PR makes changes that have no direct user impact. label Mar 30, 2026
@maintainer-s-little-helper maintainer-s-little-helper bot removed the dont-merge/needs-release-note-label The author needs to describe the release impact of these changes. label Mar 30, 2026
@ajmmm
Copy link
Copy Markdown
Member Author

ajmmm commented Mar 31, 2026

/ci-l3-l4

@joestringer joestringer added this pull request to the merge queue Mar 31, 2026
Merged via the queue into cilium:main with commit 8e8f94b Mar 31, 2026
78 of 79 checks passed
@ajmmm ajmmm deleted the pr/auto-generate-feature-metrics-v2 branch March 31, 2026 14:26
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

release-note/misc This PR makes changes that have no direct user impact.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants