Skip to content
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

Move VIRTUAL_COL_USES translation to col_index method in ChargeableField #17747

Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions app/models/chargeable_field.rb
Original file line number Diff line number Diff line change
Expand Up @@ -98,6 +98,7 @@ def self.cols_on_metric_rollup

def self.col_index(column)
@rate_cols ||= {}
column = VIRTUAL_COL_USES[column] || column
@rate_cols[column] ||= cols_on_metric_rollup.index(column.to_s)
end

Expand Down
1 change: 0 additions & 1 deletion app/models/chargeback/consumption_with_rollups.rb
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,6 @@ def tag_list_with_prefix
end

def sum(metric, sub_metric = nil)
metric = ChargeableField::VIRTUAL_COL_USES[metric] || metric
values(metric, sub_metric).sum
end

Expand Down
2 changes: 1 addition & 1 deletion spec/factories/chargeable_field.rb
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@

factory :chargeable_field_cpu_cores_used, :parent => :chargeable_field do
description 'Used CPU in Cores'
metric 'cpu_usage_rate_average'
metric 'v_derived_cpu_total_cores_used'
group 'cpu_cores'
source 'used'
end
Expand Down