Adds network interface name as tag in corresponding metric 06/7606/1
authorBenjamin Diaz <bdiaz@whitestack.com>
Tue, 4 Jun 2019 12:55:50 +0000 (09:55 -0300)
committerBenjamin Diaz <bdiaz@whitestack.com>
Tue, 4 Jun 2019 12:55:50 +0000 (09:55 -0300)
Change-Id: I5c02d9a0582113319936772bd456b347828f7443
Signed-off-by: Benjamin Diaz <bdiaz@whitestack.com>
osm_mon/collector/vnf_collectors/openstack.py

index f32fb9d..0eaa1b9 100644 (file)
@@ -117,7 +117,10 @@ class OpenstackCollector(BaseVimCollector):
                         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)
+                            tags = {}
+                            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:
                         log.exception("Error collecting metric %s for vdu %s" % (metric_name, vdur['name']))