-
Notifications
You must be signed in to change notification settings - Fork 897
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add Metering Used Hours to chargeback report #15908
Conversation
8e2436e
to
23c9f2c
Compare
Hello, |
@gshefer what Zstream are you referencing? t |
@Loicavenel 5.8.3 release. |
@gshefer is there a BZ behind this, I did request it for CFME 5.9 not for 5.8 |
@Loicavenel So I must have the exact calculation for getting this metric, else we cannot test chargeback on 5.8. |
@lpichler @Loicavenel Can you please describe me the exact calculation that is being done for this metric? so we will be able to test Chargeback also for 5.8. |
@gshefer this is unrelated to Chargeback calculation, Hours are not used. This is extra information customer are looking for. Calculation is based on metrics collected, if a metrics exist we will count the full hour. |
@Loicavenel I understand from @zeari that chargeback use this metric instead of fixed_compute_metric. |
@gshefer |
75866bd
to
f1f4301
Compare
@lpichler in which report this new field will be available? Chargeback & Performance reports? |
@Loicavenel in |
@gtanzillo @Loicavenel @zeari @gshefer PR is finished please review - I updated description. |
@miq-bot remove wip |
@lpichler unrecognized command 'remove', ignoring... Accepted commands are: add_label, assign, close_issue, move_issue, remove_label, rm_label, set_milestone |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks great, just a couple of minor changes requested 👍
db/fixtures/chargeable_fields.yml
Outdated
- :metric: user_metering_hours | ||
:group: metering | ||
:source: used | ||
:description: Used Metering |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think this would read better as Metering - Hours Used
app/models/chargeable_field.rb
Outdated
@@ -45,6 +46,10 @@ def cost_keys | |||
'total_cost'] | |||
end | |||
|
|||
def metering_used? |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Perhaps this method should be named metering?
- for available fields in report definition - adding as keys to hash with results (this hash is passed to report engine)
metering used hours * hourly rate
f1f4301
to
ed7b1ef
Compare
Checked commits lpichler/manageiq@ff2e851~...ed7b1ef with ruby 2.2.6, rubocop 0.47.1, and haml-lint 0.20.0 |
@gtanzillo updated, thanks |
Metering Used Hours is:
stared and retired.
https://github.com/ManageIQ/manageiq/blob/master/app/models/chargeback/consumption.rb#L7
Which reports ?
Chargeback for VMs
Chargeback for Projects
Chargeback for Containers Images
Report definition
Example of report:
with rate $1 per month:
so the example of the calculation is:
Metering Used Metric - is count of hours in consumption period
and we will just multiple this by hourly rate from our example it is :
($1.0 / (31.0 * 24.0) ) * 277.0 = $0.37231182795698925
so generic formula is:
Hourly Rate * Metering Used Metric
Hourly Rate
we need to convert rate from rate editor to hourly rate:
from our example:
($1.0 / (31.0 * 24.0) )
(cost in rate editor / (count of hours for month/week/day - this is the 'per XXX' from rate editor ) )
@miq-bot assign @gtanzillo
/cc @Loicavenel