diff --git a/stress-test/test-result-combiner.py b/stress-test/test-result-combiner.py index 6f8e5ea..be78f27 100644 --- a/stress-test/test-result-combiner.py +++ b/stress-test/test-result-combiner.py @@ -24,12 +24,13 @@ def getNameWithoutIteration(fileName: str): def validateFileName(fileName: str): nameList = fileName.split('_') - if len(nameList) != 14: + if len(nameList) != 16: return False return True def makeResult(p: Path): durationDict = dict() + failCountDict = dict() countDict = dict() for x in p.iterdir(): @@ -46,6 +47,7 @@ def makeResult(p: Path): if fileName not in durationDict: durationDict[fileName] = 0 + failCountDict[fileName] = [0, 0] countDict[fileName] = 0 with x.open('r', newline='') as f: @@ -53,21 +55,25 @@ def makeResult(p: Path): # metric_name,timestamp,metric_value,check,error,error_code,group,method,name,proto,scenario,status,subproto,tls_version,url,extra_tags durationDict[fileName] += df['metrics']['http_req_duration']['values']['avg'] + failCountDict[fileName][0] += df['metrics']['http_req_failed']['values']['passes'] + failCountDict[fileName][1] += df['metrics']['http_req_failed']['values']['fails'] countDict[fileName] += 1 for key in durationDict: durationDict[key] = durationDict[key] / countDict[key] - return durationDict + failCountDict[fileName][0] = failCountDict[fileName][0] / countDict[key] + failCountDict[fileName][1] = failCountDict[fileName][1] / countDict[key] + return durationDict, failCountDict -def writeResultFile(p: Path, result: dict): +def writeResultFile(p: Path, durationResult: dict, failResult: dict): with p.open('w', newline='') as f: - columns = ['lock', 'vus', 'tickets', 'backoff', 'retry', 'waitTime', 'leaseTime', 'duration'] + columns = ['lock', 'vus', 'tickets', 'minBackoff', 'maxBackoff', 'retry', 'waitTime', 'leaseTime', 'duration', 'passes', 'fails'] df = pd.DataFrame(columns=columns) for i, key in enumerate(result): - lock, vus, vusValue, tickets, ticketsValue, backoff, backoffValue, retry, retryValue, waitTime, waitTimeValue, leaseTime, leaseTimeValue = key.split('_') + lock, vus, vusValue, tickets, ticketsValue, minBackoff, minBackoffValue, maxBackoff, maxBackoffValue, retry, retryValue, waitTime, waitTimeValue, leaseTime, leaseTimeValue = key.split('_') - se = pd.Series([lock, vusValue, ticketsValue, backoffValue, retryValue, waitTimeValue, leaseTimeValue, result[key]], index=df.columns) + se = pd.Series([lock, vusValue, ticketsValue, minBackoffValue, maxBackoffValue, retryValue, waitTimeValue, leaseTimeValue, durationResult[key], failResult[key][0], failResult[key][1]], index=df.columns) df = pd.concat([df, pd.DataFrame([se])], ignore_index=True) df.to_csv(f) @@ -82,8 +88,8 @@ def writeResultFile(p: Path, result: dict): validateDir(path) p = Path(path) - result = makeResult(p) + result, failResult = makeResult(p) path = '/'.join(['./result', 'result_' + sys.argv[1] + '.csv']) p = Path(path) - writeResultFile(p, result) + writeResultFile(p, result, failResult)