fix(metrics): delete stale per-asset metric series when asset leaves active set#220
Merged
openshift-merge-bot[bot] merged 1 commit intoJun 23, 2026
Conversation
Contributor
|
/lgtm |
Member
Author
|
/approve |
|
[APPROVALNOTIFIER] This PR is APPROVED This pull-request has been approved by: tiraboschi The full list of commands accepted by this bot can be found here. The pull request process is described here DetailsNeeds approval from an approver in each of these files:
Approvers can indicate their approval by writing |
…active set When an asset is removed from the autopilot allowlist (or its CRD goes missing, or its condition is no longer met), ReconcileAsset is never called for it, so compliance_status, paused_resources, customization_info, and reconcile_duration_seconds keep their last-written value indefinitely. This produces stale /metrics output that misleads dashboards and may prevent VirtPlatformSyncFailed from firing correctly. Fix: - observability: add DeleteAssetMetrics(kind, name, namespace) that removes all four per-asset series for a resource (safe no-op when the series does not exist, including all customization_info type variants). - engine/Patcher: track the rendered kind/name/namespace per asset name in renderedIdentities (populated on every successful template render). Expose CleanupExcludedAssets(activeAssets) that deletes metric series for any asset whose identity is known but is absent from activeAssets, then removes it from the map so repeat calls are no-ops. - controller: call CleanupExcludedAssets once per reconciliation cycle after building assetsToReconcile, passing the full active set (non-HCO assets + hco-golden-config when in scope). Fixes: CNV-89268 Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com> Signed-off-by: Simone Tiraboschi <stirabos@redhat.com>
Contributor
|
/lgtm |
072117b
into
openshift-virtualization:main
7 checks passed
Member
Author
|
/cherry-pick release-4.22 |
|
@tiraboschi: new pull request created: #225 DetailsIn response to this:
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. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
When an asset is removed from the autopilot allowlist (or its CRD goes missing, or its condition is no longer met), ReconcileAsset is never called for it, so compliance_status, paused_resources, customization_info, and reconcile_duration_seconds keep their last-written value indefinitely. This produces stale /metrics output that misleads dashboards and may prevent VirtPlatformSyncFailed from firing correctly.
Fix:
Fixes: CNV-89268