Skip to content

fix(core): remove metrics for deleted resources#2017

Open
IvoGoman wants to merge 2 commits into
mainfrom
fix/metrics
Open

fix(core): remove metrics for deleted resources#2017
IvoGoman wants to merge 2 commits into
mainfrom
fix/metrics

Conversation

@IvoGoman
Copy link
Copy Markdown
Contributor

Signed-off-by: Ivo Gosemann ivo.gosemann@sap.com

Description

What type of PR is this? (check all applicable)

  • 🍕 Feature
  • 🐛 Bug Fix
  • 📝 Documentation Update
  • 🎨 Style
  • 🧑‍💻 Code Refactor
  • 🔥 Performance Improvements
  • ✅ Test
  • 🤖 Build
  • 🔁 CI
  • 📦 Chore (Release)
  • ⏩ Revert

Related Tickets & Documents

Added tests?

  • 👍 yes
  • 🙅 no, because they aren't needed
  • 🙋 no, because I need help
  • Separate ticket for tests # (issue/pr)

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?

  • 📜 README.md
  • 🤝 Documentation pages updated
  • 🙅 no documentation needed
  • (if applicable) generated OpenAPI docs for CRD changes

Checklist

  • My code follows the style guidelines of this project
  • I have performed a self-review of my code
  • I have commented my code, particularly in hard-to-understand areas
  • My changes generate no new warnings
  • New and existing unit tests pass locally with my changes

@IvoGoman IvoGoman requested a review from a team as a code owner May 22, 2026 09:07
Copilot AI review requested due to automatic review settings May 22, 2026 09:07
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

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_ready series 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.

Comment thread internal/controller/plugin/metrics.go
Comment thread internal/controller/organization/organization_controller.go Outdated
Comment thread internal/controller/cluster/metrics.go
IvoGoman and others added 2 commits May 22, 2026 14:37
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants