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 Aug 1, 2023
1 parent 1a00c40 commit d10075a
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
CONTAINER_ROLLUP_COLS = [:cpu_usage_rate_average, :derived_vm_numvcpus, :derived_memory_used, :net_usage_rate_average].freeze
VM_ROLLUP_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 => CONTAINER_ROLLUP_COLS,
:ContainerProject_all_container_groups => CONTAINER_ROLLUP_COLS,
:ContainerService_container_groups => CONTAINER_ROLLUP_COLS,
:ContainerReplicator_container_groups => CONTAINER_ROLLUP_COLS,
:AvailabilityZone_vms => VM_ROLLUP_COLS,
:HostAggregate_vms => VM_ROLLUP_COLS,
:Service_vms => [
:cpu_ready_delta_summation,
:cpu_system_delta_summation,
Expand Down

0 comments on commit d10075a

Please sign in to comment.