Skip to content

[ACM-19093] <Grafana>: <Fix Issue Where managed namespaces were appearing twice in CPU Quota Table>#2467

Merged
openshift-merge-bot[bot] merged 1 commit into
mainfrom
gaeillo/ACM-19093-fix-duplicate-namespaces-in-dashboard
May 18, 2026
Merged

[ACM-19093] <Grafana>: <Fix Issue Where managed namespaces were appearing twice in CPU Quota Table>#2467
openshift-merge-bot[bot] merged 1 commit into
mainfrom
gaeillo/ACM-19093-fix-duplicate-namespaces-in-dashboard

Conversation

@GeorgeFrankAeillo

@GeorgeFrankAeillo GeorgeFrankAeillo commented May 13, 2026

Copy link
Copy Markdown
Contributor

Summary:

Edits queries made by built in cpu quota dashboard so that additional labels are removed, allowing Grafana to successfully merge the queries.

Fixes ACM-19093

Problem:

Our CPU quota dashboard was displaying two rows for each namespace in a managed cluster, when it should be only one. These rows also had differing entries in some of the columns, causing confusion.

Root Cause:

The queries that were causing the issue were
namespace_workload_pod:kube_pod_owner:relabel:avg{cluster=\"$cluster\"} and kube_pod_owner{cluster=\"$cluster\"}. Through checking in the panel explorer in Grafana, I was able to see that these two queries were returning series with additional labels other than namespace, such as __name__. Since these two queries returned a label with a key of __name__ with two different values respectively, this caused Grafana to not be able to merge all queries into one row correctly, causing two separate merges that both had the same entry for namespace.

Fix:

Edit these two queries, so that they explicitly sum by namespace, this removes the other labels and leaves namespace as the only label, matching the pattern in the other queries. This causes all of these queries to be merged onto one row.

Files Changed:

Modified: operators/multiclusterobservability/manifests/base/grafana/platform/dash-k8s-compute-resources-cluster.yaml

Test Plan:
Make check-metrics passes
Tested by disabling the MCO, editing the config map with these queries on a running cluster, and see what appears to be the correct output (only one namespace, no duplicates).

Summary by CodeRabbit

Release Notes

  • Bug Fixes
    • Updated CPU quota metrics aggregation in Grafana dashboards to explicitly group container CPU usage and workload data by namespace for improved data organization.

@coderabbitai

coderabbitai Bot commented May 13, 2026

Copy link
Copy Markdown
Contributor
📝 Walkthrough

Walkthrough

A Grafana dashboard YAML file has two PromQL expressions in the "CPU Quota" table panel updated to add explicit sum(...) grouped by namespace aggregation, affecting refId B (workload pod owner metric) and refId C (container CPU usage metric).

Changes

CPU Quota Panel Aggregation

Layer / File(s) Summary
CPU Quota table metrics with namespace aggregation
operators/multiclusterobservability/manifests/base/grafana/platform/dash-k8s-compute-resources-cluster.yaml
PromQL expressions for refId B (workload pod owner) and refId C (container CPU usage) now explicitly aggregate results using sum(...) grouped by namespace, ensuring consistent namespace-level bucketing across both metrics in the CPU Quota panel.

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~10 minutes

Suggested labels

lgtm, approved

Suggested reviewers

  • thibaultmg
  • coleenquadros

Poem

📊 A dashboard query, lean and tight,
Sums the metrics by namespace light.
Two lines fixed with surgical grace—
Aggregation finds its proper place. ✨

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
Title check ✅ Passed The title directly references the specific issue being fixed (duplicate namespaces in CPU Quota Table) and mentions the affected component (Grafana dashboard), accurately summarizing the main change.
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch gaeillo/ACM-19093-fix-duplicate-namespaces-in-dashboard

Tip

💬 Introducing Slack Agent: The best way for teams to turn conversations into code.

Slack Agent is built on CodeRabbit's deep understanding of your code, so your team can collaborate across the entire SDLC without losing context.

  • Generate code and open pull requests
  • Plan features and break down work
  • Investigate incidents and troubleshoot customer tickets together
  • Automate recurring tasks and respond to alerts with triggers
  • Summarize progress and report instantly

Built for teams:

  • Shared memory across your entire org—no repeating context
  • Per-thread sandboxes to safely plan and execute work
  • Governance built-in—scoped access, auditability, and budget controls

One agent for your entire SDLC. Right inside Slack.

👉 Get started


Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

@coderabbitai coderabbitai Bot 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.

Caution

Some comments are outside the diff and can’t be posted inline due to platform limitations.

⚠️ Outside diff range comments (1)
operators/multiclusterobservability/manifests/base/grafana/platform/dash-k8s-compute-resources-cluster.yaml (1)

1479-1479: 🛠️ Refactor suggestion | 🟠 Major | ⚡ Quick win

Apply the same fix to the Memory Requests table for consistency.

The Memory Requests table (line 1479, refId B) uses the same metric pattern that caused duplicate namespace rows in the CPU Quota table. Since you've wrapped the CPU query with sum(...) by (namespace) to strip extra labels and enable proper merging, the Memory table likely exhibits the same duplicate-row behavior and should receive the same treatment.

🔧 Proposed fix for consistency
-              "expr": "namespace_workload_pod:kube_pod_owner:relabel:avg{cluster=\"$cluster\"}",
+              "expr": "sum(namespace_workload_pod:kube_pod_owner:relabel:avg{cluster=\"$cluster\"}) by (namespace)",

Nice detective work tracking down those extra labels in the CPU table—we're debugging together! 🔍✅

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In
`@operators/multiclusterobservability/manifests/base/grafana/platform/dash-k8s-compute-resources-cluster.yaml`
at line 1479, The Memory Requests panel (refId B) uses the same metric
expression
"namespace_workload_pod:kube_pod_owner:relabel:avg{cluster=\"$cluster\"}" and is
producing duplicate namespace rows like the CPU Quota table; update the expr for
refId B to wrap the metric with sum(...) by (namespace) (the same pattern
applied in the CPU Quota query) so extra labels are aggregated away and rows
merge correctly.
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Outside diff comments:
In
`@operators/multiclusterobservability/manifests/base/grafana/platform/dash-k8s-compute-resources-cluster.yaml`:
- Line 1479: The Memory Requests panel (refId B) uses the same metric expression
"namespace_workload_pod:kube_pod_owner:relabel:avg{cluster=\"$cluster\"}" and is
producing duplicate namespace rows like the CPU Quota table; update the expr for
refId B to wrap the metric with sum(...) by (namespace) (the same pattern
applied in the CPU Quota query) so extra labels are aggregated away and rows
merge correctly.

ℹ️ Review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Enterprise

Run ID: fe64a83e-b293-47dd-b0d0-638910096307

📥 Commits

Reviewing files that changed from the base of the PR and between 228c2ac and 9f0e2a5.

📒 Files selected for processing (1)
  • operators/multiclusterobservability/manifests/base/grafana/platform/dash-k8s-compute-resources-cluster.yaml

@GeorgeFrankAeillo GeorgeFrankAeillo force-pushed the gaeillo/ACM-19093-fix-duplicate-namespaces-in-dashboard branch from 9f0e2a5 to 543a85b Compare May 13, 2026 17:23
…d clusters were appearing twice in cpu quota table

Signed-off-by: George Aeillo <gaeillo@redhat.com>
@GeorgeFrankAeillo GeorgeFrankAeillo force-pushed the gaeillo/ACM-19093-fix-duplicate-namespaces-in-dashboard branch from 543a85b to 0235972 Compare May 13, 2026 17:58
@GeorgeFrankAeillo

Copy link
Copy Markdown
Contributor Author

/test e2e-kind

@GeorgeFrankAeillo GeorgeFrankAeillo self-assigned this May 14, 2026
@GeorgeFrankAeillo GeorgeFrankAeillo changed the title Fix Issue Where managed namespaces were appearing twice in CPU Quota Table [ACM-19093] <Grafana>: <Fix Issue Where managed namespaces were appearing twice in CPU Quota Table> May 14, 2026
@dbuchanaRH

Copy link
Copy Markdown
Contributor

/test test-e2e

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

/lgtm

@coleenquadros

Copy link
Copy Markdown
Contributor

/lgtm

@openshift-ci

openshift-ci Bot commented May 18, 2026

Copy link
Copy Markdown

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: coleenquadros, dbuchanaRH, GeorgeFrankAeillo

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

@openshift-ci

openshift-ci Bot commented May 18, 2026

Copy link
Copy Markdown

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: coleenquadros, dbuchanaRH, GeorgeFrankAeillo

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

@openshift-merge-bot openshift-merge-bot Bot merged commit 3f2be0c into main May 18, 2026
30 checks passed
@openshift-merge-bot openshift-merge-bot Bot deleted the gaeillo/ACM-19093-fix-duplicate-namespaces-in-dashboard branch May 18, 2026 13:27
@GeorgeFrankAeillo

Copy link
Copy Markdown
Contributor Author

/cherrypick release-2.15

@openshift-cherrypick-robot

Copy link
Copy Markdown
Collaborator

@GeorgeFrankAeillo: new pull request created: #2515

Details

In response to this:

/cherrypick release-2.15

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.

@GeorgeFrankAeillo

Copy link
Copy Markdown
Contributor Author

/cherrypick release-2.16

@GeorgeFrankAeillo

Copy link
Copy Markdown
Contributor Author

/cherrypick release-2.17

@openshift-cherrypick-robot

Copy link
Copy Markdown
Collaborator

@GeorgeFrankAeillo: new pull request created: #2522

Details

In response to this:

/cherrypick release-2.16

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.

@openshift-cherrypick-robot

Copy link
Copy Markdown
Collaborator

@GeorgeFrankAeillo: new pull request created: #2523

Details

In response to this:

/cherrypick release-2.17

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.

@GeorgeFrankAeillo

Copy link
Copy Markdown
Contributor Author

/cherrypick release-2.14

@openshift-cherrypick-robot

Copy link
Copy Markdown
Collaborator

@GeorgeFrankAeillo: new pull request created: #2529

Details

In response to this:

/cherrypick release-2.14

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.

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.

4 participants