From: agarwalat Date: Fri, 16 Oct 2020 06:14:34 +0000 (+0000) Subject: Added more logs for Bug 1258-CPU metrics not shown in Prometheus X-Git-Tag: v8.0.3~2 X-Git-Url: https://osm.etsi.org/gitweb/?a=commitdiff_plain;h=c881d70111813c4938d10a9f1604f7a7fc0e8c17;p=osm%2FMON.git Added more logs for Bug 1258-CPU metrics not shown in Prometheus Change-Id: I96836587ac841a8d08506a1da37075e3200cd172 Signed-off-by: agarwalat (cherry picked from commit 426a544c33bd005488d3f68bd525afa5894179c5) --- diff --git a/osm_mon/collector/vnf_collectors/openstack.py b/osm_mon/collector/vnf_collectors/openstack.py index 1bb0fc8..bd2a617 100644 --- a/osm_mon/collector/vnf_collectors/openstack.py +++ b/osm_mon/collector/vnf_collectors/openstack.py @@ -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: