-
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 CPU, CPU cores and MEMORY metering allocation to Metering reports #17938
Add CPU, CPU cores and MEMORY metering allocation to Metering reports #17938
Conversation
d8dd900
to
464fbcc
Compare
@@ -129,6 +129,14 @@ def metering_used_fields_present | |||
@metering_used_fields_present ||= @rollup_array.count { |rollup| metering_used_fields_present?(rollup) } | |||
end | |||
|
|||
def metering_allocated_for(metric) |
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'm not that familiar with chargeback reports...
But this looks like a rollup.
Is there a reason to not just do a count(:column)
in sql?
I guess the non-zero clause could be a little tricky.
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.
thanks but I cannot use it - it is rollup but after method pluck
so there are just values.
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.
darn. especially since these all look like sql group by
rollups.
GL
app/models/metering.rb
Outdated
@@ -40,7 +57,7 @@ def calculate_costs(consumption, _) | |||
end | |||
|
|||
chargable_field = ChargeableField.find_by(:group => group, :source => source) | |||
next if field == "existence_hours_metric" || field == "fixed_compute_metric" || chargable_field && chargable_field.metering? | |||
next if field == 'metering_allocated_cpu_cores_metric' || field == 'metering_allocated_cpu_metric' || field == 'metering_allocated_memory_metric' || field == "existence_hours_metric" || field == "fixed_compute_metric" || chargable_field&.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.
Maybe you can simplify this by putting the list of a"allocated" fields in an array an doing a look up of field
in ti?
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.
yes it is better, I added it 👍
36682ad
to
04122fa
Compare
app/models/chargeback_vm.rb
Outdated
@@ -24,6 +24,8 @@ class ChargebackVm < Chargeback | |||
:memory_used_cost => :float, | |||
:memory_used_metric => :float, | |||
:memory_cost => :float, | |||
:metering_used_metric => :integer, |
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.
This should be removed per our discussion
19fdff7
to
d167ced
Compare
d167ced
to
b058a02
Compare
Checked commit lpichler@b058a02 with ruby 2.3.3, rubocop 0.52.1, haml-lint 0.20.0, and yamllint 1.10.0 |
we have already Metering Used Metric and this PR is adding same thing but for allocation and concretely for CPU (VMs),CPU Cores(ContainerProject/Image) and Memory.
In Report Definitoin it looks like:
In Report Result:
Links
@miq-bot add_label enhancement
@miq-bot assign @gtanzillo