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: ----------------
Created attachment 1268851 [details] Hourly rollup values for VM
Created attachment 1268852 [details] VM Chargeback report
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.
*** This bug has been marked as a duplicate of bug 1433984 ***