From 5d382d3442b5383fbe1430c8fd20b8455796f745 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Gast=C3=B3n=20Fournier?= Date: Thu, 2 Feb 2023 18:34:36 +0100 Subject: [PATCH] fix: use utc to compare time (#3038) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit ## About the changes We've found that 60000 was just 1 minute and we wanted it to be 10 minutes so we were missing 1 zero and sometimes in 1 minute we didn't have data. This is still an assumption we'll verify in sandbox Co-authored-by: Nuno Góis --- .../admin/network/NetworkOverview/NetworkOverview.tsx | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/frontend/src/component/admin/network/NetworkOverview/NetworkOverview.tsx b/frontend/src/component/admin/network/NetworkOverview/NetworkOverview.tsx index df7f42b616..07253ba805 100644 --- a/frontend/src/component/admin/network/NetworkOverview/NetworkOverview.tsx +++ b/frontend/src/component/admin/network/NetworkOverview/NetworkOverview.tsx @@ -17,7 +17,7 @@ const StyledMermaid = styled(Mermaid)(({ theme }) => ({ })); const isRecent = (value: ResultValue) => { - const threshold = 60000; // ten minutes + const threshold = 600000; // ten minutes return value[0] * 1000 > new Date().getTime() - threshold; }; @@ -36,6 +36,7 @@ const toGraphData = (metrics?: RequestsPerSecondSchema) => { ?.map(result => { const values = (result.values || []) as ResultValue[]; const data = values.filter(value => isRecent(value)) || []; + console.log('data', data); let reqs = 0; if (data.length) { reqs = parseFloat(data[data.length - 1][1]);