# a cache-like dictionaries to store the last reported values, which can be used to fill in missing values
self.network_cache={}
self.service_cache={}
defrun(self):
"""
Performs the functionality of the aggregator - query data from both measurements merge that data and post it back in influx every 5 seconds.
...
...
@@ -82,7 +85,7 @@ class Aggregator(object):
whileTrue:
try:
result=self.db_client.query(
'SELECT mean(delay) as "net_delay" FROM "E2EMetrics"."autogen"."network_delays" WHERE time >= {0} and time < {1} GROUP BY path, source, target'.format(
'SELECT mean(latency) as "net_latency", mean(bandwidth) as "net_bandwidth" FROM "E2EMetrics"."autogen"."network_delays" WHERE time >= {0} and time < {1} GROUP BY path, source, target'.format(
# query the service delays and group them by endpoint, service function instance and sfr
service_delays={}
whileTrue:
try:
result=self.db_client.query('SELECT mean(response_time) as "response_time" FROM "E2EMetrics"."autogen"."service_delays" WHERE time >= {0} and time < {1} GROUP BY endpoint, sf_instance, sfr'.format(boundary_time_nano,current_time_nano))
result=self.db_client.query(
'SELECT mean(response_time) as "response_time", mean(request_size) as "request_size", mean(response_size) as "response_size" FROM "E2EMetrics"."autogen"."service_delays" WHERE time >= {0} and time < {1} GROUP BY endpoint, sf_instance, sfr'.format(
# reverse the path ID to get the network delay for the reversed path
reversed_path=(path_id,target,source)
assertreversed_pathinnetwork_delays# reversed path must always be reported with the forward one - if there is network path A-B, there is also network path B-A