Skip to content

Commit

Permalink
consolidate common Rollup aggregate cols lists
Browse files Browse the repository at this point in the history
  • Loading branch information
kbrock committed Jul 15, 2023
1 parent 5805be9 commit 249cffe
Showing 1 changed file with 10 additions and 38 deletions.
48 changes: 10 additions & 38 deletions app/models/metric/rollup.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down Expand Up @@ -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,
Expand Down

0 comments on commit 249cffe

Please sign in to comment.