Skip to content

docs: correct metric names in topics/metrics.md to match exported Prometheus names#2038

Merged
k8s-ci-robot merged 1 commit into
kubernetes-sigs:mainfrom
mlushpenko:fix/metrics-docs-naming-1937
May 6, 2026
Merged

docs: correct metric names in topics/metrics.md to match exported Prometheus names#2038
k8s-ci-robot merged 1 commit into
kubernetes-sigs:mainfrom
mlushpenko:fix/metrics-docs-naming-1937

Conversation

@mlushpenko
Copy link
Copy Markdown
Contributor

Fixes #1937

What's wrong today

docs/book/src/topics/metrics.md (rendered at https://secrets-store-csi-driver.sigs.k8s.io/topics/metrics) lists metric names that do not match what the driver actually exports on /metrics. Following open-telemetry/opentelemetry-go#3360, the OpenTelemetry Prometheus exporter appends _total to counter instruments, so the counter names on the wire end with _total rather than beginning with total_.

The e2e test at test/bats/e2e-provider.bats already asserts the real names:

assert_match "node_publish_total" "${output}"
assert_match "node_unpublish_total" "${output}"
assert_match "rotation_reconcile_total" "${output}"

…which contradicts the docs.

What this PR changes

Docs-only. Updates docs/book/src/topics/metrics.md:

Counter names — match what the Prometheus exporter emits:

Before After
total_node_publish node_publish_total
total_node_unpublish node_unpublish_total
total_node_publish_error node_publish_error_total
total_node_unpublish_error node_unpublish_error_total
total_sync_k8s_secret sync_k8s_secret_total
total_rotation_reconcile rotation_reconcile_total
total_rotation_reconcile_error rotation_reconcile_error_total

Histogram name — fixed typo; the instrument is registered as k8s_secret_duration_sec in pkg/secrets-store/stats_reporter.go, not sync_k8s_secret_duration_sec.

Tags on rotation_reconcile_total / rotation_reconcile_error_total — added the provider tag, which the reporter already sets at stats_reporter.go:146 and :155 but which was missing from the docs.

Sample output block — regenerated with the current names.

Two clarifications added:

  1. A note explaining the OTEL _total suffix behavior (so future readers understand why the exported names differ from the instrument names registered in code).
  2. A note that driver metrics only appear on pods that have actually served a mount / unmount / rotation reconcile — when port-forwarding a single pod for validation it's easy to hit an idle pod and see no driver metrics, which was confusing enough to motivate this issue.

No code changes. Metric names on the wire are unchanged.

Which issue this PR fixes

Fixes #1937

Special notes for your reviewer

None.

Does this PR introduce a user-facing change?

NONE

@k8s-ci-robot k8s-ci-robot added the do-not-merge/invalid-commit-message Indicates that a PR should not merge because it has an invalid commit message. label May 6, 2026
@k8s-ci-robot k8s-ci-robot requested review from aramase and enj May 6, 2026 03:23
@k8s-ci-robot k8s-ci-robot added the needs-triage Indicates an issue or PR lacks a `triage/foo` label and requires one. label May 6, 2026
@k8s-ci-robot
Copy link
Copy Markdown
Contributor

Welcome @mlushpenko!

It looks like this is your first PR to kubernetes-sigs/secrets-store-csi-driver 🎉. Please refer to our pull request process documentation to help your PR have a smooth ride to approval.

You will be prompted by a bot to use commands during the review process. Do not be afraid to follow the prompts! It is okay to experiment. Here is the bot commands documentation.

You can also check if kubernetes-sigs/secrets-store-csi-driver has its own contribution guidelines.

You may want to refer to our testing guide if you run into trouble with your tests not passing.

If you are having difficulty getting your pull request seen, please follow the recommended escalation practices. Also, for tips and tricks in the contribution process you may want to read the Kubernetes contributor cheat sheet. We want to make sure your contribution gets all the attention it needs!

Thank you, and welcome to Kubernetes. 😃

@k8s-ci-robot k8s-ci-robot added the needs-ok-to-test Indicates a PR that requires an org member to verify it is safe to test. label May 6, 2026
@k8s-ci-robot
Copy link
Copy Markdown
Contributor

Hi @mlushpenko. Thanks for your PR.

I'm waiting for a kubernetes-sigs member to verify that this patch is reasonable to test. If it is, they should reply with /ok-to-test on its own line. Until that is done, I will not automatically test new commits in this PR, but the usual testing commands by org members will still work.

Tip

We noticed you've done this a few times! Consider joining the org to skip this step and gain /lgtm and other bot rights. We recommend asking approvers on your previous PRs to sponsor you.

Once the patch is verified, the new status will be reflected by the ok-to-test label.

I understand the commands that are listed here.

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.

@k8s-ci-robot k8s-ci-robot added size/M Denotes a PR that changes 30-99 lines, ignoring generated files. cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. labels May 6, 2026
@aramase
Copy link
Copy Markdown
Member

aramase commented May 6, 2026

/ok-to-test
/triage accepted

@k8s-ci-robot k8s-ci-robot added ok-to-test Indicates a non-member PR verified by an org member that is safe to test. triage/accepted Indicates an issue or PR is ready to be actively worked on. and removed needs-ok-to-test Indicates a PR that requires an org member to verify it is safe to test. needs-triage Indicates an issue or PR lacks a `triage/foo` label and requires one. labels May 6, 2026
Copy link
Copy Markdown
Member

@aramase aramase left a comment

Choose a reason for hiding this comment

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

Thanks for the PR!

/lgtm
/approve

@k8s-ci-robot k8s-ci-robot added lgtm "Looks good to me", indicates that a PR is ready to be merged. approved Indicates a PR has been approved by an approver from all required OWNERS files. labels May 6, 2026
@codecov-commenter
Copy link
Copy Markdown

codecov-commenter commented May 6, 2026

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 22.07%. Comparing base (fd0c075) to head (c379326).
⚠️ Report is 38 commits behind head on main.

Additional details and impacted files
@@           Coverage Diff           @@
##             main    #2038   +/-   ##
=======================================
  Coverage   22.07%   22.07%           
=======================================
  Files          57       57           
  Lines        3198     3198           
=======================================
  Hits          706      706           
  Misses       2400     2400           
  Partials       92       92           

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

The OpenTelemetry Prometheus exporter appends `_total` to counter
instruments (see open-telemetry/opentelemetry-go#3360), so the metrics
exposed at /metrics do not match the names listed in this document.

- Align the metric names in the table and sample output with the names
  the driver actually registers in pkg/secrets-store/stats_reporter.go.
- Add the provider tag to rotation_reconcile_total and
  rotation_reconcile_error_total, which the reporter already sets.
- Fix the k8s secret sync histogram name (k8s_secret_duration_sec).
- Note that metrics only appear on driver pods that have served a
  mount/unmount/rotation, which can be confusing when port-forwarding.

Refs kubernetes-sigs#1937

Signed-off-by: Maksym Lushpenko <iviakciivi@gmail.com>
@mlushpenko mlushpenko force-pushed the fix/metrics-docs-naming-1937 branch from 3cd94b8 to c379326 Compare May 6, 2026 18:12
@k8s-ci-robot k8s-ci-robot removed lgtm "Looks good to me", indicates that a PR is ready to be merged. do-not-merge/invalid-commit-message Indicates that a PR should not merge because it has an invalid commit message. labels May 6, 2026
Copy link
Copy Markdown
Member

@aramase aramase left a comment

Choose a reason for hiding this comment

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

/lgtm

@k8s-ci-robot k8s-ci-robot added the lgtm "Looks good to me", indicates that a PR is ready to be merged. label May 6, 2026
@k8s-ci-robot
Copy link
Copy Markdown
Contributor

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: aramase, mlushpenko

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

@mlushpenko
Copy link
Copy Markdown
Contributor Author

/retest

@k8s-ci-robot k8s-ci-robot merged commit 912033a into kubernetes-sigs:main May 6, 2026
27 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. cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. lgtm "Looks good to me", indicates that a PR is ready to be merged. ok-to-test Indicates a non-member PR verified by an org member that is safe to test. size/M Denotes a PR that changes 30-99 lines, ignoring generated files. triage/accepted Indicates an issue or PR is ready to be actively worked on.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Metrics naming is not updated in docs

4 participants