From 2756f3505f8d39a2c2513f1dc6dfc68242616457 Mon Sep 17 00:00:00 2001 From: TzeYiing Date: Mon, 29 May 2023 17:20:07 +0800 Subject: [PATCH 1/2] fix: prevent accidental filing of large timeseries datasets --- studio/components/interfaces/Settings/Logs/Logs.utils.ts | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/studio/components/interfaces/Settings/Logs/Logs.utils.ts b/studio/components/interfaces/Settings/Logs/Logs.utils.ts index d9ad8fdef3d..db2a0b48642 100644 --- a/studio/components/interfaces/Settings/Logs/Logs.utils.ts +++ b/studio/components/interfaces/Settings/Logs/Logs.utils.ts @@ -397,6 +397,11 @@ export const fillTimeseries = ( }) const diff = maxDate.diff(minDate, truncation as dayjs.UnitType) + if (diff > 10000) { + throw new Error( + 'Data error, filling timeseries dynamically with more than 10k data points degrades performance.' + ) + } for (let i = 0; i <= diff; i++) { const dateToMaybeAdd = minDate.add(i, truncation as dayjs.ManipulateType) From b4850b767d03b246f9c96ff7101324fcb7cc6aa7 Mon Sep 17 00:00:00 2001 From: Ziinc Date: Wed, 21 Jun 2023 02:06:35 +0800 Subject: [PATCH 2/2] Update studio/components/interfaces/Settings/Logs/Logs.utils.ts Co-authored-by: Joshen Lim --- studio/components/interfaces/Settings/Logs/Logs.utils.ts | 1 + 1 file changed, 1 insertion(+) diff --git a/studio/components/interfaces/Settings/Logs/Logs.utils.ts b/studio/components/interfaces/Settings/Logs/Logs.utils.ts index db2a0b48642..3a0b9b8e53b 100644 --- a/studio/components/interfaces/Settings/Logs/Logs.utils.ts +++ b/studio/components/interfaces/Settings/Logs/Logs.utils.ts @@ -397,6 +397,7 @@ export const fillTimeseries = ( }) const diff = maxDate.diff(minDate, truncation as dayjs.UnitType) + // Intentional throwing of error here to be caught by Sentry, as this would indicate a bug since charts shouldn't be rendering more than 10k data points if (diff > 10000) { throw new Error( 'Data error, filling timeseries dynamically with more than 10k data points degrades performance.'