Bug 1618536

Summary: Memory peak usage of allocated for collected intervals (30 day average) field does not generate within report
Product: Red Hat CloudForms Management Engine Reporter: Tuan <tuado>
Component: ReportingAssignee: Yaacov Zamir <yzamir>
Status: CLOSED CURRENTRELEASE QA Contact: Parthvi Vala <pvala>
Severity: high Docs Contact:
Priority: high    
Version: 5.9.3CC: agrare, cben, dmetzger, gblomqui, jprause, jrafanie, lsmola, obarenbo, oourfali, pvala, simaishi, smallamp, yzamir
Target Milestone: GAKeywords: TestOnly, ZStream
Target Release: 5.10.0   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: 5.10.0.23 Doc Type: If docs needed, set a value
Doc Text:
Story Points: ---
Clone Of:
: 1647056 (view as bug list) Environment:
Last Closed: 2019-02-12 16:52:13 UTC Type: Bug
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: Bug
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: CFME Core Target Upstream Version:
Embargoed:
Bug Depends On:    
Bug Blocks: 1647056    

Comment 4 Joe Rafaniello 2018-08-21 20:46:14 UTC
It looks like we're looking for max_mem_usage_absolute_average on the container project's rollup.

The min_max column for a project rollup has:

 min_max:
  {:min_cpu_usage_rate_average=>0.00972642547331155,
   :max_cpu_usage_rate_average=>0.0106778331585571,
   :min_net_usage_rate_average=>32616.2553808593,
   :max_net_usage_rate_average=>89984.0963381619,
   :min_derived_memory_used=>5177.35364583333,
   :max_derived_memory_used=>5366.46692708333,
   :min_derived_vm_count_on=>0.0,
   :max_derived_vm_count_on=>0.0,
   :min_derived_host_count_on=>0.0,
   :max_derived_host_count_on=>0.0,
   :min_derived_vm_count_off=>0.0,
   :max_derived_vm_count_off=>0.0,
   :min_derived_host_count_off=>0.0,
   :max_derived_host_count_off=>0.0,
   :min_derived_vm_numvcpus=>588.0,
   :max_derived_vm_numvcpus=>620.0,
   :min_derived_host_count_total=>0.0,
   :max_derived_host_count_total=>0.0,
   :min_derived_vm_count_total=>0.0,
   :max_derived_vm_count_total=>0.0,
   :min_stat_container_group_create_rate=>0.0,
   :max_stat_container_group_create_rate=>1.0,
   :min_stat_container_group_delete_rate=>0.0,
   :max_stat_container_group_delete_rate=>2.0},

It's missing max_mem_usage_absolute_average, so I think that's why we're not seeing it.  I'm not sure if we capture that data for container projects.

Comment 11 Joe Rafaniello 2018-09-04 17:43:52 UTC
Ladas, who might be able to look at this issue?  I'm not familiar with how we collect/rollup metrics for container/pods/projects.

Comment 28 Adam Grare 2018-10-31 19:05:56 UTC
I think the issue is that VimPerformanceState#total_mem is set here https://github.com/ManageIQ/manageiq/blob/master/app/models/vim_performance_state.rb#L165 which relies on either container_project.aggregate_memory or container_project.hardware.memory_mb, neither of which are there.

This probably never worked since we haven't changed aggregation/rollups in a long time.

Comment 29 Adam Grare 2018-10-31 19:19:31 UTC
Confirmed that if I add a method aggregate_memory to ContainerProject then I get a non-zero value in VimPerformanceState.mem_usage_absolute_average.

I recommend added an aggregate_memory method to ContainerProject which uses the aggregate_hardware from container_nodes.

Comment 30 Yaacov Zamir 2018-11-04 07:55:58 UTC
Adam hi,

> I recommend added an aggregate_memory method to ContainerProject which uses the aggregate_hardware from container_nodes.

Tried to add the aggregate_memory method and got some errors, assigning this bug to you.

Thanks
Kobi

Comment 31 Adam Grare 2018-11-05 13:42:26 UTC
Hi Yaacov, what errors?  If you want to open a WIP PR we can discuss there.

Comment 32 Yaacov Zamir 2018-11-05 14:08:06 UTC
Adam this is the current code changes, this does not work.

Can some one from core team help here ?

diff --git a/app/models/container_project.rb b/app/models/container_project.rb
index d5e89d67cd..87b780a6d4 100644
--- a/app/models/container_project.rb
+++ b/app/models/container_project.rb
@@ -43,6 +43,7 @@ class ContainerProject < ApplicationRecord
 
   include EventMixin
   include Metric::CiMixin
+  include AggregationMixin::Methods
 
   PERF_ROLLUP_CHILDREN = :all_container_groups
 
@@ -69,6 +70,14 @@ class ContainerProject < ApplicationRecord
     []
   end
 
+  def all_container_node_ids
+    return container_nodes.ids
+  end
+
+  def aggregate_memory(targets = nil)
+    aggregate_hardware(:container_nodes, :memory_mb, targets)
+  end
+

Comment 33 Yaacov Zamir 2018-11-05 15:50:09 UTC
submitted upstream:
https://github.com/ManageIQ/manageiq/pull/18159

Note:
I do not know how the aggregation code works, so I do not know it this actually solve the problem.

If someone can reproduce the BZ with and without this fix it will be very helpful.

Comment 34 Yaacov Zamir 2018-11-05 20:21:10 UTC
merged upstream:
https://github.com/ManageIQ/manageiq/pull/18159

Comment 35 CFME Bot 2018-11-05 23:01:01 UTC
New commit detected on ManageIQ/manageiq/hammer:

https://github.com/ManageIQ/manageiq/commit/58788a9dcf7205712837e301bfc57073af45e911
commit 58788a9dcf7205712837e301bfc57073af45e911
Author:     Adam Grare <agrare>
AuthorDate: Mon Nov  5 15:18:47 2018 -0500
Commit:     Adam Grare <agrare>
CommitDate: Mon Nov  5 15:18:47 2018 -0500

    Merge pull request #18159 from yaacov/wip-add-aggregate_memory-to-container-project

    Add aggregate_memory to container project

    (cherry picked from commit edd65ff422b8179622b284a549bfb4afe92168ce)

    https://bugzilla.redhat.com/show_bug.cgi?id=1618536

 app/models/container_project.rb | 17 +
 1 file changed, 17 insertions(+)

Comment 37 Parthvi Vala 2018-11-28 12:04:02 UTC
FIXED. Verified on 5.10.0.25.20181120211723_d2fd659.