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.
TypeScript apmapplication-monitoringdistributed-tracinggogood-first-issuejaegerloglogsmetricsmonitoringnextjsobservabilityopen-sourceopentelemetryprometheusreactreactjsself-hostedtracingtypescript
fix: redirect old logs routes to new routes (#4584)
Yunus Mf2d5d21581d6
diff --git a/frontend/src/AppRoutes/Private.tsx b/frontend/src/AppRoutes/Private.tsxindex f0bfa62d6e..669def6f44 100644--- a/frontend/src/AppRoutes/Private.tsx+++ b/frontend/src/AppRoutes/Private.tsx@@ -20,11 +20,16 @@ import { UPDATE_USER_IS_FETCH } from 'types/actions/app';import AppReducer from 'types/reducer/app';import { routePermission } from 'utils/permission';-import routes, { LIST_LICENSES } from './routes';+import routes, {+ LIST_LICENSES,+ oldNewRoutesMapping,+ oldRoutes,+} from './routes';import afterLogin from './utils';function PrivateRoute({ children }: PrivateRouteProps): JSX.Element {- const { pathname } = useLocation();+ const location = useLocation();+ const { pathname } = location;const mapRoutes = useMemo(() =>@@ -59,6 +64,8 @@ function PrivateRoute({ children }: PrivateRouteProps): JSX.Element {const currentRoute = mapRoutes.get('current');+ const isOldRoute = oldRoutes.indexOf(pathname) > -1;+const isLocalStorageLoggedIn =getLocalStorageApi(LOCALSTORAGE.IS_LOGGED_IN) === 'true';@@ -158,6 +165,16 @@ function PrivateRoute({ children }: PrivateRouteProps): JSX.Element {useEffect(() => {(async (): Promise<void> => {try {+ if (isOldRoute) {+ const redirectUrl = oldNewRoutesMapping[pathname];++ const newLocation = {+ ...location,+ pathname: redirectUrl,+ };+ history.replace(newLocation);+ }+if (currentRoute) {const { isPrivate, key } = currentRoute;diff --git a/frontend/src/AppRoutes/routes.ts b/frontend/src/AppRoutes/routes.tsindex a6543ad01d..9fb4fd9c70 100644--- a/frontend/src/AppRoutes/routes.ts+++ b/frontend/src/AppRoutes/routes.ts@@ -279,6 +279,13 @@ const routes: AppRoutes[] = [key: 'LIVE_LOGS',isPrivate: true,},+ {+ path: ROUTES.LOGS_PIPELINES,+ exact: true,+ component: PipelinePage,+ key: 'LOGS_PIPELINES',+ isPrivate: true,+ },{path: ROUTES.LOGIN,exact: true,@@ -307,13 +314,6 @@ const routes: AppRoutes[] = [key: 'SOMETHING_WENT_WRONG',isPrivate: false,},- {- path: ROUTES.LOGS_PIPELINES,- exact: true,- component: PipelinePage,- key: 'LOGS_PIPELINES',- isPrivate: true,- },{path: ROUTES.BILLING,exact: true,@@ -353,6 +353,20 @@ export const LIST_LICENSES: AppRoutes = {key: 'LIST_LICENSES',};+export const oldRoutes = [+ '/pipelines',+ '/logs/old-logs-explorer',+ '/logs-explorer',+ '/logs-explorer/live',+];++export const oldNewRoutesMapping: Record<string, string> = {+ '/pipelines': '/logs/pipelines',+ '/logs/old-logs-explorer': '/logs/old-logs-explorer',+ '/logs-explorer': '/logs/logs-explorer',+ '/logs-explorer/live': '/logs/logs-explorer/live',+};+export interface AppRoutes {component: RouteProps['component'];path: RouteProps['path'];