[ACM-19093] <Grafana>: <Fix Issue Where managed namespaces were appearing twice in CPU Quota Table>#2467
Conversation
📝 WalkthroughWalkthroughA Grafana dashboard YAML file has two PromQL expressions in the "CPU Quota" table panel updated to add explicit ChangesCPU Quota Panel Aggregation
Estimated code review effort🎯 2 (Simple) | ⏱️ ~10 minutes Suggested labels
Suggested reviewers
Poem
🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches📝 Generate docstrings
🧪 Generate unit tests (beta)
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.
Built for teams:
One agent for your entire SDLC. Right inside Slack. 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. Comment |
There was a problem hiding this comment.
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 winApply 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
📒 Files selected for processing (1)
operators/multiclusterobservability/manifests/base/grafana/platform/dash-k8s-compute-resources-cluster.yaml
9f0e2a5 to
543a85b
Compare
…d clusters were appearing twice in cpu quota table Signed-off-by: George Aeillo <gaeillo@redhat.com>
543a85b to
0235972
Compare
|
/test e2e-kind |
|
/test test-e2e |
|
/lgtm |
|
[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 DetailsNeeds approval from an approver in each of these files:
Approvers can indicate their approval by writing |
|
[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 DetailsNeeds approval from an approver in each of these files:
Approvers can indicate their approval by writing |
|
/cherrypick release-2.15 |
|
@GeorgeFrankAeillo: new pull request created: #2515 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. |
|
/cherrypick release-2.16 |
|
/cherrypick release-2.17 |
|
@GeorgeFrankAeillo: new pull request created: #2522 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. |
|
@GeorgeFrankAeillo: new pull request created: #2523 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. |
|
/cherrypick release-2.14 |
|
@GeorgeFrankAeillo: new pull request created: #2529 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. |
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\"}andkube_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.yamlTest Plan:
Make check-metricspassesTested 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