Note: This bug is displayed in read-only format because the product is no longer active in Red Hat Bugzilla.

Bug 1745654

Summary: Namespace memory calculations are incorrect on namespace overview page
Product: OpenShift Container Platform Reporter: Clayton Coleman <ccoleman>
Component: MonitoringAssignee: Matthias Loibl <mloibl>
Status: CLOSED DUPLICATE QA Contact: Junqi Zhao <juzhao>
Severity: high Docs Contact:
Priority: unspecified    
Version: 4.2.0CC: alegrand, anpicker, aos-bugs, erooth, fbranczy, jokerman, kakkoyun, lcosic, mloibl, pkrupa, surbania
Target Milestone: ---   
Target Release: 4.2.0   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: Doc Type: If docs needed, set a value
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2019-08-27 13:12:04 UTC Type: Bug
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:

Description Clayton Coleman 2019-08-26 15:06:43 UTC
https://www.dropbox.com/s/9okvf89gc1s42bz/Screenshot%202019-08-26%2011.02.18.png?dl=0

The namespace summary is wrong.  It should be showing the sum of pod cgroup metrics in the namespace

    sum(metric{namespace="A",container_name="",pod_name!=""})

Is correct.

Setting high because the number is wildly wrong.

Comment 1 Samuel Padgett 2019-08-26 17:27:20 UTC
We're using `namespace:container_memory_usage_bytes:sum{namespace='${ns.metadata.name}'}` as the query.  Frederic, is there an issue with this recording rule?

What's in the screenshot is clearly wrong, but I haven't been able to reproduce.

Comment 2 Samuel Padgett 2019-08-26 19:31:00 UTC
We use the same query in other contexts, so these likely have the same issue:

~/work/console master
❯ rg container_memory_usage_bytes
frontend/public/components/build.tsx
125:          query={`pod_name:container_memory_usage_bytes:sum{pod_name='${podName}',container_name='',namespace='${namespace}'}`}

frontend/public/components/namespace.jsx
264:      query={`namespace:container_memory_usage_bytes:sum{namespace='${ns.metadata.name}'}`}
273:    query={`sort_desc(topk(10, sum by (pod_name)(container_memory_usage_bytes{container_name!="POD",container_name!="",pod_name!="", namespace="${ns.metadata.name}"})))`}

frontend/public/components/pod.tsx
184:        query={`pod_name:container_memory_usage_bytes:sum{pod_name='${pod.metadata.name}',namespace='${pod.metadata.namespace}'}`}

frontend/public/components/overview/index.tsx
475:      memory: `pod_name:container_memory_usage_bytes:sum{namespace="${namespace}"}`,

frontend/public/components/dashboards-page/overview-dashboard/queries.ts
28:  [OverviewQuery.PODS_BY_MEMORY]: 'sort_desc(pod_name:container_memory_usage_bytes:sum)',

Comment 3 Samuel Padgett 2019-08-27 13:02:50 UTC
We can change the queries in console, but I'd expect we'd want to fix `namespace:container_memory_usage_bytes:sum` and `namespace:container_cpu_usage:sum` if they're wrong. Assigning to the monitoring team to investigate. If console is simply using the wrong queries, let us know.

Comment 5 Sergiusz Urbaniak 2019-08-27 13:12:04 UTC

*** This bug has been marked as a duplicate of bug 1733825 ***

Comment 6 Red Hat Bugzilla 2023-09-14 05:42:19 UTC
The needinfo request[s] on this closed bug have been removed as they have been unresolved for 1000 days