Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Modern UI: Wrong chart's legend for Response Times #2464

Merged
merged 2 commits into from
Nov 14, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion locust/webui/dist/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
<meta name="theme-color" content="#000000" />

<title>Locust</title>
<script type="module" crossorigin src="/assets/index-ca104681.js"></script>
<script type="module" crossorigin src="/assets/index-9996beb6.js"></script>
</head>
<body>
<div id="root"></div>
Expand Down
12 changes: 9 additions & 3 deletions locust/webui/src/components/SwarmCharts/SwarmCharts.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -15,13 +15,19 @@ const availableSwarmCharts: ILineChartProps[] = [
{
title: 'Response Times (ms)',
lines: [
{ name: 'Median Response Time', key: 'responseTimePercentile1' },
{ name: '95% percentile', key: 'responseTimePercentile2' },
{
name: `${window.templateArgs.percentile1 * 100}th percentile`,
key: 'responseTimePercentile1',
},
{
name: `${window.templateArgs.percentile2 * 100}th percentile`,
key: 'responseTimePercentile2',
},
],
},
{
title: 'Number of Users',
lines: [{ name: '"Number of Users"', key: 'userCount' }],
lines: [{ name: 'Number of Users', key: 'userCount' }],
},
];

Expand Down
14 changes: 9 additions & 5 deletions locust/webui/src/hooks/useSwarmUi.ts
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,15 @@ export default function useSwarmUi() {
const shouldRunRefetchInterval =
swarm.state === SWARM_STATE.SPAWNING || swarm.state == SWARM_STATE.RUNNING;

useEffect(() => {
if (
statsData &&
(statsData.state === SWARM_STATE.STOPPED || statsData.state === SWARM_STATE.SPAWNING)
) {
setSwarm({ state: statsData.state });
}
}, [statsData && statsData.state]);

useInterval(
() => {
if (!statsData) {
Expand All @@ -34,7 +43,6 @@ export default function useSwarmUi() {

const {
extendedStats,
state,
stats,
errors,
totalRps,
Expand All @@ -45,10 +53,6 @@ export default function useSwarmUi() {
userCount,
} = statsData;

if (state === SWARM_STATE.STOPPED || state === SWARM_STATE.SPAWNING) {
setSwarm({ state });
}

const time = new Date().toLocaleTimeString();

if (shouldAddMarker) {
Expand Down
2 changes: 2 additions & 0 deletions locust/webui/src/redux/slice/swarm.slice.ts
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,8 @@ export interface ISwarmState {
locustfile: string;
numUsers: number | null;
overrideHostWarning: boolean;
percentile1: number;
percentile2: number;
runTime: number;
showUserclassPicker: boolean;
spawnRate: number | null;
Expand Down
2 changes: 2 additions & 0 deletions locust/webui/src/types/swarm.types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -37,4 +37,6 @@ export interface IReport {
export interface IReportTemplateArgs extends IReport {
history: ICharts[];
is_report?: boolean;
percentile1: number;
percentile2: number;
}