Skip to content

feat: Add reconciliation retry observability metrics#288

Open
rawadhossain wants to merge 1 commit into
kubernetes-sigs:mainfrom
rawadhossain:feat/add-reconciliation-metrics
Open

feat: Add reconciliation retry observability metrics#288
rawadhossain wants to merge 1 commit into
kubernetes-sigs:mainfrom
rawadhossain:feat/add-reconciliation-metrics

Conversation

@rawadhossain

Copy link
Copy Markdown
Contributor

Description

This PR adds two new metrics

What each metric does

node_readiness_api_conflicts_total

Tracks how many API conflicts occur during controller operations. Previously, only conflicts that exhausted all retries were visible through node_readiness_failures_total. If a retry succeeded, there was no signal that a conflict had happened. This metric makes those retries visible and helps identify API server contention earlier.

node_readiness_reconcile_requeue_total

Tracks why a rule reconciliation is requeued. Right now, we know a rule is being requeued, but we don't know which stage caused it. This metric records the reason for the requeue, making it easier to identify where reconciliation is failing.

The metric is labeled by reason, currently covering:

  • status_update_error
  • cleanup_error
  • taint_cleanup_error

Related to Issue #182

Type of Change

/kind feature

Testing

  • Added tests coverages.

Checklist

  • make test passes
  • make lint passes

Signed-off-by: Rawad Hossain <rawad.hossain00@gmail.com>
@kubernetes-prow kubernetes-prow Bot added the kind/feature Categorizes issue or PR as related to a new feature. label Jul 3, 2026
@netlify

netlify Bot commented Jul 3, 2026

Copy link
Copy Markdown

Deploy Preview for node-readiness-controller canceled.

Name Link
🔨 Latest commit 326cfa5
🔍 Latest deploy log https://app.netlify.com/projects/node-readiness-controller/deploys/6a47d485a60e0400086287b5

@kubernetes-prow

Copy link
Copy Markdown

[APPROVALNOTIFIER] This PR is NOT APPROVED

This pull-request has been approved by: rawadhossain
Once this PR has been reviewed and has the lgtm label, please assign mrunalp 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

@kubernetes-prow kubernetes-prow Bot added the needs-ok-to-test Indicates a PR that requires an org member to verify it is safe to test. label Jul 3, 2026
@kubernetes-prow

Copy link
Copy Markdown

Hi @rawadhossain. 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.

@kubernetes-prow kubernetes-prow Bot added size/XL Denotes a PR that changes 500-999 lines, ignoring generated files. cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. labels Jul 3, 2026
@AvineshTripathi

Copy link
Copy Markdown
Contributor

/assign

@AvineshTripathi AvineshTripathi 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.

I did some initial review and I had some questions:

  • Are we planning to visualize these metrics? If so, then how?
  • What type of answer will an operator get from these? I feel these are metrics for the controller itself, which will tell how controller is behaving in concurrent env

// Update rule status
if err := r.Controller.updateRuleStatus(ctx, rule); err != nil {
log.Error(err, "Failed to update rule status", "rule", rule.Name)
metrics.ReconcileRequeue.WithLabelValues(rule.Name, "status_update_error").Inc()

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.

there are other places too in Reconcile where we requeue for e.g. https://github.com/kubernetes-sigs/node-readiness-controller/blob/main/internal/controller/nodereadinessrule_controller.go#L151

maybe a defer function would make more sense here. Thoughts?

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

Labels

cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. kind/feature Categorizes issue or PR as related to a new feature. needs-ok-to-test Indicates a PR that requires an org member to verify it is safe to test. size/XL Denotes a PR that changes 500-999 lines, ignoring generated files.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants