Bugzilla will be upgraded to version 5.0. The upgrade date is tentatively scheduled for 2 December 2018, pending final testing and feedback.
Bug 1337278 - Inaccurate chargeback cost reported with tiered rates
Inaccurate chargeback cost reported with tiered rates
Status: CLOSED ERRATA
Product: Red Hat CloudForms Management Engine
Classification: Red Hat
Component: Reporting (Show other bugs)
5.6.0
Unspecified Unspecified
urgent Severity urgent
: GA
: 5.6.0
Assigned To: tledesma
Nandini Chandra
chargeback
:
Depends On:
Blocks: 1347696
  Show dependency treegraph
 
Reported: 2016-05-18 13:05 EDT by Nandini Chandra
Modified: 2017-09-13 15:21 EDT (History)
11 users (show)

See Also:
Fixed In Version: 5.6.0.12
Doc Type: If docs needed, set a value
Doc Text:
Story Points: ---
Clone Of:
: 1347696 (view as bug list)
Environment:
Last Closed: 2016-06-29 12:03:59 EDT
Type: Bug
Regression: ---
Mount Type: ---
Documentation: ---
CRM:
Verified Versions:
Category: ---
oVirt Team: ---
RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: ---


Attachments (Terms of Use)
Chargeback report (37.92 KB, application/pdf)
2016-05-18 13:09 EDT, Nandini Chandra
no flags Details
Chargeback_report_june15 (36.56 KB, application/pdf)
2016-06-15 03:28 EDT, Nandini Chandra
no flags Details


External Trackers
Tracker ID Priority Status Summary Last Updated
Red Hat Product Errata RHBA-2016:1348 normal SHIPPED_LIVE CFME 5.6.0 bug fixes and enhancement update 2016-06-29 14:50:04 EDT

  None (edit)
Description Nandini Chandra 2016-05-18 13:05:33 EDT
Description of problem:
-----------------------
Inaccurate chargeback costs are being reported with tiered rates.

I've used a custom tiered rate to generate a Chargeback report on my 5.6 appliance.Here's a table of the rates for Used CPU  USD/Day/MHz

Range(start-finish)|Rate(fixed, variable)
--------------------------------
0.0 - 700.0        |0, 0.04
700 - 3500         |0, 0.03
3500- 8500         |0, 0.02
8500-Infinity      |0, 0.01     

The 'Used CPU' for one of my infra VMs is 1 GHz in a day.Going by this table,the rate is 0.03 USD/Day/Mhz.The reported cost in the Chargeback report is $ 2.07.

Based on my calculation, the cost should be $1.25

CPU used cost = Used CPU in MHz * CPU rate per MHz per day / 24

1 GHz = 1000 MHz
CPU Used Cost = 1000 MHz * $0.03 (per MHz per day) / 24 = $ 1.25 


Version-Release number of selected component (if applicable):
-----------------------------
5.6.0.6


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


Steps to Reproduce:
-------------------
1.Define a custom tiered rate for a metric; for eg: CPU used
2.Create a chargeback report based on the tiered rate.


Actual results:
--------------
Inaccurate chargeback costs reported with tiered rates.


Expected results:
----------------
Accurate chargeback costs should be reported with tiered rates.


Additional info:
---------------
Comment 2 Nandini Chandra 2016-05-18 13:08:00 EDT
Attached generated chargeback report.
Comment 3 Nandini Chandra 2016-05-18 13:09 EDT
Created attachment 1159002 [details]
Chargeback report
Comment 4 Nandini Chandra 2016-05-18 13:12:01 EDT
In the issue description, I'm referring to the 'cu-24x7' VM.

My chargeback cost calculation is based on its CPU usage(1 GHz) on 5/13/2016.
Comment 5 Gregg Tanzillo 2016-05-31 12:24:02 EDT
https://github.com/ManageIQ/manageiq/pull/8862
Comment 7 Nandini Chandra 2016-06-15 03:28 EDT
Created attachment 1168233 [details]
Chargeback_report_june15
Comment 10 Amaury Glez 2016-06-16 10:55:43 EDT
Like Gregg Tanzillo says, in manageIQ this bug was fixed with https://github.com/ManageIQ/manageiq/pull/8862 . You are working on Cloudforms, then this bug will be solved in the next release of Cloudforms.
Comment 12 Amaury Glez 2016-06-17 06:47:54 EDT
(In reply to Amaury Glez from comment #10)
> Like Gregg Tanzillo says, in manageIQ this bug was fixed with
> https://github.com/ManageIQ/manageiq/pull/8862.
Comment 18 CFME Bot 2016-06-20 14:40:59 EDT
New commit detected on ManageIQ/manageiq/master:
https://github.com/ManageIQ/manageiq/commit/9283ea7b61811be33b8dfbac2c4bf53dad68eb1b

commit 9283ea7b61811be33b8dfbac2c4bf53dad68eb1b
Author:     Gregg Tanzillo <gtanzill@redhat.com>
AuthorDate: Mon Jun 20 12:46:56 2016 -0400
Commit:     Gregg Tanzillo <gtanzill@redhat.com>
CommitDate: Mon Jun 20 12:46:56 2016 -0400

    Limit tiered rates "Per Time" to only hourly
    
    Chargeback reports are generated by pulling hourly metrics, selecting rates and converting the selected rate to hourly and applying the selected to the hourly metric value.
    This does not work very well with tiered rates that are not hourly because it will use the hourly metric to select a tier that may be daily, weekly or monthly.
    This change mitigates the this by limiting to only hourly when adding or editing rate tiers.
    
    https://bugzilla.redhat.com/show_bug.cgi?id=1337278

 app/controllers/chargeback_controller.rb  | 2 +-
 app/views/chargeback/_tier_first_row.haml | 2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)
Comment 19 Oleg Barenboim 2016-06-20 14:51:38 EDT
Merged and backported https://github.com/ManageIQ/manageiq/pull/9298 to Darga
Comment 20 Nandini Chandra 2016-06-23 13:28:48 EDT
Verified in 5.6.0.12.

Verified that tiered rates are limited to only hourly and that the daily/weekly/monthly options have been removed from the UI.
Comment 22 errata-xmlrpc 2016-06-29 12:03:59 EDT
Since the problem described in this bug report should be
resolved in a recent advisory, it has been closed with a
resolution of ERRATA.

For information on the advisory, and where to find the updated
files, follow the link below.

If the solution does not work for you, open a new bug report.

https://access.redhat.com/errata/RHBA-2016:1348

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