From 249cffe98d70a7a83d619a96fb7cad84a5e66928 Mon Sep 17 00:00:00 2001 From: Keenan Brock Date: Sat, 8 Jul 2023 00:06:05 -0400 Subject: [PATCH] consolidate common Rollup aggregate cols lists --- app/models/metric/rollup.rb | 48 ++++++++----------------------------- 1 file changed, 10 insertions(+), 38 deletions(-) diff --git a/app/models/metric/rollup.rb b/app/models/metric/rollup.rb index aa433fe0da47..af6dd5343177 100644 --- a/app/models/metric/rollup.rb +++ b/app/models/metric/rollup.rb @@ -3,9 +3,11 @@ module Metric::Rollup [:stat_container_group_create_rate, :stat_container_group_delete_rate, :stat_container_image_registration_rate] - STORAGE_COLS = Metric.columns_hash.collect { |c, _h| c.to_sym if c.starts_with?("derived_storage_") }.compact + STORAGE_COLS = Metric.columns_hash.collect { |c, _h| c.to_sym if c.starts_with?("derived_storage_") }.compact.freeze - NON_STORAGE_ROLLUP_COLS = (ROLLUP_COLS - STORAGE_COLS) + NON_STORAGE_ROLLUP_COLS = (ROLLUP_COLS - STORAGE_COLS).freeze + BASIC_VM_CPU_COLS = [:cpu_usage_rate_average, :derived_vm_numvcpus, :derived_memory_used, :net_usage_rate_average].freeze + BASIC_VM_DISK_COLS = [:cpu_usage_rate_average, :derived_memory_used, :disk_usage_rate_average, :net_usage_rate_average].freeze AGGREGATE_COLS = { :MiqEnterprise_miq_regions => ROLLUP_COLS, @@ -39,42 +41,12 @@ module Metric::Rollup :derived_vm_numvcpus, :derived_vm_used_disk_storage, ], - :ContainerImage_containers => [ - :cpu_usage_rate_average, - :derived_vm_numvcpus, - :derived_memory_used, - :net_usage_rate_average - ], - :ContainerProject_all_container_groups => [ - :cpu_usage_rate_average, - :derived_vm_numvcpus, - :derived_memory_used, - :net_usage_rate_average - ], - :ContainerService_container_groups => [ - :cpu_usage_rate_average, - :derived_vm_numvcpus, - :derived_memory_used, - :net_usage_rate_average - ], - :ContainerReplicator_container_groups => [ - :cpu_usage_rate_average, - :derived_vm_numvcpus, - :derived_memory_used, - :net_usage_rate_average - ], - :AvailabilityZone_vms => [ - :cpu_usage_rate_average, - :derived_memory_used, - :net_usage_rate_average, - :disk_usage_rate_average - ], - :HostAggregate_vms => [ - :cpu_usage_rate_average, - :derived_memory_used, - :net_usage_rate_average, - :disk_usage_rate_average - ], + :ContainerImage_containers => BASIC_VM_CPU_COLS, + :ContainerProject_all_container_groups => BASIC_VM_CPU_COLS, + :ContainerService_container_groups => BASIC_VM_CPU_COLS, + :ContainerReplicator_container_groups => BASIC_VM_CPU_COLS, + :AvailabilityZone_vms => BASIC_VM_DISK_COLS, + :HostAggregate_vms => BASIC_VM_DISK_COLS, :Service_vms => [ :cpu_ready_delta_summation, :cpu_system_delta_summation,