Skip to content

Commit

Permalink
Tiny renaming in script refactor
Browse files Browse the repository at this point in the history
  • Loading branch information
danielsanchezq committed Aug 3, 2020
1 parent fb06282 commit 7dfc150
Showing 1 changed file with 5 additions and 4 deletions.
9 changes: 5 additions & 4 deletions log-processing-scrips/average_request_response_time.py
Expand Up @@ -13,10 +13,11 @@ def get_data(line: str):

if __name__ == "__main__":
import sys

data_stream = iter(sys.stdin)
jsons = (x for x in map(get_data, data_stream) if x)
elapsed_time_logs = [x for x in jsons if x["id"] == ELAPSED_TIME_ID]
average_request_time = sum(
int(x["metadata"]["elapsed_nano_seconds"]) for x in elapsed_time_logs
)/len(elapsed_time_logs)
requests_elapsed_times = [
int(x["metadata"]["elapsed_nano_seconds"]) for x in jsons if x["id"] == ELAPSED_TIME_ID
]
average_request_time = sum(requests_elapsed_times) / len(requests_elapsed_times)
print(f"Average request time: {average_request_time}ns")

0 comments on commit 7dfc150

Please sign in to comment.