Skip to content

Instantly share code, notes, and snippets.

@tracek
Created September 20, 2019 16:42
Show Gist options
  • Save tracek/e2dfd528cf872ba347a16a2efbb12bca to your computer and use it in GitHub Desktop.
Save tracek/e2dfd528cf872ba347a16a2efbb12bca to your computer and use it in GitHub Desktop.
import re
import numpy as np
with open('code-corp.log') as f:
log = f.readlines()
latency = []
timeout = []
for idx, line in enumerate(log):
match = re.search('time=(\d+\.\d+)', line)
if match:
latency.append(float(match.group(1)))
f = line.find('Request timeout')
if f !=-1:
timeout.append(idx)
latency = np.array(latency)
timeout_idx = np.array(timeout)
timeout_interval = timeout_idx[1:] - timeout_idx[:-1]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment