Skip to content

SigNoz is an open-source, OpenTelemetry-native observability platform for your team and their AI agents. Get logs, metrics, and traces in one tool with features like APM, distributed tracing, log management, infra monitoring, etc. Combined with SigNoz MCP and a native AI teammate (in SigNoz Cloud) it helps you build more resilient apps.

fix: code scanning issues is fixed (#3522)

Palash Gupta86c34bd87dfd
diff --git a/frontend/src/container/ErrorDetails/config.ts b/frontend/src/container/ErrorDetails/config.ts
new file mode 100644
index 0000000000..5ce48c48d7
--- /dev/null
+++ b/frontend/src/container/ErrorDetails/config.ts
@@ -0,0 +1,8 @@
+export const keyToExclude = [
+ 'exceptionStacktrace',
+ 'exceptionType',
+ 'errorId',
+ 'timestamp',
+ 'exceptionMessage',
+ 'exceptionEscaped',
+];
diff --git a/frontend/src/container/ErrorDetails/index.tsx b/frontend/src/container/ErrorDetails/index.tsx
index e5fd91b1cb..ff27641c64 100644
--- a/frontend/src/container/ErrorDetails/index.tsx
+++ b/frontend/src/container/ErrorDetails/index.tsx
@@ -14,12 +14,13 @@ import { useQuery } from 'react-query';
import { useLocation } from 'react-router-dom';
import { PayloadProps as GetByErrorTypeAndServicePayload } from 'types/api/errors/getByErrorTypeAndService';
+import { keyToExclude } from './config';
import { DashedContainer, EditorContainer, EventContainer } from './styles';
function ErrorDetails(props: ErrorDetailsProps): JSX.Element {
const { idPayload } = props;
const { t } = useTranslation(['errorDetails', 'common']);
- const { search } = useLocation();
+ const { search, pathname } = useLocation();
const params = useMemo(() => new URLSearchParams(search), [search]);
@@ -70,18 +71,6 @@ function ErrorDetails(props: ErrorDetailsProps): JSX.Element {
[],
);
- const keyToExclude = useMemo(
- () => [
- 'exceptionStacktrace',
- 'exceptionType',
- 'errorId',
- 'timestamp',
- 'exceptionMessage',
- 'exceptionEscaped',
- ],
- [],
- );
-
const { notifications } = useNotifications();
const onClickErrorIdHandler = async (
@@ -102,9 +91,7 @@ function ErrorDetails(props: ErrorDetailsProps): JSX.Element {
errorId: id,
};
- history.replace(
- `${history.location.pathname}?${createQueryParams(queryParams)}`,
- );
+ history.replace(`${pathname}?${createQueryParams(queryParams)}`);
} catch (error) {
notifications.error({
message: t('something_went_wrong'),
diff --git a/frontend/src/container/GridGraphLayout/Graph/WidgetGraphComponent.tsx b/frontend/src/container/GridGraphLayout/Graph/WidgetGraphComponent.tsx
index d0931fdac6..f40d1e4190 100644
--- a/frontend/src/container/GridGraphLayout/Graph/WidgetGraphComponent.tsx
+++ b/frontend/src/container/GridGraphLayout/Graph/WidgetGraphComponent.tsx
@@ -19,6 +19,7 @@ import {
} from 'react';
import { useTranslation } from 'react-i18next';
import { connect, useSelector } from 'react-redux';
+import { useLocation } from 'react-router-dom';
import { bindActionCreators } from 'redux';
import { ThunkDispatch } from 'redux-thunk';
import { DeleteWidget } from 'store/actions/dashboard/deleteWidget';
@@ -62,6 +63,7 @@ function WidgetGraphComponent({
const [hovered, setHovered] = useState(false);
const { notifications } = useNotifications();
const { t } = useTranslation(['common']);
+ const { pathname } = useLocation();
const { graphVisibilityStates: localstoredVisibilityStates } = useMemo(
() =>
@@ -195,11 +197,7 @@ function WidgetGraphComponent({
graphType: widget?.panelTypes,
widgetId: uuid,
};
- setTimeout(() => {
- history.push(
- `${history.location.pathname}/new?${createQueryParams(queryParams)}`,
- );
- }, 1500);
+ history.push(`${pathname}/new?${createQueryParams(queryParams)}`);
});
}
};
diff --git a/frontend/src/container/NewDashboard/ComponentsSlider/index.tsx b/frontend/src/container/NewDashboard/ComponentsSlider/index.tsx
index 11de0e071e..9e8526fe5b 100644
--- a/frontend/src/container/NewDashboard/ComponentsSlider/index.tsx
+++ b/frontend/src/container/NewDashboard/ComponentsSlider/index.tsx
@@ -6,6 +6,7 @@ import createQueryParams from 'lib/createQueryParams';
import history from 'lib/history';
import { CSSProperties, useCallback } from 'react';
import { connect, useSelector } from 'react-redux';
+import { useLocation } from 'react-router-dom';
import { bindActionCreators, Dispatch } from 'redux';
import { ThunkDispatch } from 'redux-thunk';
import {
@@ -24,6 +25,8 @@ function DashboardGraphSlider({ toggleAddWidget }: Props): JSX.Element {
(state) => state.dashboards,
);
+ const { pathname } = useLocation();
+
const { notifications } = useNotifications();
const [selectedDashboard] = dashboards;
@@ -51,16 +54,14 @@ function DashboardGraphSlider({ toggleAddWidget }: Props): JSX.Element {
),
};
- history.push(
- `${history.location.pathname}/new?${createQueryParams(queryParams)}`,
- );
+ history.push(`${pathname}/new?${createQueryParams(queryParams)}`);
} catch (error) {
notifications.error({
message: 'Something went wrong',
});
}
},
- [data, toggleAddWidget, notifications],
+ [data, toggleAddWidget, notifications, pathname],
);
const isDarkMode = useIsDarkMode();
const fillColor: CSSProperties['color'] = isDarkMode ? 'white' : 'black';
diff --git a/frontend/src/store/actions/trace/util.ts b/frontend/src/store/actions/trace/util.ts
index fab19acac3..3556636f15 100644
--- a/frontend/src/store/actions/trace/util.ts
+++ b/frontend/src/store/actions/trace/util.ts
@@ -70,7 +70,7 @@ export const updateURL = (
userSelectedFilter: JSON.stringify(Object.fromEntries(userSelectedFilter)),
};
history.replace(
- `${history.location.pathname}?${createQueryParams(queryParams)}`,
+ `${window.location.pathname}?${createQueryParams(queryParams)}`,
);
};