From 98562b42f173aadba08ecb3a3155fb4068700686 Mon Sep 17 00:00:00 2001 From: Martin Slemr Date: Thu, 26 Jul 2018 11:18:07 +0200 Subject: [PATCH] Log archived targets during C&U collection Instead of raising exception due to missing ems_id. Fixes https://bugzilla.redhat.com/show_bug.cgi?id=1560691 --- app/models/metric/ci_mixin/capture.rb | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/app/models/metric/ci_mixin/capture.rb b/app/models/metric/ci_mixin/capture.rb index 9daa6529633..2709ac78cc4 100644 --- a/app/models/metric/ci_mixin/capture.rb +++ b/app/models/metric/ci_mixin/capture.rb @@ -131,6 +131,12 @@ def perf_capture(interval_name, start_time = nil, end_time = nil) end raise ArgumentError, _("end_time cannot be specified if start_time is nil") if start_time.nil? && !end_time.nil? + # if target (== self) is archived, skip it + if respond_to?(:ems_id) && ems_id.nil? + _log.warn("C&U collection's target is archived (no EMS associated), skipping. Target: #{log_target}") + return + end + start_time, end_time = fix_capture_start_end_time(interval_name, start_time, end_time) start_range, end_range, counters_data = just_perf_capture(interval_name, start_time, end_time)