diff --git a/web/frontend/src/components/Run/RunningStatus/MetricsHandler/MetricsHandler.js b/web/frontend/src/components/Run/RunningStatus/MetricsHandler/MetricsHandler.js index 767a8f65..86000a08 100644 --- a/web/frontend/src/components/Run/RunningStatus/MetricsHandler/MetricsHandler.js +++ b/web/frontend/src/components/Run/RunningStatus/MetricsHandler/MetricsHandler.js @@ -1,5 +1,4 @@ /* eslint-disable max-statements */ -// MetricManager.js import moment from "moment"; import { useEffect, useRef, useState } from "react"; @@ -9,6 +8,7 @@ import { calculateErrorRate } from "../../../../lib/utils"; const MetricsHandler = ({ run, children }) => { const [runMetrics, setMetrics] = useState([]); + const [errorCodes, setErrorCodes] = useState([]); const [isLoading, setIsLoading] = useState(false); const [totals, setTotals] = useState({ totalLatencyAvg: 0, @@ -72,7 +72,6 @@ const MetricsHandler = ({ run, children }) => { ); setMetrics(formattedUrlMetrics); - setIsLoading(false); }; @@ -129,6 +128,24 @@ const MetricsHandler = ({ run, children }) => { }); }; + const groupByErrorCode = () => { + const responseCodeGroups = {}; + + runMetrics.forEach((metric) => { + metric.responses.forEach((response) => { + const { responseCode } = response; + + if (!responseCodeGroups[responseCode]) { + responseCodeGroups[responseCode] = []; + } + + responseCodeGroups[responseCode].push(metric); + }); + }); + + setErrorCodes(responseCodeGroups); + }; + const startMetricsRefreshTimer = () => { if (run.runStatus === runStatusModel.RUNNING) { timerRef.current = setInterval(() => { @@ -148,6 +165,7 @@ const MetricsHandler = ({ run, children }) => { useEffect(() => { calculateTotals(); + groupByErrorCode(); startMetricsRefreshTimer(); return () => { stopMetricsRefreshTimer(); @@ -155,7 +173,7 @@ const MetricsHandler = ({ run, children }) => { // eslint-disable-next-line react-hooks/exhaustive-deps }, [runMetrics, run.runStatus]); - return children(runMetrics, isLoading, totals); + return children(runMetrics, isLoading, totals, errorCodes); }; export default MetricsHandler; diff --git a/web/frontend/src/components/Run/RunningStatus/MetricsHandler/index.js b/web/frontend/src/components/Run/RunningStatus/MetricsHandler/index.js index f373a249..24de5392 100644 --- a/web/frontend/src/components/Run/RunningStatus/MetricsHandler/index.js +++ b/web/frontend/src/components/Run/RunningStatus/MetricsHandler/index.js @@ -1,3 +1,3 @@ import MetricsHandler from "./MetricsHandler"; -export default MetricsHandler; \ No newline at end of file +export default MetricsHandler; diff --git a/web/frontend/src/components/Run/RunningStatus/RunRunningStatus.js b/web/frontend/src/components/Run/RunningStatus/RunRunningStatus.js index 2b71ae33..b3662857 100644 --- a/web/frontend/src/components/Run/RunningStatus/RunRunningStatus.js +++ b/web/frontend/src/components/Run/RunningStatus/RunRunningStatus.js @@ -22,6 +22,7 @@ import RunEditableLabelsGroup from "./EditableLabelsGroup"; import EditableTitle from "./EditableTitle"; import RunEndpointCharts from "./EndpointCharts"; import InitialConfiguration from "./InitialConfiguration"; +import MetricsHandler from "./MetricsHandler"; import MoreButtonsMenu from "./MoreButtonsMenu"; import RunNotesInput from "./NotesInput"; import OverviewMetrics from "./OverviewMetrics"; @@ -98,122 +99,144 @@ const RunRunningStatus = ({ run }) => { }; return ( - navigate(-1)} - title={} - subTitle={ - - } - extra={getButtonsByStatus(run.runStatus)} - breadcrumb={{ - routes, - itemRender: (route, params, routesToRender) => ( - - ) - }} - tags={} - > - - - - + {(metrics, isLoading, totals, errorCodes) => ( + navigate(-1)} + title={} + subTitle={ + + } + extra={getButtonsByStatus(run.runStatus)} + breadcrumb={{ + routes, + itemRender: (route, params, routesToRender) => ( + + ) + }} + tags={ + + } + > + + + + - -
- Started at: - {run.startedAt ? run.startedAt.format("L HH:mm:ss") : null} -
-
- Agents: - {run.agentIds.length} -
-
-
- - - {isTimerAvailable ? ( - <> - +
+ + Started at:{" "} + + {run.startedAt ? run.startedAt.format("L HH:mm:ss") : null} +
+
+ Agents: + {run.agentIds.length} +
+
+ + + + {isTimerAvailable ? ( + <> + + + ) : null} + + + - - ) : null} - - - - - - - - - - - - - - - - {renderLabel ? ( - - - - ) : ( - + + - - - )} - - - - - -
-
+ + + + + + + + + + {renderLabel ? ( + + + + ) : ( + + + + )} + + + + + + + + )} + ); }; export default RunRunningStatus;