From f8fb656c2568b9f09f0b2a5cdd9f047bed532490 Mon Sep 17 00:00:00 2001 From: Benjamin Diaz Date: Thu, 9 May 2019 16:40:38 -0300 Subject: [PATCH] Adds handling of exception inside OpenStack collector Change-Id: I9756bef185a3f9495a2ffe737bf5b8326a7e8af6 Signed-off-by: Benjamin Diaz --- osm_mon/collector/vnf_collectors/openstack.py | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/osm_mon/collector/vnf_collectors/openstack.py b/osm_mon/collector/vnf_collectors/openstack.py index c11f63f..f32fb9d 100644 --- a/osm_mon/collector/vnf_collectors/openstack.py +++ b/osm_mon/collector/vnf_collectors/openstack.py @@ -113,10 +113,14 @@ class OpenstackCollector(BaseVimCollector): "Was it recently deleted?", vdur['name'], vnf_member_index, nsr_id) continue - value = self.backend.collect_metric(metric_type, openstack_metric_name, resource_id, interface_name) - if value is not None: - metric = VnfMetric(nsr_id, vnf_member_index, vdur['name'], metric_name, value) - metrics.append(metric) + try: + value = self.backend.collect_metric(metric_type, openstack_metric_name, resource_id, + interface_name) + if value is not None: + metric = VnfMetric(nsr_id, vnf_member_index, vdur['name'], metric_name, value) + metrics.append(metric) + except Exception: + log.exception("Error collecting metric %s for vdu %s" % (metric_name, vdur['name'])) return metrics def _get_backend(self, vim_account_id: str): -- 2.25.1