fix(core): remove metrics for deleted resources#2017
Open
IvoGoman wants to merge 2 commits into
Open
Conversation
Contributor
There was a problem hiding this comment.
Pull request overview
This PR updates controller Prometheus metrics handling so that metric series are removed when their backing Kubernetes resources are deleted (and, for clusters, when labels change) to avoid leaving stale time series behind.
Changes:
- Plugin: delete
greenhouse_plugin_readyseries when a Plugin is successfully deleted. - Organization: delete organization readiness/SCIM metrics when an Organization is deleted.
- Cluster: delete cluster metric series on Cluster deletion and proactively drop old series before updating to prevent stale series after label changes.
Reviewed changes
Copilot reviewed 6 out of 6 changed files in this pull request and generated 3 comments.
Show a summary per file
| File | Description |
|---|---|
| internal/controller/plugin/plugin_controller.go | Deletes plugin-ready metric after successful Flux cleanup on Plugin deletion. |
| internal/controller/plugin/metrics.go | Adds helper to delete plugin-ready metric series for deleted Plugins. |
| internal/controller/organization/organization_controller.go | Deletes organization metrics during Organization deletion. |
| internal/controller/organization/metrics.go | Adds helper to delete organization metric series. |
| internal/controller/cluster/metrics.go | Drops previous cluster metric series before updating and adds a helper to delete series by partial label match. |
| internal/controller/cluster/cluster_controller.go | Deletes cluster metric series in Cluster deletion paths. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Signed-off-by: Ivo Gosemann <ivo.gosemann@sap.com>
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.
Signed-off-by: Ivo Gosemann ivo.gosemann@sap.com
Description
What type of PR is this? (check all applicable)
Related Tickets & Documents
Added tests?
Please describe the tests that you ran to verify your changes. Provide instructions so we can reproduce. Please also list any relevant details for your test configuration
Added to documentation?
Checklist