Added more logs for Bug 1258-CPU metrics not shown in Prometheus 36/9836/2
authoragarwalat <atul.agarwal@altran.com>
Fri, 16 Oct 2020 06:14:34 +0000 (06:14 +0000)
committeragarwalat <atul.agarwal@altran.com>
Fri, 16 Oct 2020 07:18:37 +0000 (07:18 +0000)
Change-Id: I96836587ac841a8d08506a1da37075e3200cd172
Signed-off-by: agarwalat <atul.agarwal@altran.com>
osm_mon/collector/vnf_collectors/openstack.py

index 1bb0fc8..bd2a617 100644 (file)
@@ -123,25 +123,33 @@ class OpenstackCollector(BaseVimCollector):
                             vdur['name'], vnf_member_index, nsr_id)
                         continue
                     try:
+                        log.info("Collecting metric type: %s and metric_name: %s and resource_id %s and "
+                                 "interface_name: %s", metric_type, metric_name, resource_id, interface_name)
                         value = self.backend.collect_metric(metric_type, openstack_metric_name, resource_id,
                                                             interface_name)
                         if value is not None:
+                            log.info("value: %s", value)
                             if interface_name:
                                 tags['interface'] = interface_name
                             metric = VnfMetric(nsr_id, vnf_member_index, vdur['name'], metric_name, value, tags)
                             metrics.append(metric)
-                    except Exception:
+                        else:
+                            log.info("metric value is empty")
+                    except Exception as e:
                         log.exception("Error collecting metric %s for vdu %s" % (metric_name, vdur['name']))
+                        log.info("Error in metric collection: %s" % e)
         return metrics
 
     def _get_backend(self, vim_account: dict):
         try:
             ceilometer = CeilometerBackend(vim_account)
             ceilometer.client.capabilities.get()
+            log.info("Using ceilometer backend to collect metric")
             return ceilometer
         except (HTTPException, EndpointNotFound):
             gnocchi = GnocchiBackend(vim_account)
             gnocchi.client.metric.list(limit=1)
+            log.info("Using gnocchi backend to collect metric")
             return gnocchi
 
     def _get_metric_type(self, metric_name: str, interface_name: str) -> MetricType: