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
feat(llm-observability): move module tabs to RouteTab , add tab icons & other ui changes (#12762)
Gaurav Tewarid457ce61447c
diff --git a/frontend/public/locales/en-GB/titles.json b/frontend/public/locales/en-GB/titles.jsonindex dbc801ef98..2ee4bd053e 100644--- a/frontend/public/locales/en-GB/titles.json+++ b/frontend/public/locales/en-GB/titles.json@@ -61,6 +61,7 @@"INTEGRATIONS_DETAIL": "SigNoz | Integration","PUBLIC_DASHBOARD": "SigNoz | Dashboard","AI_OBSERVABILITY_OVERVIEW": "SigNoz | AI Observability Overview",+ "AI_OBSERVABILITY_EXPLORER": "SigNoz | AI Observability Explorer","AI_OBSERVABILITY_CONFIGURATION": "SigNoz | AI Observability Configuration","AI_OBSERVABILITY_ATTRIBUTE_MAPPING": "SigNoz | AI Observability Attribute Mapping"}\ No newline at end of filediff --git a/frontend/public/locales/en/titles.json b/frontend/public/locales/en/titles.jsonindex a701d67769..cacc16795c 100644--- a/frontend/public/locales/en/titles.json+++ b/frontend/public/locales/en/titles.json@@ -86,6 +86,7 @@"INTEGRATIONS_DETAIL": "SigNoz | Integration","PUBLIC_DASHBOARD": "SigNoz | Dashboard","AI_OBSERVABILITY_OVERVIEW": "SigNoz | AI Observability Overview",+ "AI_OBSERVABILITY_EXPLORER": "SigNoz | AI Observability Explorer","AI_OBSERVABILITY_CONFIGURATION": "SigNoz | AI Observability Configuration","AI_OBSERVABILITY_ATTRIBUTE_MAPPING": "SigNoz | AI Observability Attribute Mapping"}\ No newline at end of filediff --git a/frontend/src/container/LLMObservability/AttributeMapping/LLMObservabilityAttributeMapping.module.scss b/frontend/src/container/LLMObservability/AttributeMapping/LLMObservabilityAttributeMapping.module.scssindex 9bf0d82455..2b8c714aab 100644--- a/frontend/src/container/LLMObservability/AttributeMapping/LLMObservabilityAttributeMapping.module.scss+++ b/frontend/src/container/LLMObservability/AttributeMapping/LLMObservabilityAttributeMapping.module.scss@@ -2,7 +2,7 @@display: flex;flex-direction: column;gap: var(--spacing-4);- padding: var(--spacing-2) var(--spacing-2);+ padding: var(--spacing-2) var(--spacing-8);--tabs-content-padding: 0;--tabs-text-color: var(--l1-foreground);diff --git a/frontend/src/container/LLMObservability/LLMObservability.module.scss b/frontend/src/container/LLMObservability/LLMObservability.module.scssdeleted file mode 100644index 67e6e76811..0000000000--- a/frontend/src/container/LLMObservability/LLMObservability.module.scss+++ /dev/null@@ -1,13 +0,0 @@-.llmObservability {- display: flex;- flex-direction: column;- height: 100%;- margin-top: var(--spacing-2);- margin-left: var(--spacing-2);- --tabs-text-color: var(--l1-foreground);- --tabs-active-text-color: var(--l1-foreground);- [role='tabpanel'] {- margin: 0;- padding: var(--spacing-0) var(--spacing-4);- }-}diff --git a/frontend/src/container/LLMObservability/LLMObservability.tsx b/frontend/src/container/LLMObservability/LLMObservability.tsxdeleted file mode 100644index d34343228c..0000000000--- a/frontend/src/container/LLMObservability/LLMObservability.tsx+++ /dev/null@@ -1,24 +0,0 @@-import { Tabs } from '@signozhq/ui/tabs';--import { useLLMObservabilityTabs } from './hooks/useLLMObservabilityTabs';-import styles from './LLMObservability.module.scss';--// Shell for the LLM Observability page: renders the top-level tab bar-// (Overview / Configuration) using the SigNoz design-system Tabs, with-// route-driven active state from useLLMObservabilityTabs.-function LLMObservability(): JSX.Element {- const { items, activeTab, onTabChange } = useLLMObservabilityTabs();-- return (- <div className={styles.llmObservability} data-testid="llm-observability-page">- <Tabs- items={items}- value={activeTab}- onChange={onTabChange}- testId="llm-observability-tabs"- />- </div>- );-}--export default LLMObservability;diff --git a/frontend/src/container/LLMObservability/Overview/Overview.module.scss b/frontend/src/container/LLMObservability/Overview/Overview.module.scssindex b2b3f2c09e..18c13fb997 100644--- a/frontend/src/container/LLMObservability/Overview/Overview.module.scss+++ b/frontend/src/container/LLMObservability/Overview/Overview.module.scss@@ -6,7 +6,13 @@//TODO: remove this once we have a proper dashboard page.// The embedded V2 DashboardContainer renders its own page header (dashboard// title + share/feedback chrome) removed it for now- :global([class*='dashboardPageHeader']) {+ :global([class*='dashboardPageHeader']),+ :global([class*='dashboardInfoWithActions']) {+ display: none;+ }+ // Embedded read-only: the add-variable and panel-action triggers are dead here.+ :global([class*='addSlot']),+ :global([data-testid^='panel-actions-']) {display: none;}}diff --git a/frontend/src/container/LLMObservability/Settings/ModelPricing/LLMObservabilityModelPricing.module.scss b/frontend/src/container/LLMObservability/Settings/ModelPricing/LLMObservabilityModelPricing.module.scssindex a8d536cc6e..df757dd12b 100644--- a/frontend/src/container/LLMObservability/Settings/ModelPricing/LLMObservabilityModelPricing.module.scss+++ b/frontend/src/container/LLMObservability/Settings/ModelPricing/LLMObservabilityModelPricing.module.scss@@ -4,6 +4,7 @@gap: var(--spacing-8);--tabs-content-padding: 0;margin-top: var(--spacing-3);+ padding: var(--spacing-0) var(--spacing-8);--tabs-text-color: var(--l1-foreground);--tabs-active-text-color: var(--l1-foreground);}diff --git a/frontend/src/container/LLMObservability/Settings/ModelPricing/ModelCostTabPanel/ModelCostTabPanel.module.scss b/frontend/src/container/LLMObservability/Settings/ModelPricing/ModelCostTabPanel/ModelCostTabPanel.module.scssindex 14f4d6852d..0095a1061b 100644--- a/frontend/src/container/LLMObservability/Settings/ModelPricing/ModelCostTabPanel/ModelCostTabPanel.module.scss+++ b/frontend/src/container/LLMObservability/Settings/ModelPricing/ModelCostTabPanel/ModelCostTabPanel.module.scss@@ -18,6 +18,8 @@.filtersBarSource {width: 160px;+ /* Trigger defaults to 2.25rem; the search input and Add button are both 2rem. */+ --select-trigger-height: 32px;}.pageError {diff --git a/frontend/src/container/LLMObservability/hooks/useLLMObservabilityTabs.tsx b/frontend/src/container/LLMObservability/hooks/useLLMObservabilityTabs.tsxdeleted file mode 100644index 9e636b7ac8..0000000000--- a/frontend/src/container/LLMObservability/hooks/useLLMObservabilityTabs.tsx+++ /dev/null@@ -1,71 +0,0 @@-import { useCallback } from 'react';-import { useLocation } from 'react-router-dom';-import { type TabItemProps } from '@signozhq/ui/tabs';-import ROUTES from 'constants/routes';-import { useSafeNavigate } from 'hooks/useSafeNavigate';--import LLMObservabilityAttributeMapping from '../AttributeMapping/LLMObservabilityAttributeMapping';-import Explorer from '../Explorer/Explorer';-import Overview from '../Overview/Overview';-import LLMObservabilityModelPricing from '../Settings/ModelPricing/LLMObservabilityModelPricing';--const OVERVIEW_KEY = ROUTES.AI_OBSERVABILITY_OVERVIEW;-const EXPLORER_KEY = ROUTES.AI_OBSERVABILITY_EXPLORER;-const CONFIGURATION_KEY = ROUTES.AI_OBSERVABILITY_CONFIGURATION;-const ATTRIBUTE_MAPPING_KEY = ROUTES.AI_OBSERVABILITY_ATTRIBUTE_MAPPING;--interface UseLLMObservabilityTabsResult {- items: TabItemProps[];- activeTab: string;- onTabChange: (key: string) => void;-}--// Drives the top-level LLM Observability tabs. Route-driven: the active tab is-// derived from the pathname (each tab owns a URL) and changing tabs navigates,-// so tabs stay shareable/back-button friendly while rendering with the SigNoz-// design-system Tabs.-export function useLLMObservabilityTabs(): UseLLMObservabilityTabsResult {- const { pathname } = useLocation();- const { safeNavigate } = useSafeNavigate();-- let activeTab: string = OVERVIEW_KEY;- if (pathname.startsWith(CONFIGURATION_KEY)) {- activeTab = CONFIGURATION_KEY;- } else if (pathname.startsWith(ATTRIBUTE_MAPPING_KEY)) {- activeTab = ATTRIBUTE_MAPPING_KEY;- } else if (pathname.startsWith(EXPLORER_KEY)) {- activeTab = EXPLORER_KEY;- }-- const onTabChange = useCallback(- (key: string): void => {- safeNavigate(key);- },- [safeNavigate],- );-- const items: TabItemProps[] = [- {- key: OVERVIEW_KEY,- label: 'Overview',- children: <Overview />,- },- {- key: EXPLORER_KEY,- label: 'Explorer',- children: <Explorer />,- },- {- key: CONFIGURATION_KEY,- label: 'Model pricing',- children: <LLMObservabilityModelPricing />,- },- {- key: ATTRIBUTE_MAPPING_KEY,- label: 'Attribute Mapping',- children: <LLMObservabilityAttributeMapping />,- },- ];-- return { items, activeTab, onTabChange };-}diff --git a/frontend/src/container/SideNav/menuItems.tsx b/frontend/src/container/SideNav/menuItems.tsxindex 469a09c86d..f85ef7f700 100644--- a/frontend/src/container/SideNav/menuItems.tsx+++ b/frontend/src/container/SideNav/menuItems.tsx@@ -285,7 +285,6 @@ export const defaultMoreMenuItems: SidebarItem[] = [key: ROUTES.API_MONITORING,label: 'External APIs',icon: <Binoculars size={16} />,- isNew: true,isEnabled: true,itemKey: 'external-apis',},@@ -293,7 +292,7 @@ export const defaultMoreMenuItems: SidebarItem[] = [key: ROUTES.AI_OBSERVABILITY_OVERVIEW,label: 'AI Observability',icon: <Brain size={16} />,- isNew: true,+ isBeta: true,// Gated behind the `enable_ai_observability` feature flag in// SideNav's `computedSecondaryMenuItems`; disabled by default.isEnabled: false,diff --git a/frontend/src/pages/LLMObservability/LLMObservability.styles.scss b/frontend/src/pages/LLMObservability/LLMObservability.styles.scssnew file mode 100644index 0000000000..a49e2a1108--- /dev/null+++ b/frontend/src/pages/LLMObservability/LLMObservability.styles.scss@@ -0,0 +1,26 @@+.ai-observability-module-container {+ flex: 1;+ display: flex;+ flex-direction: column;+ height: 100%;++ .ant-tabs {+ height: 100%;+ }++ .ant-tabs-nav {+ padding: var(--spacing-0) var(--spacing-8);+ margin-bottom: var(--spacing-0);++ &::before {+ border-bottom: 1px solid var(--l1-border) !important;+ }+ }++ .tab-item {+ display: flex;+ justify-content: center;+ align-items: center;+ gap: var(--spacing-4);+ }+}diff --git a/frontend/src/container/LLMObservability/__tests__/LLMObservability.test.tsx b/frontend/src/pages/LLMObservability/__tests__/LLMObservability.test.tsxsimilarity index 76%rename from frontend/src/container/LLMObservability/__tests__/LLMObservability.test.tsxrename to frontend/src/pages/LLMObservability/__tests__/LLMObservability.test.tsxindex b8dbbb905e..e03074cce1 100644--- a/frontend/src/container/LLMObservability/__tests__/LLMObservability.test.tsx+++ b/frontend/src/pages/LLMObservability/__tests__/LLMObservability.test.tsx@@ -1,14 +1,14 @@-import { safeNavigateMock } from '__tests__/safeNavigateMock';import ROUTES from 'constants/routes';import {LLM_PRICING_ENDPOINT,makeListResponse,mockRules,} from 'container/LLMObservability/Settings/ModelPricing/__tests__/fixtures';+import history from 'lib/history';import { rest, server } from 'mocks-server/server';import { render, screen, userEvent, waitFor } from 'tests/test-utils';-import LLMObservability from '../LLMObservability';+import LLMObservabilityPage from '..';// The Overview tab renders the full V2 DashboardContainer (toolbar + date picker// call useNavigationType, which needs a data router this integration test doesn't@@ -24,6 +24,16 @@ jest.mock('container/LLMObservability/Explorer/Explorer', () => ({default: (): JSX.Element => <div data-testid="llm-observability-explorer" />,}));+jest.mock('lib/history', () => ({+ push: jest.fn(),+ listen: jest.fn(() => jest.fn()),+ location: { pathname: '/ai-observability/overview', search: '' },+}));++const mockHistoryPush = history.push as jest.MockedFunction<+ typeof history.push+>;+const SYSTEM_DASHBOARD_ENDPOINT = '*/api/v2/dashboards/system/ai-o11y-overview';function setupSystemDashboard(): void {@@ -64,6 +74,7 @@ function setupList(items = mockRules): void {describe('LLMObservability (integration)', () => {beforeEach(() => {window.history.pushState(null, '', '/');+ mockHistoryPush.mockClear();});afterEach(() => {@@ -72,11 +83,11 @@ describe('LLMObservability (integration)', () => {it('renders the overview panel and the tab bar on the overview route', async () => {setupSystemDashboard();- render(<LLMObservability />, undefined, {+ render(<LLMObservabilityPage />, undefined, {initialRoute: ROUTES.AI_OBSERVABILITY_OVERVIEW,});- expect(screen.getByTestId('llm-observability-tabs')).toBeInTheDocument();+ expect(screen.getByTestId('llm-observability-page')).toBeInTheDocument();expect(screen.getByTestId('llm-observability-overview')).toBeInTheDocument();await waitFor(() =>expect(screen.getByTestId('llm-overview-dashboard')).toBeInTheDocument(),@@ -84,54 +95,54 @@ describe('LLMObservability (integration)', () => {expect(screen.getByRole('tab', { name: 'Overview' })).toBeInTheDocument();expect(screen.getByRole('tab', { name: 'Explorer' })).toBeInTheDocument();expect(- screen.getByRole('tab', { name: 'Model pricing' }),+ screen.getByRole('tab', { name: /Model pricing/ }),).toBeInTheDocument();expect(- screen.getByRole('tab', { name: 'Attribute Mapping' }),+ screen.getByRole('tab', { name: /Attribute Mapping/ }),).toBeInTheDocument();});it('navigates to the configuration route when the Model pricing tab is clicked', async () => {const user = userEvent.setup({ pointerEventsCheck: 0 });- render(<LLMObservability />, undefined, {+ render(<LLMObservabilityPage />, undefined, {initialRoute: ROUTES.AI_OBSERVABILITY_OVERVIEW,});- await user.click(screen.getByRole('tab', { name: 'Model pricing' }));+ await user.click(screen.getByRole('tab', { name: /Model pricing/ }));- expect(safeNavigateMock).toHaveBeenCalledWith(+ expect(mockHistoryPush).toHaveBeenCalledWith(ROUTES.AI_OBSERVABILITY_CONFIGURATION,);});it('navigates to the attribute mapping route when that tab is clicked', async () => {const user = userEvent.setup({ pointerEventsCheck: 0 });- render(<LLMObservability />, undefined, {+ render(<LLMObservabilityPage />, undefined, {initialRoute: ROUTES.AI_OBSERVABILITY_OVERVIEW,});- await user.click(screen.getByRole('tab', { name: 'Attribute Mapping' }));+ await user.click(screen.getByRole('tab', { name: /Attribute Mapping/ }));- expect(safeNavigateMock).toHaveBeenCalledWith(+ expect(mockHistoryPush).toHaveBeenCalledWith(ROUTES.AI_OBSERVABILITY_ATTRIBUTE_MAPPING,);});it('navigates to the explorer route when the Explorer tab is clicked', async () => {const user = userEvent.setup({ pointerEventsCheck: 0 });- render(<LLMObservability />, undefined, {+ render(<LLMObservabilityPage />, undefined, {initialRoute: ROUTES.AI_OBSERVABILITY_OVERVIEW,});- await user.click(screen.getByRole('tab', { name: 'Explorer' }));+ await user.click(screen.getByRole('tab', { name: /Explorer/ }));- expect(safeNavigateMock).toHaveBeenCalledWith(+ expect(mockHistoryPush).toHaveBeenCalledWith(ROUTES.AI_OBSERVABILITY_EXPLORER,);});it('renders the explorer panel on the explorer route', () => {- render(<LLMObservability />, undefined, {+ render(<LLMObservabilityPage />, undefined, {initialRoute: ROUTES.AI_OBSERVABILITY_EXPLORER,});@@ -139,7 +150,7 @@ describe('LLMObservability (integration)', () => {});it('renders the attribute mapping page on the attribute mapping route', () => {- render(<LLMObservability />, undefined, {+ render(<LLMObservabilityPage />, undefined, {initialRoute: ROUTES.AI_OBSERVABILITY_ATTRIBUTE_MAPPING,});@@ -150,7 +161,7 @@ describe('LLMObservability (integration)', () => {it('renders the model-pricing page on the configuration route', async () => {setupList();- render(<LLMObservability />, undefined, {+ render(<LLMObservabilityPage />, undefined, {initialRoute: ROUTES.AI_OBSERVABILITY_CONFIGURATION,});diff --git a/frontend/src/pages/LLMObservability/constants.tsx b/frontend/src/pages/LLMObservability/constants.tsxnew file mode 100644index 0000000000..026d5b3236--- /dev/null+++ b/frontend/src/pages/LLMObservability/constants.tsx@@ -0,0 +1,56 @@+import { TabRoutes } from 'components/RouteTab/types';+import ROUTES from 'constants/routes';+import LLMObservabilityAttributeMapping from 'container/LLMObservability/AttributeMapping/LLMObservabilityAttributeMapping';+import ExplorerPage from 'container/LLMObservability/Explorer/Explorer';+import OverviewPage from 'container/LLMObservability/Overview/Overview';+import LLMObservabilityModelPricing from 'container/LLMObservability/Settings/ModelPricing/LLMObservabilityModelPricing';+import {+ ArrowRightLeft,+ BarChart,+ CircleDollarSign,+ Compass,+} from '@signozhq/icons';++export const Overview: TabRoutes = {+ Component: OverviewPage,+ name: (+ <div className="tab-item">+ <BarChart size={16} /> Overview+ </div>+ ),+ route: ROUTES.AI_OBSERVABILITY_OVERVIEW,+ key: ROUTES.AI_OBSERVABILITY_OVERVIEW,+};++export const Explorer: TabRoutes = {+ Component: ExplorerPage,+ name: (+ <div className="tab-item">+ <Compass size={16} /> Explorer+ </div>+ ),+ route: ROUTES.AI_OBSERVABILITY_EXPLORER,+ key: ROUTES.AI_OBSERVABILITY_EXPLORER,+};++export const ModelPricing: TabRoutes = {+ Component: LLMObservabilityModelPricing,+ name: (+ <div className="tab-item">+ <CircleDollarSign size={16} /> Model pricing+ </div>+ ),+ route: ROUTES.AI_OBSERVABILITY_CONFIGURATION,+ key: ROUTES.AI_OBSERVABILITY_CONFIGURATION,+};++export const AttributeMapping: TabRoutes = {+ Component: LLMObservabilityAttributeMapping,+ name: (+ <div className="tab-item">+ <ArrowRightLeft size={16} /> Attribute Mapping+ </div>+ ),+ route: ROUTES.AI_OBSERVABILITY_ATTRIBUTE_MAPPING,+ key: ROUTES.AI_OBSERVABILITY_ATTRIBUTE_MAPPING,+};diff --git a/frontend/src/pages/LLMObservability/index.tsx b/frontend/src/pages/LLMObservability/index.tsxindex b924cdb870..e928285686 100644--- a/frontend/src/pages/LLMObservability/index.tsx+++ b/frontend/src/pages/LLMObservability/index.tsx@@ -1,7 +1,35 @@-import LLMObservability from 'container/LLMObservability/LLMObservability';+import { useLocation } from 'react-router-dom';+import RouteTab from 'components/RouteTab';+import { TabRoutes } from 'components/RouteTab/types';+import history from 'lib/history';++import {+ AttributeMapping,+ Explorer,+ ModelPricing,+ Overview,+} from './constants';++import './LLMObservability.styles.scss';++const routes: TabRoutes[] = [+ Overview,+ Explorer,+ ModelPricing,+ AttributeMapping,+];function LLMObservabilityPage(): JSX.Element {- return <LLMObservability />;+ const { pathname } = useLocation();++ return (+ <div+ className="ai-observability-module-container"+ data-testid="llm-observability-page"+ >+ <RouteTab routes={routes} activeKey={pathname} history={history} />+ </div>+ );}export default LLMObservabilityPage;