diff --git a/locust/static/chart.js b/locust/static/chart.js index 03e9ed9d85..7389c06f61 100644 --- a/locust/static/chart.js +++ b/locust/static/chart.js @@ -3,10 +3,12 @@ /** * lines should be an array of line names */ - constructor(container, title, lines, unit) { + constructor(container, title, lines, unit, min, max) { this.container = $(container); this.title = title; this.lines = lines; + this.min = min || null; + this.max = max || null; this.element = $('
').css("width", "100%").appendTo(container); this.data = []; @@ -64,6 +66,8 @@ yAxis: { type: 'value', boundaryGap: [0, '100%'], + min: this.min, + max: this.max, splitLine: { show: false }, diff --git a/locust/static/locust.js b/locust/static/locust.js index 5a51f1f938..90d0937162 100644 --- a/locust/static/locust.js +++ b/locust/static/locust.js @@ -41,6 +41,7 @@ $("ul.tabs").tabs("div.panes > div").on("onClick", function(event) { // trigger resizing of charts rpsChart.resize(); responseTimeChart.resize(); + failuresChart.resize(); usersChart.resize(); } }); @@ -131,7 +132,8 @@ $(".stats_label").click(function(event) { // init charts var rpsChart = new LocustLineChart($(".charts-container"), "Total Requests per Second", ["RPS"], "reqs/s"); -var responseTimeChart = new LocustLineChart($(".charts-container"), "Response Times (ms)", ["Median Response Time", "95% percentile"], "ms"); +var responseTimeChart = new LocustLineChart($(".charts-container"), "Response Times (ms)", ["Median Response Time", "95th percentile"], "ms"); +var failuresChart = new LocustLineChart($(".charts-container"), "Failure rate", ["Failure Rate"], "%", 0, 100); var usersChart = new LocustLineChart($(".charts-container"), "Number of Users", ["Users"], "users"); function updateStats() { @@ -154,6 +156,7 @@ function updateStats() { // update charts rpsChart.addValue([total.current_rps]); responseTimeChart.addValue([report.current_response_time_percentile_50, report.current_response_time_percentile_95]); + failuresChart.addValue([report.fail_ratio*100]); usersChart.addValue([report.user_count]); }