Skip to content

Commit

Permalink
Do not calculate useless group metrics
Browse files Browse the repository at this point in the history
https://bugzilla.redhat.com/show_bug.cgi?id=1455690
https://bugzilla.redhat.com/show_bug.cgi?id=1454456

 - cpu is useless as it counts usagemhz and vm_numvcpus together
 - cpu_cores is useless as it only reports cpu_cores
 - memory is useless as counts used and available together
 - net_io is useless as it only reports net_ui_rate_avg
 - disk_io is useless as it only reports disk_usage_rate_avg
 - storage is useless as it counts used and allocated together
 - fixed is useless as it counts all the fixed metrics together
   (that equals to 4 for each day, not useful)
  • Loading branch information
isimluk committed May 31, 2017
1 parent 7a7350e commit afb10c1
Show file tree
Hide file tree
Showing 2 changed files with 1 addition and 8 deletions.
3 changes: 1 addition & 2 deletions app/models/chargeable_field.rb
Expand Up @@ -36,8 +36,7 @@ def adjustment_to(target_unit)
end

def metric_keys
["#{rate_name}_metric", # metric value (e.g. Storage [Used|Allocated|Fixed])
"#{group}_metric"] # total of metric's group (e.g. Storage Total)
["#{rate_name}_metric"] # metric value (e.g. Storage [Used|Allocated|Fixed])
end

def cost_keys
Expand Down
6 changes: 0 additions & 6 deletions spec/models/chargeback_vm_spec.rb
Expand Up @@ -158,7 +158,6 @@
expect(subject.memory_allocated_metric).to eq(memory_available)
used_metric = used_average_for(:derived_memory_used, hours_in_day, @vm1)
expect(subject.memory_used_metric).to eq(used_metric)
expect(subject.memory_metric).to eq(subject.memory_allocated_metric + subject.memory_used_metric)

expect(subject.memory_allocated_cost).to eq(memory_available * hourly_rate * hours_in_day)
expect(subject.memory_used_cost).to eq(used_metric * hourly_rate * hours_in_day)
Expand Down Expand Up @@ -186,7 +185,6 @@
storage_allocated_cost = vm_allocated_disk_storage * count_hourly_rate * hours_in_day
expect(subject.storage_allocated_cost).to eq(storage_allocated_cost)

expect(subject.storage_metric).to eq(subject.storage_allocated_metric + subject.storage_used_metric)
expect(subject.storage_cost).to eq(subject.storage_allocated_cost + subject.storage_used_cost)
end

Expand All @@ -204,7 +202,6 @@
expect(subject.storage_allocated_metric).to eq(vm_allocated_disk_storage.gigabytes)
used_metric = used_average_for(:derived_vm_used_disk_storage, hours_in_day, @vm1)
expect(subject.storage_used_metric).to eq(used_metric)
expect(subject.storage_metric).to eq(subject.storage_allocated_metric + subject.storage_used_metric)

expected_value = hourly_fixed_rate * hours_in_day
expect(subject.storage_allocated_cost).to be_within(0.01).of(expected_value)
Expand Down Expand Up @@ -280,7 +277,6 @@
expect(subject.memory_allocated_metric).to eq(memory_available)
used_metric = used_average_for(:derived_memory_used, hours_in_month, @vm1)
expect(subject.memory_used_metric).to be_within(0.01).of(used_metric)
expect(subject.memory_metric).to eq(subject.memory_allocated_metric + subject.memory_used_metric)

memory_allocated_cost = memory_available * hourly_rate * hours_in_month
expect(subject.memory_allocated_cost).to be_within(0.01).of(memory_allocated_cost)
Expand Down Expand Up @@ -315,7 +311,6 @@
expect(subject.storage_allocated_metric).to eq(vm_allocated_disk_storage.gigabytes)
used_metric = used_average_for(:derived_vm_used_disk_storage, hours_in_month, @vm1)
expect(subject.storage_used_metric).to be_within(0.01).of(used_metric)
expect(subject.storage_metric).to eq(subject.storage_allocated_metric + subject.storage_used_metric)

expected_value = hourly_fixed_rate * hours_in_month
expect(subject.storage_allocated_cost).to be_within(0.01).of(expected_value)
Expand All @@ -330,7 +325,6 @@
expect(subject.storage_allocated_metric).to eq(vm_allocated_disk_storage.gigabytes)
used_metric = used_average_for(:derived_vm_used_disk_storage, hours_in_month, @vm1)
expect(subject.storage_used_metric).to be_within(0.01).of(used_metric)
expect(subject.storage_metric).to eq(subject.storage_allocated_metric + subject.storage_used_metric)

expected_value = vm_allocated_disk_storage * count_hourly_rate * hours_in_month
expect(subject.storage_allocated_cost).to be_within(0.01).of(expected_value)
Expand Down

0 comments on commit afb10c1

Please sign in to comment.