From 4c5996120b408983cbb0428f70c2523d8b0ed963 Mon Sep 17 00:00:00 2001 From: James Wong Date: Tue, 19 Jun 2018 19:42:22 -0400 Subject: [PATCH] Normal Operating Range cpu/mem usage rate to use avg https://bugzilla.redhat.com/show_bug.cgi?id=1474511 --- app/models/metric/long_term_averages.rb | 2 ++ app/models/vm_or_template/right_sizing.rb | 2 ++ 2 files changed, 4 insertions(+) diff --git a/app/models/metric/long_term_averages.rb b/app/models/metric/long_term_averages.rb index b10a7adad18f..84d534f41ab8 100644 --- a/app/models/metric/long_term_averages.rb +++ b/app/models/metric/long_term_averages.rb @@ -1,6 +1,8 @@ module Metric::LongTermAverages AVG_COLS_TO_OVERHEAD_TYPE = { :cpu_usagemhz_rate_average => nil, + :cpu_usage_rate_average => nil, + :mem_usage_absolute_average => nil, :derived_memory_used => nil, :max_cpu_usage_rate_average => :cpu, :max_mem_usage_absolute_average => :memory diff --git a/app/models/vm_or_template/right_sizing.rb b/app/models/vm_or_template/right_sizing.rb index fdc44f2f999c..3fd1f7a53698 100644 --- a/app/models/vm_or_template/right_sizing.rb +++ b/app/models/vm_or_template/right_sizing.rb @@ -157,12 +157,14 @@ def max_cpu_usage_rate_average_max_over_time_period p.abs_max_cpu_usage_rate_average_value end.compact.max end + alias_method :cpu_usage_rate_average_max_over_time_period, :max_cpu_usage_rate_average_max_over_time_period def max_mem_usage_absolute_average_max_over_time_period end_date = Time.now.utc.beginning_of_day - 1 perfs = VimPerformanceAnalysis.find_perf_for_time_period(self, "daily", :end_date => end_date, :days => Metric::LongTermAverages::AVG_DAYS) perfs.collect(&:abs_max_mem_usage_absolute_average_value).compact.max end + alias_method :mem_usage_absolute_average_max_over_time_period, :max_mem_usage_absolute_average_max_over_time_period def cpu_usagemhz_rate_average_max_over_time_period end_date = Time.now.utc.beginning_of_day - 1