Skip to content

Commit

Permalink
feat: limit is updated (#3730)
Browse files Browse the repository at this point in the history
  • Loading branch information
palashgdev authored Oct 12, 2023
1 parent d5df9a1 commit 1588d3a
Show file tree
Hide file tree
Showing 4 changed files with 5 additions and 9 deletions.
4 changes: 2 additions & 2 deletions frontend/src/container/GridCardLayout/WidgetHeader/config.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import { themeColors } from 'constants/theme';
import { limit } from 'lib/getChartData';
import { CSSProperties } from 'react';

const positionCss: CSSProperties['position'] = 'absolute';
Expand Down Expand Up @@ -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`;
8 changes: 3 additions & 5 deletions frontend/src/lib/getChartData.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand All @@ -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<number>();
queryData.forEach((data) => {
data.queryData.forEach((query) => {
Expand Down Expand Up @@ -118,7 +116,7 @@ const getChartData = ({

return {
data: updatedData,
isWarning: isWarningLimit && (updatedDataSet?.length || 0) > limit,
isWarning: isWarningLimit && (allLabels?.length || 0) > limit,
};
};

Expand Down
1 change: 0 additions & 1 deletion frontend/webpack.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -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,
}),
}),
];
Expand Down
1 change: 0 additions & 1 deletion frontend/webpack.config.prod.js
Original file line number Diff line number Diff line change
Expand Up @@ -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(),
Expand Down

0 comments on commit 1588d3a

Please sign in to comment.