Change PLMNStatus and CellGlobalID metrics to int, add PhyCellID
Change-Id: I2bb69a52b587bb72965e1f9ec14e31fcd1b0b39a
diff --git a/VERSION b/VERSION
index 7486fdb..f38fc53 100644
--- a/VERSION
+++ b/VERSION
@@ -1 +1 @@
-0.7.2
+0.7.3
diff --git a/edge-monitoring-server/edge_monitoring_server.py b/edge-monitoring-server/edge_monitoring_server.py
index 3fd0212..2096ff6 100755
--- a/edge-monitoring-server/edge_monitoring_server.py
+++ b/edge-monitoring-server/edge_monitoring_server.py
@@ -241,6 +241,12 @@
"ace-menlo-staging": "(Compute)-MP-1-Aether Staging"
}
+plmnstatus_mapping = {
+ "Not Searching": 1,
+ "Searching": 2,
+ "Success": 3
+}
+
# Legacy test status metrics, reporting a status code between -2 and 2
cp_status = prom.Gauge("aetheredge_status_control_plane", "Control plane status code", ["name"])
up_status = prom.Gauge("aetheredge_status_user_plane", "User plane status code", ["name"])
@@ -253,8 +259,9 @@
# Dongle Stats (strings can't be stored in Prometheus)
dongle_stats_imsi = prom.Gauge("aetheredge_dongle_stats_imsi", "IMSI of the UE", ["name"])
-dongle_stats_cellglobalid = prom.Gauge("aetheredge_dongle_stats_cellglobalid", "CellGlobalID of the UE", ["name", "value"])
-dongle_stats_plmnstatus = prom.Gauge("aetheredge_dongle_stats_plmnstatus", "PLMNStatus of the UE", ["name", "value"])
+dongle_stats_cellglobalid = prom.Gauge("aetheredge_dongle_stats_cellglobalid", "CellGlobalID of the UE", ["name"])
+dongle_stats_plmnstatus = prom.Gauge("aetheredge_dongle_stats_plmnstatus", "PLMNStatus of the UE", ["name"])
+dongle_stats_phycellid = prom.Gauge("aetheredge_dongle_stats_phycellid", "PhyCellID of the UE", ["name"])
# Ping dry_run metrics
ping_dry_run_transmitted = prom.Gauge("aetheredge_ping_dry_run_test_transmitted","Last ping test to dry_run number of transmitted packets",["name"])
@@ -409,8 +416,9 @@
try:
dongle_stats_imsi.remove(name)
- dongle_stats_cellglobalid.clear()
- dongle_stats_plmnstatus.clear()
+ dongle_stats_cellglobalid.remove(name)
+ dongle_stats_plmnstatus.remove(name)
+ dongle_stats_phycellid.remove(name)
except:
pass
@@ -488,8 +496,12 @@
try:
dongle_stats_imsi.labels(edge['name']).set(float(edge['dongle_stats']['IMSI']))
- dongle_stats_cellglobalid.labels(name=edge['name'], value=edge['dongle_stats']['CellGlobalID']).set(0)
- dongle_stats_plmnstatus.labels(name=edge['name'], value=edge['dongle_stats']['PLMNStatus']).set(0)
+ dongle_stats_cellglobalid.labels(edge['name']).set(int(edge['dongle_stats']['CellGlobalID'], 16))
+ dongle_stats_phycellid.labels(edge['name']).set(edge['dongle_stats']['PhyCellID'])
+ if edge['dongle_stats']['PLMNStatus'] in plmnstatus_mapping:
+ dongle_stats_plmnstatus.labels(edge['name']).set(plmnstatus_mapping[edge['dongle_stats']['PLMNStatus']])
+ else:
+ dongle_stats_plmnstatus.labels(edge['name']).set(0)
except KeyError:
pass
@@ -585,6 +597,7 @@
res.append(prom.generate_latest(dongle_stats_imsi))
res.append(prom.generate_latest(dongle_stats_cellglobalid))
res.append(prom.generate_latest(dongle_stats_plmnstatus))
+ res.append(prom.generate_latest(dongle_stats_phycellid))
res.append(prom.generate_latest(ping_dry_run_min))
res.append(prom.generate_latest(ping_dry_run_avg))
diff --git a/edge-monitoring-server/test_edge_monitoring_server.py b/edge-monitoring-server/test_edge_monitoring_server.py
index 15bcca5..1786d6e 100755
--- a/edge-monitoring-server/test_edge_monitoring_server.py
+++ b/edge-monitoring-server/test_edge_monitoring_server.py
@@ -23,6 +23,7 @@
'SuccessfulFetch': True,
'IMSI': '315021000000000',
'CellGlobalID': '315010001F800',
+ 'PhyCellID': '101',
'PLMNStatus': 'Success'
},
'speedtest': {
@@ -439,8 +440,10 @@
def _assert_dongle_stats_metrics_exist(self, data):
self.assertTrue('aetheredge_dongle_stats_imsi{name="ace-menlo-rasp-pi"}' in data)
- self.assertTrue('aetheredge_dongle_stats_cellglobalid{name="ace-menlo-rasp-pi",value="315010001F800"}' in data)
- self.assertTrue('aetheredge_dongle_stats_plmnstatus{name="ace-menlo-rasp-pi",value="Success"}' in data)
+ self.assertTrue('aetheredge_dongle_stats_cellglobalid{name="ace-menlo-rasp-pi"} 8.67518969411584e+014' in data)
+ self.assertTrue('aetheredge_dongle_stats_plmnstatus{name="ace-menlo-rasp-pi"} 3' in data)
+ self.assertTrue('aetheredge_dongle_stats_phycellid{name="ace-menlo-rasp-pi"} 101' in data)
+
def test_match_location(self):
event = MyEvent(location = "ace-menlo-rasp-pi-production")
@@ -769,8 +772,9 @@
data = response.get_data(as_text=True)
self.assertTrue('aetheredge_dongle_stats_imsi{name="ace-menlo-rasp-pi"} 0.0' in data)
- self.assertFalse('aetheredge_dongle_stats_cellglobalid{name="ace-menlo-rasp-pi",value=' in data)
- self.assertFalse('aetheredge_dongle_stats_plmnstatus{name="ace-menlo-rasp-pi",value=' in data)
+ self.assertFalse('aetheredge_dongle_stats_cellglobalid{name="ace-menlo-rasp-pi"}' in data)
+ self.assertFalse('aetheredge_dongle_stats_plmnstatus{name="ace-menlo-rasp-pi"}' in data)
+ self.assertFalse('aetheredge_dongle_stats_phycellid{name="ace-menlo-rasp-pi"}' in data)
response = self.app.delete('/testresults/ace-menlo-rasp-pi')
data = json.loads(response.get_data(as_text=True))