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: remove key prefix when copying log body fields (#9774)
Shaheer Kochaidba536578b56
diff --git a/frontend/src/container/LogDetailedView/BodyTitleRenderer.tsx b/frontend/src/container/LogDetailedView/BodyTitleRenderer.tsxindex 7b2ef943cb..86a7aac263 100644--- a/frontend/src/container/LogDetailedView/BodyTitleRenderer.tsx+++ b/frontend/src/container/LogDetailedView/BodyTitleRenderer.tsx@@ -92,14 +92,14 @@ function BodyTitleRenderer({if (isObject) {// For objects/arrays, stringify the entire structure- copyText = `"${cleanedKey}": ${JSON.stringify(value, null, 2)}`;+ copyText = JSON.stringify(value, null, 2);} else if (parentIsArray) {- // For array elements, copy just the value- copyText = `"${cleanedKey}": ${value}`;+ // array elements+ copyText = `${value}`;} else {- // For primitive values, format as JSON key-value pair- const valueStr = typeof value === 'string' ? `"${value}"` : String(value);- copyText = `"${cleanedKey}": ${valueStr}`;+ // primitive values+ const valueStr = typeof value === 'string' ? value : String(value);+ copyText = valueStr;}setCopy(copyText);diff --git a/frontend/src/container/LogDetailedView/__tests__/BodyTitleRenderer.test.tsx b/frontend/src/container/LogDetailedView/__tests__/BodyTitleRenderer.test.tsxindex 8cb50b87fa..bfb6243427 100644--- a/frontend/src/container/LogDetailedView/__tests__/BodyTitleRenderer.test.tsx+++ b/frontend/src/container/LogDetailedView/__tests__/BodyTitleRenderer.test.tsx@@ -51,7 +51,7 @@ describe('BodyTitleRenderer', () => {await user.click(screen.getByText('name'));await waitFor(() => {- expect(mockSetCopy).toHaveBeenCalledWith('"user.name": "John"');+ expect(mockSetCopy).toHaveBeenCalledWith('John');expect(mockNotification).toHaveBeenCalledWith(expect.objectContaining({message: expect.stringContaining('user.name'),@@ -75,7 +75,7 @@ describe('BodyTitleRenderer', () => {await user.click(screen.getByText('0'));await waitFor(() => {- expect(mockSetCopy).toHaveBeenCalledWith('"items[*].0": arrayElement');+ expect(mockSetCopy).toHaveBeenCalledWith('arrayElement');});});@@ -96,9 +96,8 @@ describe('BodyTitleRenderer', () => {await waitFor(() => {const callArg = mockSetCopy.mock.calls[0][0];- expect(callArg).toContain('"user.metadata":');- expect(callArg).toContain('"id": 123');- expect(callArg).toContain('"active": true');+ const expectedJson = JSON.stringify(testObject, null, 2);+ expect(callArg).toBe(expectedJson);expect(mockNotification).toHaveBeenCalledWith(expect.objectContaining({message: expect.stringContaining('object copied'),