From 8fc2fdd01ac9decdea9bcefe2e56f7feec095a1f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Robert=20Chac=C3=B3n?= Date: Mon, 7 Nov 2022 16:12:27 -0700 Subject: [PATCH] Add the ability to graph median latency of the entire network --- v1.3/graphInfluxDB.py | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/v1.3/graphInfluxDB.py b/v1.3/graphInfluxDB.py index 13591aca..9bcded9d 100644 --- a/v1.3/graphInfluxDB.py +++ b/v1.3/graphInfluxDB.py @@ -507,11 +507,19 @@ def refreshLatencyGraphs(): tcpLatency = float(parentNode['stats']['sinceLastQuery']['tcpLatency']) p = Point('TCP Latency').tag("Device", parentNode['parentNodeName']).tag("ParentNode", parentNode['parentNodeName']).tag("Type", "Parent Node").field("TCP Latency", tcpLatency) queriesToSend.append(p) - + write_api.write(bucket=influxDBBucket, record=queriesToSend) - # print("Added " + str(len(queriesToSend)) + " points to InfluxDB.") queriesToSendCount += len(queriesToSend) + listOfAllLatencies = [] + for circuit in subscriberCircuits: + if circuit['stats']['sinceLastQuery']['tcpLatency'] != None: + listOfAllLatencies.append(circuit['stats']['sinceLastQuery']['tcpLatency']) + currentNetworkLatency = statistics.median(listOfAllLatencies) + p = Point('TCP Latency').tag("Type", "Network").field("TCP Latency", currentNetworkLatency) + write_api.write(bucket=influxDBBucket, record=p) + queriesToSendCount += 1 + print("Added " + str(queriesToSendCount) + " points to InfluxDB.") client.close()