Adds handling of exception inside OpenStack collector 52/7452/1
authorBenjamin Diaz <bdiaz@whitestack.com>
Thu, 9 May 2019 19:40:38 +0000 (16:40 -0300)
committerBenjamin Diaz <bdiaz@whitestack.com>
Thu, 9 May 2019 19:40:38 +0000 (16:40 -0300)
Change-Id: I9756bef185a3f9495a2ffe737bf5b8326a7e8af6
Signed-off-by: Benjamin Diaz <bdiaz@whitestack.com>
osm_mon/collector/vnf_collectors/openstack.py

index c11f63f..f32fb9d 100644 (file)
@@ -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):