diff --git a/frontend/src/container/GridCardLayout/WidgetHeader/config.ts b/frontend/src/container/GridCardLayout/WidgetHeader/config.ts index 68e9dd5b6c..2a8f2d76ee 100644 --- a/frontend/src/container/GridCardLayout/WidgetHeader/config.ts +++ b/frontend/src/container/GridCardLayout/WidgetHeader/config.ts @@ -1,4 +1,5 @@ import { themeColors } from 'constants/theme'; +import { limit } from 'lib/getChartData'; import { CSSProperties } from 'react'; const positionCss: CSSProperties['position'] = 'absolute'; @@ -26,5 +27,4 @@ export const overlayStyles: CSSProperties = { position: 'absolute', }; -export const WARNING_MESSAGE = - 'Too many timeseries in the result. UI has restricted to showing the top 20. Please check the query if this is needed and contact support@signoz.io if you need to show >20 timeseries in the panel'; +export const WARNING_MESSAGE = `Too many timeseries in the result. UI has restricted to showing the top ${limit}. Please check the query if this is needed and contact support@signoz.io if you need to show >${limit} timeseries in the panel`; diff --git a/frontend/src/lib/getChartData.ts b/frontend/src/lib/getChartData.ts index 00fee49a26..494dd76583 100644 --- a/frontend/src/lib/getChartData.ts +++ b/frontend/src/lib/getChartData.ts @@ -5,6 +5,8 @@ import { QueryData } from 'types/api/widgets/getQuery'; import convertIntoEpoc from './covertIntoEpoc'; import { colors } from './getRandomColor'; +export const limit = 30; + const getChartData = ({ queryData, createDataset, @@ -14,10 +16,6 @@ const getChartData = ({ isWarning: boolean; // eslint-disable-next-line sonarjs/cognitive-complexity } => { - const limit = process.env.FRONTEND_CHART_LIMIT - ? +process.env.FRONTEND_CHART_LIMIT - : 20; - const uniqueTimeLabels = new Set(); queryData.forEach((data) => { data.queryData.forEach((query) => { @@ -118,7 +116,7 @@ const getChartData = ({ return { data: updatedData, - isWarning: isWarningLimit && (updatedDataSet?.length || 0) > limit, + isWarning: isWarningLimit && (allLabels?.length || 0) > limit, }; }; diff --git a/frontend/webpack.config.js b/frontend/webpack.config.js index fcba7fc011..a5862179a4 100644 --- a/frontend/webpack.config.js +++ b/frontend/webpack.config.js @@ -33,7 +33,6 @@ const plugins = [ INTERCOM_APP_ID: process.env.INTERCOM_APP_ID, SEGMENT_ID: process.env.SEGMENT_ID, CLARITY_PROJECT_ID: process.env.CLARITY_PROJECT_ID, - FRONTEND_CHART_LIMIT: process.env.FRONTEND_CHART_LIMIT, }), }), ]; diff --git a/frontend/webpack.config.prod.js b/frontend/webpack.config.prod.js index 956792b565..f026a83b0c 100644 --- a/frontend/webpack.config.prod.js +++ b/frontend/webpack.config.prod.js @@ -42,7 +42,6 @@ const plugins = [ INTERCOM_APP_ID: process.env.INTERCOM_APP_ID, SEGMENT_ID: process.env.SEGMENT_ID, CLARITY_PROJECT_ID: process.env.CLARITY_PROJECT_ID, - FRONTEND_CHART_LIMIT: process.env.FRONTEND_CHART_LIMIT, }), }), new MiniCssExtractPlugin(),