diff --git a/locust/stats.py b/locust/stats.py index a18c06297f..45b06d0f76 100644 --- a/locust/stats.py +++ b/locust/stats.py @@ -679,7 +679,10 @@ def to_dict(self, escape_string_values=False): "max_response_time": proper_round(self.max_response_time), "current_rps": self.current_rps, "current_fail_per_sec": self.current_fail_per_sec, + "avg_response_time": self.avg_response_time, "median_response_time": self.median_response_time, + "total_rps": self.total_rps, + "total_fail_per_sec": self.total_fail_per_sec, **response_time_percentiles, "avg_content_length": self.avg_content_length, } diff --git a/locust/webui/src/components/StatsTable/StatsTable.tsx b/locust/webui/src/components/StatsTable/StatsTable.tsx index e6c1e04012..d542a1a213 100644 --- a/locust/webui/src/components/StatsTable/StatsTable.tsx +++ b/locust/webui/src/components/StatsTable/StatsTable.tsx @@ -5,6 +5,7 @@ import ViewColumnSelector from 'components/ViewColumnSelector/ViewColumnSelector import { swarmTemplateArgs } from 'constants/swarm'; import useSelectViewColumns from 'hooks/useSelectViewColumns'; import { IRootState } from 'redux/store'; +import { ITableStructure } from 'types/table.types'; import { ISwarmStat } from 'types/ui.types'; const percentilesToStatisticsRows = swarmTemplateArgs.percentilesToStatistics @@ -14,7 +15,7 @@ const percentilesToStatisticsRows = swarmTemplateArgs.percentilesToStatistics })) : []; -const tableStructure = [ +export const baseTableStructure = [ { key: 'method', title: 'Type' }, { key: 'name', title: 'Name' }, { key: 'numRequests', title: '# Requests' }, @@ -29,7 +30,12 @@ const tableStructure = [ { key: 'currentFailPerSec', title: 'Current Failures/s', round: 2 }, ]; -export function StatsTable({ stats }: { stats: ISwarmStat[] }) { +interface IStatsTable { + stats: ISwarmStat[]; + tableStructure?: ITableStructure[]; +} + +export function StatsTable({ stats, tableStructure = baseTableStructure }: IStatsTable) { const { selectedColumns, addColumn, removeColumn, filteredStructure } = useSelectViewColumns(tableStructure); diff --git a/locust/webui/src/pages/HtmlReport.tsx b/locust/webui/src/pages/HtmlReport.tsx index efca751d58..32394cf533 100644 --- a/locust/webui/src/pages/HtmlReport.tsx +++ b/locust/webui/src/pages/HtmlReport.tsx @@ -15,6 +15,19 @@ import { formatLocaleString } from 'utils/date'; const theme = createTheme(window.theme || INITIAL_THEME); +const statsReportTableStructure = [ + { key: 'method', title: 'Type' }, + { key: 'name', title: 'Name' }, + { key: 'numRequests', title: '# Requests' }, + { key: 'numFailures', title: '# Fails' }, + { key: 'avgResponseTime', title: 'Average (ms)', round: 2 }, + { key: 'minResponseTime', title: 'Min (ms)' }, + { key: 'maxResponseTime', title: 'Max (ms)' }, + { key: 'avgContentLength', title: 'Average size (bytes)', round: 2 }, + { key: 'totalRps', title: 'RPS', round: 2 }, + { key: 'totalFailPerSec', title: 'Failures/s', round: 2 }, +]; + export default function HtmlReport({ locustfile, showDownloadLink, @@ -72,7 +85,7 @@ export default function HtmlReport({ Request Statistics - + {!!responseTimeStatistics.length && (