Bug 1439034 - Incorrect Resource usage and Chargeback costs on the day provider is added and when consumed hours < 24
Summary: Incorrect Resource usage and Chargeback costs on the day provider is added an...
Keywords:
Status: CLOSED DUPLICATE of bug 1433984
Alias: None
Product: Red Hat CloudForms Management Engine
Classification: Red Hat
Component: Reporting
Version: 5.8.0
Hardware: Unspecified
OS: Unspecified
unspecified
medium
Target Milestone: GA
: cfme-future
Assignee: Šimon Lukašík
QA Contact: Nandini Chandra
URL:
Whiteboard: chargeback
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2017-04-05 04:41 UTC by Nandini Chandra
Modified: 2017-04-06 12:06 UTC (History)
3 users (show)

Fixed In Version:
Doc Type: If docs needed, set a value
Doc Text:
Clone Of:
Environment:
Last Closed: 2017-04-06 12:06:59 UTC
Category: ---
Cloudforms Team: ---
Target Upstream Version:
Embargoed:


Attachments (Terms of Use)
Hourly rollup values for VM (56.73 KB, image/png)
2017-04-05 04:42 UTC, Nandini Chandra
no flags Details
VM Chargeback report (25.74 KB, image/png)
2017-04-05 04:42 UTC, Nandini Chandra
no flags Details

Description Nandini Chandra 2017-04-05 04:41:17 UTC
Description of problem:
-----------------------
The fix for https://bugzilla.redhat.com/show_bug.cgi?id=1419186 was to get Chargeback reports to skip hourly rollups that are older than the VM itself.

But, it looks like hourly rollups that are older than the VM are still being considered on days when there are less than 24 hourly rollups.

I have attached a screen shot of the hourly rollup values for 'cu-24x7' VM and a Chargeback report showing the costs for this VM.

From the attached screen shot, here's the values for the hourly rollups 
on 3/27/2017:
45.4 MHz, 42.8 MHz, 42.8 MHz, 41.4 MHz, 44.6 MHz, 43.4 MHz, 45.8 MHz, 43.6 MHz

The 'CPU Used' reported in the Chargeback report is 58.31 MHz.

Based on the hourly rollup values, CPU Used 
          = (45.4 + 42.8 + 42.8 + 41.4 + 44.6 + 43.4 + 45.8 + 43.6) / 6
          = 58.3 MHz

Note that there are 8 hourly rollups, 2 of which are older than the VM itself.
But, we are summing up all the 8 values, instead of skipping the 2 hourly rollups that are older than the VM and then that sum is being divided by 6.

Since the resource usage reported is inaccurate, the Chargeback cost reported is also incorrect.

cu-24x7 creation timestamp 2017-03-27 17:02:51.380219

vmdb_production=# select timestamp, cpu_usagemhz_rate_average from metric_rollups where resource_name = 'cu-24x7' and capture_interval_name = 'hourly' and timestamp < '2017-03-28'\x\g\x
Expanded display is on.
-[ RECORD 1 ]-------------+--------------------
timestamp                 | 2017-03-27 17:00:00
cpu_usagemhz_rate_average | 42.7944444444444
-[ RECORD 2 ]-------------+--------------------
timestamp                 | 2017-03-27 16:00:00
cpu_usagemhz_rate_average | 45.425
-[ RECORD 3 ]-------------+--------------------
timestamp                 | 2017-03-27 18:00:00
cpu_usagemhz_rate_average | 42.8277777777778
-[ RECORD 4 ]-------------+--------------------
timestamp                 | 2017-03-27 19:00:00
cpu_usagemhz_rate_average | 41.3888888888889
-[ RECORD 5 ]-------------+--------------------
timestamp                 | 2017-03-27 20:00:00
cpu_usagemhz_rate_average | 44.6388888888889
-[ RECORD 6 ]-------------+--------------------
timestamp                 | 2017-03-27 21:00:00
cpu_usagemhz_rate_average | 43.4444444444444
-[ RECORD 7 ]-------------+--------------------
timestamp                 | 2017-03-27 22:00:00
cpu_usagemhz_rate_average | 45.8
-[ RECORD 8 ]-------------+--------------------
timestamp                 | 2017-03-27 23:00:00
cpu_usagemhz_rate_average | 43.5666666666667


Version-Release number of selected component (if applicable):
------------------------------------------------------------
5.8, 5.7


How reproducible:
----------------
Always


Steps to Reproduce:
-------------------
1.Manage a provider.Enable C&U collection for the provider.
2.Generate Chargeback report for any VM


Actual results:
--------------
Inaccurate resource usage and Chargeback costs reported for days where consumed hours < 24 since old hourly rollups are still being considered.

Based on the hourly rollup values, CPU Used 
          = (45.4 + 42.8 + 42.8 + 41.4 + 44.6 + 43.4 + 45.8 + 43.6) / 6
          = 58.3 MHz


Expected results:
-----------------
The resource usage and Chargeback costs for days where consumed hours < 24 should be accurate.Any hourly rollup older than the VM should be skipped.

CPU Used = (42.8 + 41.4 + 44.6 + 43.4 + 45.8 + 43.6) / 6
         = 43.6 MHz

Additional info:
----------------

Comment 2 Nandini Chandra 2017-04-05 04:42:24 UTC
Created attachment 1268851 [details]
Hourly rollup values for VM

Comment 3 Nandini Chandra 2017-04-05 04:42:49 UTC
Created attachment 1268852 [details]
VM Chargeback report

Comment 4 Nandini Chandra 2017-04-05 14:34:22 UTC
This issue occurs only on the day a provider is first added to CFME and when resources are consumed for < 24 hours and not on other days when the resources are consumed for < 24 hours.

Comment 5 Šimon Lukašík 2017-04-06 12:06:59 UTC

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


Note You need to log in before you can comment on or make changes to this bug.