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.

chore: update sample json in test ai-o11y (#12741)

Gaurav Tewari23dd98bee7ea
diff --git a/frontend/src/container/LLMObservability/AttributeMapping/TestTab/__tests__/TestTab.test.tsx b/frontend/src/container/LLMObservability/AttributeMapping/TestTab/__tests__/TestTab.test.tsx
index 03c9e7c512..93cabb8f17 100644
--- a/frontend/src/container/LLMObservability/AttributeMapping/TestTab/__tests__/TestTab.test.tsx
+++ b/frontend/src/container/LLMObservability/AttributeMapping/TestTab/__tests__/TestTab.test.tsx
@@ -38,19 +38,20 @@ import {
TEST_ENDPOINT,
} from '../../__tests__/fixtures';
+const SAMPLE_SPAN = JSON.parse(SAMPLE_SPAN_JSON) as {
+ attributes: Record<string, unknown>;
+ resource: Record<string, unknown>;
+};
+
+const MAPPED_ATTRIBUTE_KEY = 'gen_ai.content.prompt';
+
+// Deriving from the sample keeps exactly one key added, so the single `populated` badge assertion below stays exact.
const RESULT_SPAN = {
attributes: {
- 'my_company.llm.input': 'What is quantum computing?',
- 'llm.input_messages': 'What is quantum computing?',
- 'gen_ai.request.model': 'gpt-4',
- 'gen_ai.usage.total_tokens': 1250,
- 'gen_ai.content.completion': 'Quantum computing leverages...',
- 'gen_ai.content.prompt': 'What is quantum computing?',
- },
- resource: {
- 'service.name': 'llm-gateway',
- 'deployment.environment': 'production',
+ ...SAMPLE_SPAN.attributes,
+ [MAPPED_ATTRIBUTE_KEY]: SAMPLE_SPAN.attributes['input.value'],
},
+ resource: SAMPLE_SPAN.resource,
};
const EDITED_SPAN_JSON = `{
@@ -97,7 +98,7 @@ describe('TestTab — sample-span flow', () => {
).resolves.toBeInTheDocument();
expect(screen.getByTestId('test-result-0')).toBeInTheDocument();
expect(screen.getByTestId('test-result-0-attributes')).toHaveTextContent(
- 'gen_ai.content.prompt',
+ MAPPED_ATTRIBUTE_KEY,
);
expect(screen.getByText('populated')).toBeInTheDocument();
expect(screen.queryByTestId('test-error')).not.toBeInTheDocument();
diff --git a/frontend/src/container/LLMObservability/AttributeMapping/TestTab/spanInputStorage.ts b/frontend/src/container/LLMObservability/AttributeMapping/TestTab/spanInputStorage.ts
index fc2440a19a..3fe7bb480e 100644
--- a/frontend/src/container/LLMObservability/AttributeMapping/TestTab/spanInputStorage.ts
+++ b/frontend/src/container/LLMObservability/AttributeMapping/TestTab/spanInputStorage.ts
@@ -7,11 +7,14 @@ import { parseSpanInput } from './testPayload';
export const SAMPLE_SPAN_JSON = `{
"attributes": {
- "my_company.llm.input": "What is quantum computing?",
- "llm.input_messages": "What is quantum computing?",
- "gen_ai.request.model": "gpt-4",
- "gen_ai.usage.total_tokens": 1250,
- "gen_ai.content.completion": "Quantum computing leverages..."
+ "llm.model_name": "gpt-4o",
+ "llm.provider": "openai",
+ "llm.token_count.prompt": 1024,
+ "llm.token_count.completion": 226,
+ "llm.token_count.prompt_details.cache_read": 512,
+ "input.value": "What is quantum computing?",
+ "output.value": "Quantum computing leverages superposition and entanglement...",
+ "session.id": "chat-8f2e41"
},
"resource": {
"service.name": "llm-gateway",