Log any issues encountered during the data collection and continue to
collect the data anyway (after a sleep).
Signed-off-by: Boris Ranto <branto@redhat.com>
(cherry picked from commit
28a5c13bf993679e3098d73df27ded249f34dc99)
self.mod.log.debug('collecting cache in thread')
if self.mod.have_mon_connection():
start_time = time.time()
- data = self.mod.collect()
+
+ try:
+ data = self.mod.collect()
+ except Exception as e:
+ # Log any issues encountered during the data collection and continue
+ self.mod.log.exception("failed to collect metrics:")
+ time.sleep(self.mod.scrape_interval)
+ continue
+
duration = time.time() - start_time
self.mod.log.debug('collecting cache in thread done')