diff --git a/app/models/metric/ci_mixin/state_finders.rb b/app/models/metric/ci_mixin/state_finders.rb index f56388261071..9d1d7b05d1ec 100644 --- a/app/models/metric/ci_mixin/state_finders.rb +++ b/app/models/metric/ci_mixin/state_finders.rb @@ -48,7 +48,7 @@ def vim_performance_state_association(ts, assoc) @last_vps_ts = ts # we are using a different timestamp # clear out relevant associations - (VimPerformanceState::ASSOCIATIONS & self.class.reflections.keys.map(&:to_sym)).each do |vps_assoc| + ((VimPerformanceState::ASSOCIATIONS + self.class::PERF_ROLLUP_CHILDREN)& self.class.reflections.keys.map(&:to_sym)).each do |vps_assoc| association(vps_assoc).reset end end diff --git a/app/models/vim_performance_state.rb b/app/models/vim_performance_state.rb index b329c64768b6..e6fee68173eb 100644 --- a/app/models/vim_performance_state.rb +++ b/app/models/vim_performance_state.rb @@ -5,8 +5,8 @@ class VimPerformanceState < ApplicationRecord belongs_to :resource, :polymorphic => true - ASSOCIATIONS = [:vms, :hosts, :ems_clusters, :ext_management_systems, :storages, :container_nodes, :container_groups, - :all_container_groups, :containers] + # we want these even if we don't roll them up + ASSOCIATIONS = Metric::Rollup::ASSOC_KEYS # Define accessors for state_data information [ @@ -187,7 +187,7 @@ def capture_total(field) def capture_assoc_ids result = {} - ASSOCIATIONS.each do |assoc| + (ASSOCIATIONS + resource.class::PERF_ROLLUP_CHILDREN).uniq.each do |assoc| method = if assoc == :vms if resource.kind_of?(EmsCluster) :all_vms_and_templates