Add the ability to graph median latency of the entire network

This commit is contained in:
Robert Chacón 2022-11-07 16:12:27 -07:00 committed by GitHub
parent 96e1e1b3e5
commit 8fc2fdd01a
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -507,11 +507,19 @@ def refreshLatencyGraphs():
tcpLatency = float(parentNode['stats']['sinceLastQuery']['tcpLatency']) 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) p = Point('TCP Latency').tag("Device", parentNode['parentNodeName']).tag("ParentNode", parentNode['parentNodeName']).tag("Type", "Parent Node").field("TCP Latency", tcpLatency)
queriesToSend.append(p) queriesToSend.append(p)
write_api.write(bucket=influxDBBucket, record=queriesToSend) write_api.write(bucket=influxDBBucket, record=queriesToSend)
# print("Added " + str(len(queriesToSend)) + " points to InfluxDB.")
queriesToSendCount += len(queriesToSend) 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.") print("Added " + str(queriesToSendCount) + " points to InfluxDB.")
client.close() client.close()