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.

feat(llm-attribute-mapping): foundation — route, permission, page shell [1/5] (#11778)

Gaurav Tewarib1dcbe87fe2f
diff --git a/frontend/src/AppRoutes/routes.ts b/frontend/src/AppRoutes/routes.ts
index 7ae954f452..09e87a894f 100644
--- a/frontend/src/AppRoutes/routes.ts
+++ b/frontend/src/AppRoutes/routes.ts
@@ -513,6 +513,13 @@ const routes: AppRoutes[] = [
key: 'AI_ASSISTANT',
isPrivate: true,
},
+ {
+ path: ROUTES.LLM_OBSERVABILITY_ATTRIBUTE_MAPPING,
+ exact: true,
+ component: LLMObservabilityPage,
+ key: 'LLM_OBSERVABILITY_ATTRIBUTE_MAPPING',
+ isPrivate: true,
+ },
{
path: ROUTES.LLM_OBSERVABILITY_OVERVIEW,
exact: true,
diff --git a/frontend/src/constants/routes.ts b/frontend/src/constants/routes.ts
index 110292cbf1..a792e0a9c3 100644
--- a/frontend/src/constants/routes.ts
+++ b/frontend/src/constants/routes.ts
@@ -89,6 +89,7 @@ const ROUTES = {
AI_ASSISTANT_BASE: '/ai-assistant',
AI_ASSISTANT_ICON_PREVIEW: '/ai-assistant-icon-preview',
MCP_SERVER: '/settings/mcp-server',
+ LLM_OBSERVABILITY_ATTRIBUTE_MAPPING: '/llm-observability/attribute-mapping',
LLM_OBSERVABILITY_BASE: '/llm-observability',
LLM_OBSERVABILITY_OVERVIEW: '/llm-observability/overview',
LLM_OBSERVABILITY_CONFIGURATION: '/llm-observability/configuration',
diff --git a/frontend/src/container/LLMObservability/AttributeMapping/LLMObservabilityAttributeMapping.module.scss b/frontend/src/container/LLMObservability/AttributeMapping/LLMObservabilityAttributeMapping.module.scss
new file mode 100644
index 0000000000..45e43aa851
--- /dev/null
+++ b/frontend/src/container/LLMObservability/AttributeMapping/LLMObservabilityAttributeMapping.module.scss
@@ -0,0 +1,13 @@
+.llmObservabilityAttributeMapping {
+ display: flex;
+ flex-direction: column;
+ gap: var(--spacing-8);
+ padding: var(--spacing-12);
+}
+
+.tableEmpty {
+ padding: var(--spacing-12) var(--spacing-6);
+ text-align: center;
+ color: var(--l3-foreground);
+ font-size: var(--periscope-font-size-base);
+}
diff --git a/frontend/src/container/LLMObservability/AttributeMapping/LLMObservabilityAttributeMapping.tsx b/frontend/src/container/LLMObservability/AttributeMapping/LLMObservabilityAttributeMapping.tsx
new file mode 100644
index 0000000000..d1dad3a1dc
--- /dev/null
+++ b/frontend/src/container/LLMObservability/AttributeMapping/LLMObservabilityAttributeMapping.tsx
@@ -0,0 +1,26 @@
+import AttributeMappingHeader from './components/AttributeMappingHeader';
+import styles from './LLMObservabilityAttributeMapping.module.scss';
+
+const noop = (): void => undefined;
+
+function LLMObservabilityAttributeMapping(): JSX.Element {
+ return (
+ <div
+ className={styles.llmObservabilityAttributeMapping}
+ data-testid="llm-observability-attribute-mapping-page"
+ >
+ <AttributeMappingHeader
+ isDirty={false}
+ isSaving={false}
+ onDiscard={noop}
+ onSave={noop}
+ />
+
+ <div className={styles.tableEmpty} data-testid="attribute-mapping-empty">
+ No mapping groups configured yet.
+ </div>
+ </div>
+ );
+}
+
+export default LLMObservabilityAttributeMapping;
diff --git a/frontend/src/container/LLMObservability/AttributeMapping/components/AttributeMappingHeader/AttributeMappingHeader.module.scss b/frontend/src/container/LLMObservability/AttributeMapping/components/AttributeMappingHeader/AttributeMappingHeader.module.scss
new file mode 100644
index 0000000000..98fc346d00
--- /dev/null
+++ b/frontend/src/container/LLMObservability/AttributeMapping/components/AttributeMappingHeader/AttributeMappingHeader.module.scss
@@ -0,0 +1,34 @@
+.pageHeader {
+ display: flex;
+ align-items: flex-start;
+ justify-content: space-between;
+ gap: var(--spacing-8);
+}
+
+.pageHeaderTitle {
+ display: flex;
+ flex-direction: column;
+}
+
+.title {
+ margin: 0;
+ font-size: var(--periscope-font-size-large);
+ font-weight: var(--font-weight-semibold);
+}
+
+.description {
+ margin: var(--spacing-2) 0 0;
+ font-size: var(--periscope-font-size-base);
+ color: var(--l3-foreground);
+}
+
+.pageHeaderActions {
+ display: flex;
+ align-items: center;
+ gap: var(--spacing-6);
+}
+
+.unsavedChanges {
+ font-size: var(--periscope-font-size-base);
+ color: var(--accent-amber);
+}
diff --git a/frontend/src/container/LLMObservability/AttributeMapping/components/AttributeMappingHeader/AttributeMappingHeader.tsx b/frontend/src/container/LLMObservability/AttributeMapping/components/AttributeMappingHeader/AttributeMappingHeader.tsx
new file mode 100644
index 0000000000..7b9cb70999
--- /dev/null
+++ b/frontend/src/container/LLMObservability/AttributeMapping/components/AttributeMappingHeader/AttributeMappingHeader.tsx
@@ -0,0 +1,56 @@
+import { Button } from '@signozhq/ui/button';
+
+import styles from './AttributeMappingHeader.module.scss';
+
+interface AttributeMappingHeaderProps {
+ isDirty: boolean;
+ isSaving: boolean;
+ onDiscard: () => void;
+ onSave: () => void;
+}
+
+function AttributeMappingHeader({
+ isDirty,
+ isSaving,
+ onDiscard,
+ onSave,
+}: AttributeMappingHeaderProps): JSX.Element {
+ return (
+ <header className={styles.pageHeader}>
+ <div className={styles.pageHeaderTitle}>
+ <h1 className={styles.title}>Attribute Mapping</h1>
+ <p className={styles.description}>
+ Configure source-to-target attribute remapping for LLM traces
+ </p>
+ </div>
+ <div className={styles.pageHeaderActions}>
+ {isDirty && (
+ <span className={styles.unsavedChanges} data-testid="unsaved-changes">
+ Unsaved changes
+ </span>
+ )}
+ <Button
+ variant="outlined"
+ color="secondary"
+ onClick={onDiscard}
+ disabled={!isDirty || isSaving}
+ testId="discard-changes-btn"
+ >
+ Discard
+ </Button>
+ <Button
+ variant="solid"
+ color="primary"
+ onClick={onSave}
+ loading={isSaving}
+ disabled={!isDirty || isSaving}
+ testId="save-changes-btn"
+ >
+ {isSaving ? 'Saving…' : 'Save changes'}
+ </Button>
+ </div>
+ </header>
+ );
+}
+
+export default AttributeMappingHeader;
diff --git a/frontend/src/container/LLMObservability/AttributeMapping/components/AttributeMappingHeader/index.ts b/frontend/src/container/LLMObservability/AttributeMapping/components/AttributeMappingHeader/index.ts
new file mode 100644
index 0000000000..bb6afb4d2d
--- /dev/null
+++ b/frontend/src/container/LLMObservability/AttributeMapping/components/AttributeMappingHeader/index.ts
@@ -0,0 +1 @@
+export { default } from './AttributeMappingHeader';
diff --git a/frontend/src/container/LLMObservability/__tests__/LLMObservability.test.tsx b/frontend/src/container/LLMObservability/__tests__/LLMObservability.test.tsx
index a1b0c98e38..65258839fa 100644
--- a/frontend/src/container/LLMObservability/__tests__/LLMObservability.test.tsx
+++ b/frontend/src/container/LLMObservability/__tests__/LLMObservability.test.tsx
@@ -39,6 +39,9 @@ describe('LLMObservability (integration)', () => {
expect(
screen.getByRole('tab', { name: 'Model pricing' }),
).toBeInTheDocument();
+ expect(
+ screen.getByRole('tab', { name: 'Attribute Mapping' }),
+ ).toBeInTheDocument();
});
it('navigates to the configuration route when the Model pricing tab is clicked', async () => {
@@ -54,6 +57,29 @@ describe('LLMObservability (integration)', () => {
);
});
+ it('navigates to the attribute mapping route when that tab is clicked', async () => {
+ const user = userEvent.setup({ pointerEventsCheck: 0 });
+ render(<LLMObservability />, undefined, {
+ initialRoute: ROUTES.LLM_OBSERVABILITY_OVERVIEW,
+ });
+
+ await user.click(screen.getByRole('tab', { name: 'Attribute Mapping' }));
+
+ expect(safeNavigateMock).toHaveBeenCalledWith(
+ ROUTES.LLM_OBSERVABILITY_ATTRIBUTE_MAPPING,
+ );
+ });
+
+ it('renders the attribute mapping page on the attribute mapping route', () => {
+ render(<LLMObservability />, undefined, {
+ initialRoute: ROUTES.LLM_OBSERVABILITY_ATTRIBUTE_MAPPING,
+ });
+
+ expect(
+ screen.getByTestId('llm-observability-attribute-mapping-page'),
+ ).toBeInTheDocument();
+ });
+
it('renders the model-pricing page on the configuration route', async () => {
setupList();
render(<LLMObservability />, undefined, {
diff --git a/frontend/src/container/LLMObservability/hooks/useLLMObservabilityTabs.tsx b/frontend/src/container/LLMObservability/hooks/useLLMObservabilityTabs.tsx
index 85f0bce638..1684cd91be 100644
--- a/frontend/src/container/LLMObservability/hooks/useLLMObservabilityTabs.tsx
+++ b/frontend/src/container/LLMObservability/hooks/useLLMObservabilityTabs.tsx
@@ -4,11 +4,13 @@ import { type TabItemProps } from '@signozhq/ui/tabs';
import ROUTES from 'constants/routes';
import { useSafeNavigate } from 'hooks/useSafeNavigate';
+import LLMObservabilityAttributeMapping from '../AttributeMapping/LLMObservabilityAttributeMapping';
import Overview from '../Overview/Overview';
import LLMObservabilityModelPricing from '../Settings/ModelPricing/LLMObservabilityModelPricing';
const OVERVIEW_KEY = ROUTES.LLM_OBSERVABILITY_OVERVIEW;
const CONFIGURATION_KEY = ROUTES.LLM_OBSERVABILITY_CONFIGURATION;
+const ATTRIBUTE_MAPPING_KEY = ROUTES.LLM_OBSERVABILITY_ATTRIBUTE_MAPPING;
interface UseLLMObservabilityTabsResult {
items: TabItemProps[];
@@ -24,9 +26,12 @@ export function useLLMObservabilityTabs(): UseLLMObservabilityTabsResult {
const { pathname } = useLocation();
const { safeNavigate } = useSafeNavigate();
- const activeTab = pathname.startsWith(CONFIGURATION_KEY)
- ? CONFIGURATION_KEY
- : OVERVIEW_KEY;
+ let activeTab: string = OVERVIEW_KEY;
+ if (pathname.startsWith(CONFIGURATION_KEY)) {
+ activeTab = CONFIGURATION_KEY;
+ } else if (pathname.startsWith(ATTRIBUTE_MAPPING_KEY)) {
+ activeTab = ATTRIBUTE_MAPPING_KEY;
+ }
const onTabChange = useCallback(
(key: string): void => {
@@ -46,6 +51,11 @@ export function useLLMObservabilityTabs(): UseLLMObservabilityTabsResult {
label: 'Model pricing',
children: <LLMObservabilityModelPricing />,
},
+ {
+ key: ATTRIBUTE_MAPPING_KEY,
+ label: 'Attribute Mapping',
+ children: <LLMObservabilityAttributeMapping />,
+ },
];
return { items, activeTab, onTabChange };
diff --git a/frontend/src/container/TopNav/DateTimeSelectionV2/constants.ts b/frontend/src/container/TopNav/DateTimeSelectionV2/constants.ts
index 683da78e59..238c53dedd 100644
--- a/frontend/src/container/TopNav/DateTimeSelectionV2/constants.ts
+++ b/frontend/src/container/TopNav/DateTimeSelectionV2/constants.ts
@@ -205,6 +205,7 @@ export const routesToSkip = [
ROUTES.SOMETHING_WENT_WRONG,
ROUTES.LLM_OBSERVABILITY_OVERVIEW,
ROUTES.LLM_OBSERVABILITY_CONFIGURATION,
+ ROUTES.LLM_OBSERVABILITY_ATTRIBUTE_MAPPING,
];
export const routesToDisable = [ROUTES.LOGS_EXPLORER, ROUTES.LIVE_LOGS];
diff --git a/frontend/src/utils/permission/index.ts b/frontend/src/utils/permission/index.ts
index 541ade6344..dc2e0d6c19 100644
--- a/frontend/src/utils/permission/index.ts
+++ b/frontend/src/utils/permission/index.ts
@@ -136,6 +136,7 @@ export const routePermission: Record<keyof typeof ROUTES, ROLES[]> = {
AI_ASSISTANT_ICON_PREVIEW: ['ADMIN', 'EDITOR', 'VIEWER'],
MCP_SERVER: ['ADMIN', 'EDITOR', 'VIEWER'],
AI_ASSISTANT_BASE: ['ADMIN', 'EDITOR', 'VIEWER'],
+ LLM_OBSERVABILITY_ATTRIBUTE_MAPPING: ['ADMIN', 'EDITOR', 'VIEWER'],
LLM_OBSERVABILITY_BASE: ['ADMIN', 'EDITOR', 'VIEWER'],
LLM_OBSERVABILITY_OVERVIEW: ['ADMIN', 'EDITOR', 'VIEWER'],
LLM_OBSERVABILITY_CONFIGURATION: ['ADMIN', 'EDITOR', 'VIEWER'],