From 02f4d10c2f14cf08310853c4744dc96aca3d1ceb Mon Sep 17 00:00:00 2001 From: Atul Agarwal Date: Tue, 12 Oct 2021 07:51:26 +0000 Subject: [PATCH] Resolved Bug 1684 - MON fails to collect metrics from an OpenStack VIM with metrics support if there is another OpenStack VIM without metrics support registered Change-Id: I7319f5187efc2d2b5b0c79bf205cfd8229fa5ce1 Signed-off-by: Atul Agarwal --- osm_mon/collector/service.py | 17 +++++++++++------ 1 file changed, 11 insertions(+), 6 deletions(-) diff --git a/osm_mon/collector/service.py b/osm_mon/collector/service.py index aa27083..005f844 100644 --- a/osm_mon/collector/service.py +++ b/osm_mon/collector/service.py @@ -27,6 +27,7 @@ import logging from typing import List import concurrent.futures import time +import keystoneauth1.exceptions from osm_mon.collector.infra_collectors.onos import OnosInfraCollector from osm_mon.collector.infra_collectors.openstack import OpenstackInfraCollector @@ -202,13 +203,17 @@ class CollectorService: for future in concurrent.futures.as_completed( futures, self.conf.get("collector", "process_execution_timeout") ): - result = future.result( - timeout=int( - self.conf.get("collector", "process_execution_timeout") + try: + result = future.result( + timeout=int( + self.conf.get("collector", "process_execution_timeout") + ) ) - ) - metrics.extend(result) - log.debug("result = %s" % (result)) + metrics.extend(result) + log.debug("result = %s" % (result)) + except keystoneauth1.exceptions.connection.ConnectTimeout as e: + log.info("Keystone connection timeout during metric collection") + log.debug("Keystone connection timeout exception %s" % (e)) except concurrent.futures.TimeoutError as e: # Some processes have not completed due to timeout error log.info( -- 2.17.1