Skip to content

Commit

Permalink
euwe increase metrics msg timeout
Browse files Browse the repository at this point in the history
  • Loading branch information
Jillian Tullo committed Aug 1, 2017
1 parent f956391 commit a751c7f
Show file tree
Hide file tree
Showing 4 changed files with 32 additions and 13 deletions.
7 changes: 6 additions & 1 deletion app/models/metric/purging.rb
Original file line number Diff line number Diff line change
Expand Up @@ -40,12 +40,17 @@ def self.purge_timer(ts, interval)
:class_name => name,
:method_name => "purge_#{interval}",
:role => "ems_metrics_processor",
:queue_name => "ems_metrics_processor"
:queue_name => "ems_metrics_processor",
:msg_timeout => msg_timeout
) do |_msg, find_options|
find_options.merge(:args => [ts])
end
end

def self.msg_timeout
::Settings.performance.history.queue_timeout.to_i_with_method
end

def self.purge_window_size
VMDB::Config.new("vmdb").config.fetch_path(:performance, :history, :purge_window_size) || 1000
end
Expand Down
5 changes: 5 additions & 0 deletions app/models/vmdb_metric/purging.rb
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@ def purge_timer(value, interval)
:method_name => "purge_#{interval}",
:role => "database_operations",
:queue_name => "generic",
:msg_timeout => msg_timeout,
) do |_msg, find_options|
find_options.merge(:args => [value])
end
Expand Down Expand Up @@ -86,5 +87,9 @@ def purge_by_date(older_than, interval, window = nil, &block)
_log.info("Purging #{interval} metrics older than [#{older_than}]...Complete - Deleted #{total} records")
total
end

def msg_timeout
::Settings.database.metrics_history.queue_timeout.to_i_with_method
end
end
end
2 changes: 2 additions & 0 deletions config/settings.yml
Original file line number Diff line number Diff line change
Expand Up @@ -87,6 +87,7 @@
:keep_hourly_metrics: 6.months
:purge_schedule: "50 * * * *"
:purge_window_size: 100000
:queue_timeout: 20.minutes
:drift_states:
:history:
:keep_drift_states: 6.months
Expand Down Expand Up @@ -1043,6 +1044,7 @@
:keep_hourly_performances: 6.months
:keep_realtime_performances: 4.hours
:purge_window_size: 1000
:queue_timeout: 20.minutes
:host_overhead:
:memory: 2.01.percent
:cpu: 0.15.percent
Expand Down
31 changes: 19 additions & 12 deletions spec/models/metric/purging_spec.rb
Original file line number Diff line number Diff line change
@@ -1,4 +1,22 @@
describe Metric::Purging do
let(:settings) do
{
:performance => {
:history => {
:keep_daily_performance => "6.months",
:keep_hourly_performance => "6.months",
:keep_realtime_performance => "4.hours",
:purge_window_size => 1000,
:queue_timeout => "20.minutes"
}
}
}
end

before do
stub_settings(settings)
end

context "::Purging" do
it "#purge_all_timer" do
EvmSpecHelper.create_guid_miq_server_zone
Expand All @@ -12,6 +30,7 @@
q.each do |qi|
expect(qi).to have_attributes(
:class_name => described_class.name,
:msg_timeout => 1200
)
end

Expand All @@ -24,18 +43,6 @@
let(:vm1) { FactoryGirl.create(:vm_vmware) }
let(:vm2) { FactoryGirl.create(:vm_vmware) }
let(:host) { FactoryGirl.create(:host) }
let(:settings) do
{
:performance => {
:history => {
:keep_daily_performance => "6.months",
:keep_hourly_performance => "6.months",
:keep_realtime_performance => "4.hours",
:purge_window_size => 1000
}
}
}
end

before do
stub_settings(settings)
Expand Down

0 comments on commit a751c7f

Please sign in to comment.