def compare_tests(args): labels, rps_data, errors_data, users_data, responses_data = get_tests_metadata(args['id[]']) return { "response": chart_data(labels, {"users": users_data}, {"pct95": responses_data}, "time"), "errors": chart_data(labels, {"users": users_data}, {"errors": errors_data}, "count"), "rps": chart_data(labels, {"users": users_data}, {"RPS": rps_data}, "count") }
def _query_only(args, query_func): start_time, end_time, aggregation = _timeframe(args) timeline, results, users = query_func(args['build_id'], args['test_name'], args['lg_type'], start_time, end_time, aggregation, args['sampler']) return chart_data(timeline, users, results)
def create_benchmark_dataset(args): build_ids = args['id[]'] req = args.get('request') calculation = args.get('calculation') aggregator = args.get('aggregator') if not aggregator or aggregator == 'auto': aggregator = '1s' tests_meta = APIReport.query.filter(APIReport.id.in_(build_ids)).order_by( APIReport.vusers.asc()).all() labels = set() data = {} y_axis = '' for _ in tests_meta: labels.add(_.vusers) if _.environment not in data: data[_.environment] = {} if calculation == 'throughput': y_axis = 'Requests per second' data[_.environment][str(_.vusers)] = get_throughput_per_test( _.build_id, _.name, _.lg_type, "", req, aggregator) elif calculation != ['throughput']: y_axis = 'Response time, ms' if calculation == 'errors': y_axis = 'Errors' data[_.environment][str(_.vusers)] = get_response_time_per_test( _.build_id, _.name, _.lg_type, "", req, calculation) else: data[_.environment][str(_.vusers)] = None labels = [""] + sorted(list(labels)) + [""] return {"data": chart_data(labels, [], data, "data"), "label": y_axis}