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(infra-monitoring-details): remove process/containers tab on hosts & better color for http status on traces (#12019)
Vinicius Lourençof5a395f229e6
diff --git a/frontend/src/__tests__/query_range_v5.util.ts b/frontend/src/__tests__/query_range_v5.util.tsindex f5e6bd42a9..5051f4b195 100644--- a/frontend/src/__tests__/query_range_v5.util.ts+++ b/frontend/src/__tests__/query_range_v5.util.ts@@ -269,3 +269,170 @@ export function mockQueryRangeV5WithEventsResponse({),);}++export type MockTracesOptions = {+ offset?: number;+ pageSize?: number;+ hasMore?: boolean;+ delay?: number;+ customTraces?: Array<{+ serviceName?: string;+ name?: string;+ durationNano?: number;+ httpMethod?: string;+ responseStatusCode?: string;+ }>;+ onReceiveRequest?: (+ req: RestRequest,+ ) =>+ | undefined+ | void+ | Omit<MockTracesOptions, 'onReceiveRequest'>+ | Promise<Omit<MockTracesOptions, 'onReceiveRequest'>>+ | Promise<void>;+};++const createTracesResponse = ({+ offset = 0,+ pageSize = 10,+ hasMore = true,+ customTraces,+}: MockTracesOptions): MetricRangePayloadV5 => {+ const serviceNames = ['frontend', 'backend', 'database', 'api-gateway'];+ const spanNames = [+ 'GET /api/users',+ 'POST /api/orders',+ 'SELECT * FROM users',+ ];+ const httpMethods = ['GET', 'POST', 'PUT', 'DELETE'];+ const statusCodes = ['200', '201', '400', '404', '500'];++ const rows = customTraces+ ? customTraces.map((trace, index) => {+ const baseTimestamp = new Date('2026-04-21T17:54:33Z').getTime();+ const currentTimestamp = new Date(baseTimestamp - index * 60000);+ return {+ timestamp: currentTimestamp.toISOString(),+ data: {+ serviceName:+ trace.serviceName ?? serviceNames[index % serviceNames.length],+ name: trace.name ?? spanNames[index % spanNames.length],+ durationNano: trace.durationNano ?? 1000000 + index * 100000,+ httpMethod: trace.httpMethod ?? httpMethods[index % httpMethods.length],+ responseStatusCode:+ trace.responseStatusCode ?? statusCodes[index % statusCodes.length],+ traceID: `trace-id-${index}`,+ spanID: `span-id-${index}`,+ },+ };+ })+ : Array.from(+ { length: hasMore ? pageSize : Math.ceil(pageSize / 2) },+ (_, index) => {+ const cumulativeIndex = offset + index;+ const baseTimestamp = new Date('2026-04-21T17:54:33Z').getTime();+ const currentTimestamp = new Date(baseTimestamp - cumulativeIndex * 60000);+ return {+ timestamp: currentTimestamp.toISOString(),+ data: {+ serviceName: serviceNames[cumulativeIndex % serviceNames.length],+ name: spanNames[cumulativeIndex % spanNames.length],+ durationNano: 1000000 + cumulativeIndex * 100000,+ httpMethod: httpMethods[cumulativeIndex % httpMethods.length],+ responseStatusCode: statusCodes[cumulativeIndex % statusCodes.length],+ traceID: `trace-id-${cumulativeIndex}`,+ spanID: `span-id-${cumulativeIndex}`,+ },+ };+ },+ );++ return {+ data: {+ type: 'raw',+ data: {+ results: [+ {+ queryName: 'A',+ nextCursor: hasMore ? 'next-cursor-token' : '',+ rows,+ },+ ],+ },+ meta: {+ bytesScanned: 9682976,+ durationMs: 295,+ rowsScanned: 34198,+ stepIntervals: { A: 170 },+ },+ },+ };+};++export function mockQueryRangeV5WithTracesResponse({+ hasMore = true,+ offset = 0,+ pageSize = 10,+ delay = 0,+ customTraces,+ onReceiveRequest,+}: MockTracesOptions = {}): void {+ server.use(+ rest.post(QUERY_RANGE_URL, async (req, res, ctx) =>+ res(+ ...(delay ? [ctx.delay(delay)] : []),+ ctx.status(200),+ ctx.json(+ createTracesResponse(+ (await onReceiveRequest?.(req)) ?? {+ hasMore,+ pageSize,+ offset,+ customTraces,+ },+ ),+ ),+ ),+ ),+ );+}++export function mockQueryRangeV5WithEmptyTraces(): void {+ server.use(+ rest.post(QUERY_RANGE_URL, (_, res, ctx) =>+ res(+ ctx.status(200),+ ctx.json({+ data: {+ type: 'raw',+ data: {+ results: [{ queryName: 'A', nextCursor: '', rows: [] }],+ },+ meta: {+ bytesScanned: 0,+ durationMs: 10,+ rowsScanned: 0,+ stepIntervals: {},+ },+ },+ }),+ ),+ ),+ );+}++export function mockQueryRangeV5WithKeyNotFoundError(): void {+ server.use(+ rest.post(QUERY_RANGE_URL, (_, res, ctx) =>+ res(+ ctx.status(400),+ ctx.json({+ error: {+ code: 'invalid_input',+ errors: [{ message: 'key not found' }],+ },+ }),+ ),+ ),+ );+}diff --git a/frontend/src/components/HttpStatusBadge/HttpStatusBadge.tsx b/frontend/src/components/HttpStatusBadge/HttpStatusBadge.tsxindex 16462e9d71..9a06e5bb72 100644--- a/frontend/src/components/HttpStatusBadge/HttpStatusBadge.tsx+++ b/frontend/src/components/HttpStatusBadge/HttpStatusBadge.tsx@@ -12,6 +12,8 @@ type BadgeColor =interface HttpStatusBadgeProps {statusCode: string | number;+ testId?: string;+ className?: string;}function getStatusCodeColor(statusCode: number): BadgeColor {@@ -35,6 +37,8 @@ function getStatusCodeColor(statusCode: number): BadgeColor {function HttpStatusBadge({statusCode,+ testId,+ className,}: HttpStatusBadgeProps): JSX.Element | null {const numericStatusCode = Number(statusCode);@@ -45,7 +49,12 @@ function HttpStatusBadge({const color = getStatusCodeColor(numericStatusCode);return (- <Badge color={color} variant="outline">+ <Badge+ color={color}+ variant="outline"+ data-testid={testId}+ className={className}+ >{statusCode}</Badge>);diff --git a/frontend/src/container/InfraMonitoringHosts/Hosts.tsx b/frontend/src/container/InfraMonitoringHosts/Hosts.tsxindex b865cf0d32..80d38788b8 100644--- a/frontend/src/container/InfraMonitoringHosts/Hosts.tsx+++ b/frontend/src/container/InfraMonitoringHosts/Hosts.tsx@@ -216,8 +216,6 @@ function Hosts(): JSX.Element {queryKeyPrefix="hosts"tabsConfig={{showEvents: false,- showContainers: true,- showProcesses: true,}}/></>diff --git a/frontend/src/container/InfraMonitoringK8s/Base/K8sBaseDetails.tsx b/frontend/src/container/InfraMonitoringK8s/Base/K8sBaseDetails.tsxindex bc3b67f200..ef0c9f9ef6 100644--- a/frontend/src/container/InfraMonitoringK8s/Base/K8sBaseDetails.tsx+++ b/frontend/src/container/InfraMonitoringK8s/Base/K8sBaseDetails.tsx@@ -35,7 +35,6 @@ import {ChevronsLeftRight,Compass,DraftingCompass,- Package2,ScrollText,X,} from '@signozhq/icons';@@ -54,12 +53,10 @@ import { openInNewTab } from 'utils/navigation';import { v4 as uuidv4 } from 'uuid';import { InfraMonitoringEntity, VIEW_TYPES } from '../constants';-import EntityContainers from '../EntityDetailsUtils/EntityContainers';import EntityEvents from '../EntityDetailsUtils/EntityEvents';import EntityLogs from '../EntityDetailsUtils/EntityLogs';import { K8S_ENTITY_LOGS_EXPRESSION_KEY } from '../EntityDetailsUtils/EntityLogs/hooks';import EntityMetrics from '../EntityDetailsUtils/EntityMetrics';-import EntityProcesses from '../EntityDetailsUtils/EntityProcesses';import EntityTraces from '../EntityDetailsUtils/EntityTraces';import { K8S_ENTITY_TRACES_EXPRESSION_KEY } from '../EntityDetailsUtils/EntityTraces/hooks';import {@@ -120,8 +117,6 @@ export interface K8sBaseDetailsProps<T> {showLogs?: boolean;showTraces?: boolean;showEvents?: boolean;- showContainers?: boolean;- showProcesses?: boolean;};customTabs?: Array<{key: string;@@ -259,8 +254,6 @@ export default function K8sBaseDetails<T>({showLogs: true,showTraces: true,showEvents: true,- showContainers: false,- showProcesses: false,...tabsConfig,}),[tabsConfig],@@ -575,32 +568,6 @@ export default function K8sBaseDetails<T>({},]: []),- ...(tabVisibility.showContainers- ? [- {- value: VIEW_TYPES.CONTAINERS,- label: (- <div className="view-title">- <Package2 size={14} />- Containers- </div>- ),- },- ]- : []),- ...(tabVisibility.showProcesses- ? [- {- value: VIEW_TYPES.PROCESSES,- label: (- <div className="view-title">- <ChevronsLeftRight size={14} />- Processes- </div>- ),- },- ]- : []),...(customTabs?.map((tab) => ({value: tab.key,label: (@@ -680,11 +647,6 @@ export default function K8sBaseDetails<T>({initialExpression={eventsInitialExpression}/>)}- {effectiveView === VIEW_TYPES.CONTAINERS &&- tabVisibility.showContainers && <EntityContainers />}- {effectiveView === VIEW_TYPES.PROCESSES && tabVisibility.showProcesses && (- <EntityProcesses />- )}{customTabs?.map((tab) =>selectedView === tab.key ? (<React.Fragment key={tab.key}>diff --git a/frontend/src/container/InfraMonitoringK8s/EntityDetailsUtils/EntityContainers.tsx b/frontend/src/container/InfraMonitoringK8s/EntityDetailsUtils/EntityContainers.tsxdeleted file mode 100644index a10680e5be..0000000000--- a/frontend/src/container/InfraMonitoringK8s/EntityDetailsUtils/EntityContainers.tsx+++ /dev/null@@ -1,47 +0,0 @@-import { useTranslation } from 'react-i18next';-import { Space } from 'antd';-import { Typography } from '@signozhq/ui/typography';-import WaitlistFragment from 'components/HostMetricsDetail/WaitlistFragment/WaitlistFragment';--import broomUrl from '@/assets/Icons/broom.svg';-import infraContainersUrl from '@/assets/Icons/infraContainers.svg';--import 'components/HostMetricsDetail/Containers/Containers.styles.scss';--const { Text } = Typography;--function EntityContainers(): JSX.Element {- const { t } = useTranslation(['infraMonitoring']);-- return (- <Space direction="vertical" className="host-containers" size={24}>- <div className="infra-container-card-container">- <div className="dev-status-container">- <div className="infra-container-card">- <img- src={infraContainersUrl}- alt="infra-container"- width={32}- height={32}- />-- <Text className="infra-container-card-text">- {t('containers_visualization_message')}- </Text>- </div>-- <div className="infra-container-working-msg">- <Space>- <img src={broomUrl} alt="broom" width={24} height={24} />- <Text className="infra-container-card-text">{t('working_message')}</Text>- </Space>- </div>- </div>-- <WaitlistFragment entityType="containers" />- </div>- </Space>- );-}--export default EntityContainers;diff --git a/frontend/src/container/InfraMonitoringK8s/EntityDetailsUtils/EntityProcesses.tsx b/frontend/src/container/InfraMonitoringK8s/EntityDetailsUtils/EntityProcesses.tsxdeleted file mode 100644index ecbb0707c6..0000000000--- a/frontend/src/container/InfraMonitoringK8s/EntityDetailsUtils/EntityProcesses.tsx+++ /dev/null@@ -1,46 +0,0 @@-import { useTranslation } from 'react-i18next';-import { Space } from 'antd';-import { Typography } from '@signozhq/ui/typography';-import WaitlistFragment from 'components/HostMetricsDetail/WaitlistFragment/WaitlistFragment';--import broomUrl from '@/assets/Icons/broom.svg';-import infraContainersUrl from '@/assets/Icons/infraContainers.svg';--import 'components/HostMetricsDetail/Processes/Processes.styles.scss';--const { Text } = Typography;--function EntityProcesses(): JSX.Element {- const { t } = useTranslation(['infraMonitoring']);-- return (- <Space direction="vertical" className="host-processes" size={24}>- <div className="infra-container-card-container">- <div className="dev-status-container">- <div className="infra-container-card">- <img- src={infraContainersUrl}- alt="infra-container"- width={32}- height={32}- />- <Text className="infra-container-card-text">- {t('processes_visualization_message')}- </Text>- </div>-- <div className="infra-container-working-msg">- <Space>- <img src={broomUrl} alt="broom" width={24} height={24} />- <Text className="infra-container-card-text">{t('working_message')}</Text>- </Space>- </div>- </div>-- <WaitlistFragment entityType="processes" />- </div>- </Space>- );-}--export default EntityProcesses;diff --git a/frontend/src/container/InfraMonitoringK8s/EntityDetailsUtils/EntityTraces/__tests__/EntityTraces.default.test.tsx b/frontend/src/container/InfraMonitoringK8s/EntityDetailsUtils/EntityTraces/__tests__/EntityTraces.default.test.tsxnew file mode 100644index 0000000000..bddf114aa5--- /dev/null+++ b/frontend/src/container/InfraMonitoringK8s/EntityDetailsUtils/EntityTraces/__tests__/EntityTraces.default.test.tsx@@ -0,0 +1,98 @@+import { act, waitFor } from 'tests/test-utils';+import { QueryRangePayloadV5 } from 'types/api/v5/queryRange';++import { renderEntityTraces, verifyQueryPayload } from './testUtils';+import { mockQueryRangeV5WithTracesResponse } from '__tests__/query_range_v5.util';++describe('EntityTraces - Default Behavior', () => {+ let capturedPayloads: QueryRangePayloadV5[] = [];++ beforeEach(() => {+ capturedPayloads = [];+ mockQueryRangeV5WithTracesResponse({+ onReceiveRequest: async (req) => {+ const body = (await req.json()) as QueryRangePayloadV5;+ capturedPayloads.push(body);+ return {};+ },+ });+ });++ it('should fetch traces using V5 API on initial render', async () => {+ act(() => {+ renderEntityTraces();+ });++ await waitFor(() => {+ expect(capturedPayloads).toHaveLength(1);+ });++ verifyQueryPayload({+ payload: capturedPayloads[0],+ expectedOffset: 0,+ });+ });++ it('should pass time range to API (converted to milliseconds)', async () => {+ const timeRange = { startTime: 1000, endTime: 2000 };++ act(() => {+ renderEntityTraces({ timeRange });+ });++ await waitFor(() => {+ expect(capturedPayloads).toHaveLength(1);+ });++ verifyQueryPayload({+ payload: capturedPayloads[0],+ expectedTimeRange: {+ start: timeRange.startTime * 1000,+ end: timeRange.endTime * 1000,+ },+ });+ });++ it('should order results by timestamp desc', async () => {+ act(() => {+ renderEntityTraces();+ });++ await waitFor(() => {+ expect(capturedPayloads).toHaveLength(1);+ });++ const spec = capturedPayloads[0].compositeQuery.queries[0]?.spec as {+ order?: Array<{ key: { name: string }; direction: string }>;+ };+ const timestampOrder = spec.order?.find((o) => o.key.name === 'timestamp');++ expect(timestampOrder?.direction).toBe('desc');+ });++ it('should use TRACES signal type', async () => {+ act(() => {+ renderEntityTraces();+ });++ await waitFor(() => {+ expect(capturedPayloads).toHaveLength(1);+ });++ const query = capturedPayloads[0].compositeQuery.queries[0];+ const spec = query?.spec as { signal?: string };+ expect(spec?.signal).toBe('traces');+ });++ it('should use raw request type for traces list view', async () => {+ act(() => {+ renderEntityTraces();+ });++ await waitFor(() => {+ expect(capturedPayloads).toHaveLength(1);+ });++ expect(capturedPayloads[0].requestType).toBe('raw');+ });+});diff --git a/frontend/src/container/InfraMonitoringK8s/EntityDetailsUtils/EntityTraces/__tests__/EntityTraces.empty.test.tsx b/frontend/src/container/InfraMonitoringK8s/EntityDetailsUtils/EntityTraces/__tests__/EntityTraces.empty.test.tsxnew file mode 100644index 0000000000..0c5be7b070--- /dev/null+++ b/frontend/src/container/InfraMonitoringK8s/EntityDetailsUtils/EntityTraces/__tests__/EntityTraces.empty.test.tsx@@ -0,0 +1,38 @@+import { act, screen } from 'tests/test-utils';++import { renderEntityTraces } from './testUtils';+import { mockQueryRangeV5WithEmptyTraces } from '__tests__/query_range_v5.util';++describe('EntityTraces - Empty State', () => {+ it('should show empty state when no traces returned', async () => {+ mockQueryRangeV5WithEmptyTraces();++ act(() => {+ renderEntityTraces();+ });++ await expect(screen.findByText(/No data yet/i)).resolves.toBeInTheDocument();+ });++ it('should not show table when traces are empty', async () => {+ mockQueryRangeV5WithEmptyTraces();++ act(() => {+ renderEntityTraces();+ });++ await expect(screen.findByText(/No data yet/i)).resolves.toBeInTheDocument();+ expect(screen.queryByRole('table')).not.toBeInTheDocument();+ });++ it('should not show pagination controls when traces are empty', async () => {+ mockQueryRangeV5WithEmptyTraces();++ act(() => {+ renderEntityTraces();+ });++ await expect(screen.findByText(/No data yet/i)).resolves.toBeInTheDocument();+ expect(screen.queryByText(/1 - 10/)).not.toBeInTheDocument();+ });+});diff --git a/frontend/src/container/InfraMonitoringK8s/EntityDetailsUtils/EntityTraces/__tests__/EntityTraces.error.test.tsx b/frontend/src/container/InfraMonitoringK8s/EntityDetailsUtils/EntityTraces/__tests__/EntityTraces.error.test.tsxnew file mode 100644index 0000000000..4e1503cfe7--- /dev/null+++ b/frontend/src/container/InfraMonitoringK8s/EntityDetailsUtils/EntityTraces/__tests__/EntityTraces.error.test.tsx@@ -0,0 +1,44 @@+import { act, screen } from 'tests/test-utils';++import { renderEntityTraces } from './testUtils';+import {+ mockQueryRangeV5WithError,+ mockQueryRangeV5WithKeyNotFoundError,+} from '__tests__/query_range_v5.util';++describe('EntityTraces - Error State', () => {+ it('should show error state on API error', async () => {+ mockQueryRangeV5WithError('Internal server error', 500);++ act(() => {+ renderEntityTraces();+ });++ await expect(+ screen.findByText(/Something went wrong/i),+ ).resolves.toBeInTheDocument();+ });++ it('should show empty state for key not found error', async () => {+ mockQueryRangeV5WithKeyNotFoundError();++ act(() => {+ renderEntityTraces();+ });++ await expect(screen.findByText(/No data yet/i)).resolves.toBeInTheDocument();+ });++ it('should not show table on API error', async () => {+ mockQueryRangeV5WithError('Internal server error', 500);++ act(() => {+ renderEntityTraces();+ });++ await expect(+ screen.findByText(/Something went wrong/i),+ ).resolves.toBeInTheDocument();+ expect(screen.queryByRole('table')).not.toBeInTheDocument();+ });+});diff --git a/frontend/src/container/InfraMonitoringK8s/EntityDetailsUtils/EntityTraces/__tests__/EntityTraces.expression.test.tsx b/frontend/src/container/InfraMonitoringK8s/EntityDetailsUtils/EntityTraces/__tests__/EntityTraces.expression.test.tsxnew file mode 100644index 0000000000..9421ce2f78--- /dev/null+++ b/frontend/src/container/InfraMonitoringK8s/EntityDetailsUtils/EntityTraces/__tests__/EntityTraces.expression.test.tsx@@ -0,0 +1,55 @@+import { act, waitFor } from 'tests/test-utils';+import { QueryRangePayloadV5 } from 'types/api/v5/queryRange';++import { renderEntityTraces } from './testUtils';+import { mockQueryRangeV5WithTracesResponse } from '__tests__/query_range_v5.util';++describe('EntityTraces - Expression', () => {+ let capturedPayloads: QueryRangePayloadV5[] = [];++ beforeEach(() => {+ capturedPayloads = [];+ mockQueryRangeV5WithTracesResponse({+ onReceiveRequest: async (req) => {+ const body = (await req.json()) as QueryRangePayloadV5;+ capturedPayloads.push(body);+ return {};+ },+ });+ });++ it('should include expression in query filter', async () => {+ const expression = 'k8s.pod.name = "my-pod"';++ act(() => {+ renderEntityTraces({ expression });+ });++ await waitFor(() => {+ expect(capturedPayloads).toHaveLength(1);+ });++ const spec = capturedPayloads[0].compositeQuery.queries[0]?.spec as {+ filter?: { expression: string };+ };+ expect(spec.filter?.expression).toContain('k8s.pod.name');+ });++ it('should include complex expression with multiple conditions', async () => {+ const expression = 'k8s.pod.name = "my-pod" AND service.name = "api"';++ act(() => {+ renderEntityTraces({ expression });+ });++ await waitFor(() => {+ expect(capturedPayloads).toHaveLength(1);+ });++ const spec = capturedPayloads[0].compositeQuery.queries[0]?.spec as {+ filter?: { expression: string };+ };+ expect(spec.filter?.expression).toContain('k8s.pod.name');+ expect(spec.filter?.expression).toContain('service.name');+ });+});diff --git a/frontend/src/container/InfraMonitoringK8s/EntityDetailsUtils/EntityTraces/__tests__/EntityTraces.loading.test.tsx b/frontend/src/container/InfraMonitoringK8s/EntityDetailsUtils/EntityTraces/__tests__/EntityTraces.loading.test.tsxnew file mode 100644index 0000000000..aa344aaaec--- /dev/null+++ b/frontend/src/container/InfraMonitoringK8s/EntityDetailsUtils/EntityTraces/__tests__/EntityTraces.loading.test.tsx@@ -0,0 +1,39 @@+import { act, screen, waitFor } from 'tests/test-utils';++import { renderEntityTraces } from './testUtils';+import { mockQueryRangeV5WithTracesResponse } from '__tests__/query_range_v5.util';++describe('EntityTraces - Loading State', () => {+ it('should show loading state while fetching', async () => {+ mockQueryRangeV5WithTracesResponse({ delay: 1000 });++ act(() => {+ renderEntityTraces();+ });++ await expect(+ screen.findByText(/pending_data_placeholder/i),+ ).resolves.toBeInTheDocument();+ });++ it('should hide loading state after data loads', async () => {+ mockQueryRangeV5WithTracesResponse({ delay: 100 });++ act(() => {+ renderEntityTraces();+ });++ await expect(+ screen.findByText(/pending_data_placeholder/i),+ ).resolves.toBeInTheDocument();++ await waitFor(+ () => {+ expect(+ screen.queryByText(/pending_data_placeholder/i),+ ).not.toBeInTheDocument();+ },+ { timeout: 3000 },+ );+ });+});diff --git a/frontend/src/container/InfraMonitoringK8s/EntityDetailsUtils/EntityTraces/__tests__/EntityTraces.pagination.test.tsx b/frontend/src/container/InfraMonitoringK8s/EntityDetailsUtils/EntityTraces/__tests__/EntityTraces.pagination.test.tsxnew file mode 100644index 0000000000..93b70d6555--- /dev/null+++ b/frontend/src/container/InfraMonitoringK8s/EntityDetailsUtils/EntityTraces/__tests__/EntityTraces.pagination.test.tsx@@ -0,0 +1,96 @@+import { act, waitFor } from 'tests/test-utils';+import { QueryRangePayloadV5 } from 'types/api/v5/queryRange';++import { renderEntityTraces, verifyQueryPayload } from './testUtils';+import { mockQueryRangeV5WithTracesResponse } from '__tests__/query_range_v5.util';++describe('EntityTraces - Pagination', () => {+ let capturedPayloads: QueryRangePayloadV5[] = [];++ beforeEach(() => {+ capturedPayloads = [];+ mockQueryRangeV5WithTracesResponse({+ onReceiveRequest: async (req) => {+ const body = (await req.json()) as QueryRangePayloadV5;+ capturedPayloads.push(body);+ return {};+ },+ });+ });++ it('should use default limit when no pagination provided', async () => {+ act(() => {+ renderEntityTraces();+ });++ await waitFor(() => {+ expect(capturedPayloads).toHaveLength(1);+ });++ const spec = capturedPayloads[0].compositeQuery.queries[0]?.spec as {+ limit?: number;+ };+ expect(spec.limit).toBe(10);+ });++ it('should use custom offset from pagination param', async () => {+ act(() => {+ renderEntityTraces({ pagination: { offset: 20, limit: 10 } });+ });++ await waitFor(() => {+ expect(capturedPayloads).toHaveLength(1);+ });++ verifyQueryPayload({+ payload: capturedPayloads[0],+ expectedOffset: 20,+ });+ });++ it('should use custom limit from pagination param', async () => {+ act(() => {+ renderEntityTraces({ pagination: { offset: 0, limit: 50 } });+ });++ await waitFor(() => {+ expect(capturedPayloads).toHaveLength(1);+ });++ verifyQueryPayload({+ payload: capturedPayloads[0],+ expectedLimit: 50,+ });+ });++ it('should default offset to 0', async () => {+ act(() => {+ renderEntityTraces();+ });++ await waitFor(() => {+ expect(capturedPayloads).toHaveLength(1);+ });++ verifyQueryPayload({+ payload: capturedPayloads[0],+ expectedOffset: 0,+ });+ });++ it('should combine offset and limit correctly', async () => {+ act(() => {+ renderEntityTraces({ pagination: { offset: 30, limit: 20 } });+ });++ await waitFor(() => {+ expect(capturedPayloads).toHaveLength(1);+ });++ verifyQueryPayload({+ payload: capturedPayloads[0],+ expectedOffset: 30,+ expectedLimit: 20,+ });+ });+});diff --git a/frontend/src/container/InfraMonitoringK8s/EntityDetailsUtils/EntityTraces/__tests__/EntityTraces.table.test.tsx b/frontend/src/container/InfraMonitoringK8s/EntityDetailsUtils/EntityTraces/__tests__/EntityTraces.table.test.tsxnew file mode 100644index 0000000000..8c619bba7e--- /dev/null+++ b/frontend/src/container/InfraMonitoringK8s/EntityDetailsUtils/EntityTraces/__tests__/EntityTraces.table.test.tsx@@ -0,0 +1,185 @@+import { act, screen, within } from 'tests/test-utils';++import { renderEntityTraces } from './testUtils';+import { mockQueryRangeV5WithTracesResponse } from '__tests__/query_range_v5.util';++// Trace list columns are hidden below the antd `md` breakpoint. The global+// matchMedia mock reports `matches: false`, which drops every column, so make+// all breakpoints match for these rendering tests.+jest.spyOn(window, 'matchMedia').mockImplementation(+ (query: string) =>+ ({+ matches: true,+ media: query,+ onchange: null,+ addListener: jest.fn(),+ removeListener: jest.fn(),+ addEventListener: jest.fn(),+ removeEventListener: jest.fn(),+ dispatchEvent: jest.fn(),+ }) as unknown as MediaQueryList,+);++describe('EntityTraces - Table Rendering', () => {+ it('should render table with all column headers', async () => {+ mockQueryRangeV5WithTracesResponse({ pageSize: 3 });++ act(() => {+ renderEntityTraces();+ });++ await expect(screen.findByText('Service Name')).resolves.toBeInTheDocument();++ const headerTexts = within(screen.getByRole('table'))+ .getAllByRole('columnheader')+ .map((header) => header.textContent);++ expect(headerTexts).toStrictEqual(+ expect.arrayContaining([+ 'Timestamp',+ 'Service Name',+ 'Name',+ 'Duration',+ 'HTTP Method',+ 'Status Code',+ ]),+ );+ });++ it('should render trace values in table cells', async () => {+ mockQueryRangeV5WithTracesResponse({+ customTraces: [+ {+ serviceName: 'checkout-service',+ name: 'GET /api/checkout',+ durationNano: 5000000,+ httpMethod: 'GET',+ responseStatusCode: '200',+ },+ ],+ });++ act(() => {+ renderEntityTraces();+ });++ await expect(screen.findByTestId('serviceName')).resolves.toHaveTextContent(+ 'checkout-service',+ );+ expect(screen.getByTestId('name')).toHaveTextContent('GET /api/checkout');+ expect(screen.getByTestId('durationNano')).toHaveTextContent('5.00ms');+ expect(screen.getByTestId('httpMethod')).toHaveTextContent('GET');+ expect(screen.getByTestId('responseStatusCode')).toHaveTextContent('200');+ });++ it('should render http method as robin colored outline badge', async () => {+ mockQueryRangeV5WithTracesResponse({+ customTraces: [{ httpMethod: 'POST', responseStatusCode: '200' }],+ });++ act(() => {+ renderEntityTraces();+ });++ const badge = await screen.findByTestId('httpMethod');+ expect(badge).toHaveTextContent('POST');+ expect(badge).toHaveAttribute('data-color', 'robin');+ expect(badge).toHaveAttribute('data-variant', 'outline');+ });++ it('should render N/A when http method is empty', async () => {+ mockQueryRangeV5WithTracesResponse({+ customTraces: [{ httpMethod: '', responseStatusCode: '200' }],+ });++ act(() => {+ renderEntityTraces();+ });++ await expect(screen.findByText('N/A')).resolves.toBeInTheDocument();+ expect(screen.queryByTestId('httpMethod')).not.toBeInTheDocument();+ });++ it('should render status code badge color per status range', async () => {+ mockQueryRangeV5WithTracesResponse({+ customTraces: [+ { responseStatusCode: '200' },+ { responseStatusCode: '302' },+ { responseStatusCode: '404' },+ { responseStatusCode: '500' },+ { responseStatusCode: '100' },+ ],+ });++ act(() => {+ renderEntityTraces();+ });++ const badges = await screen.findAllByTestId('responseStatusCode');+ const badgeColors = badges.map((badge) => badge.getAttribute('data-color'));++ expect(badgeColors).toStrictEqual([+ 'forest', // 2xx -> success+ 'robin', // 3xx -> redirect+ 'amber', // 4xx -> client error+ 'cherry', // 5xx -> server error+ 'vanilla', // 1xx -> informational+ ]);+ });++ it('should render non-numeric status code as plain text without badge', async () => {+ mockQueryRangeV5WithTracesResponse({+ customTraces: [{ responseStatusCode: 'unknown' }],+ });++ act(() => {+ renderEntityTraces();+ });++ await expect(screen.findByText('unknown')).resolves.toBeInTheDocument();+ expect(screen.queryByTestId('responseStatusCode')).not.toBeInTheDocument();+ });++ it('should link cells to trace details page', async () => {+ mockQueryRangeV5WithTracesResponse({+ customTraces: [{ serviceName: 'frontend' }],+ });++ act(() => {+ renderEntityTraces();+ });++ await expect(screen.findByTestId('serviceName')).resolves.toBeInTheDocument();++ const links = within(screen.getByRole('table')).getAllByRole('link');++ expect(links.length).toBeGreaterThan(0);+ links.forEach((link) => {+ expect(link).toHaveAttribute(+ 'href',+ expect.stringContaining('/trace/trace-id-0'),+ );+ });+ });++ it('should render one row per trace', async () => {+ mockQueryRangeV5WithTracesResponse({+ customTraces: [+ { serviceName: 'frontend' },+ { serviceName: 'backend' },+ { serviceName: 'database' },+ ],+ });++ act(() => {+ renderEntityTraces();+ });++ const serviceCells = await screen.findAllByTestId('serviceName');+ expect(serviceCells.map((cell) => cell.textContent)).toStrictEqual([+ 'frontend',+ 'backend',+ 'database',+ ]);+ });+});diff --git a/frontend/src/container/InfraMonitoringK8s/EntityDetailsUtils/EntityTraces/__tests__/EntityTraces.test.tsx b/frontend/src/container/InfraMonitoringK8s/EntityDetailsUtils/EntityTraces/__tests__/EntityTraces.test.tsxdeleted file mode 100644index f37df22dfd..0000000000--- a/frontend/src/container/InfraMonitoringK8s/EntityDetailsUtils/EntityTraces/__tests__/EntityTraces.test.tsx+++ /dev/null@@ -1,100 +0,0 @@-import { mockQueryRangeV5WithLogsResponse } from '__tests__/query_range_v5.util';-import { InfraMonitoringEntity } from 'container/InfraMonitoringK8s/constants';-import { NuqsTestingAdapter } from 'nuqs/adapters/testing';-import { act, render, screen, waitFor } from 'tests/test-utils';-import { QueryRangePayloadV5 } from 'types/api/v5/queryRange';--import EntityTraces from '../EntityTraces';-import { K8S_ENTITY_TRACES_EXPRESSION_KEY } from '../hooks';--function verifyEntityTracesV5Request({- payload,- expectedOffset,- initialTimeRange,-}: {- payload: QueryRangePayloadV5;- expectedOffset: number;- initialTimeRange?: { start: number; end: number };-}): void {- const spec = payload.compositeQuery.queries[0]?.spec as {- offset?: number;- order?: Array<{ key: { name: string }; direction: string }>;- };- expect(spec.offset).toBe(expectedOffset);- if (initialTimeRange) {- expect(payload.start).toBe(initialTimeRange.start);- expect(payload.end).toBe(initialTimeRange.end);- }- const orderKeys = spec.order?.map((o) => o.key.name) ?? [];- expect(orderKeys).toContain('timestamp');-}--jest.mock('container/TopNav/DateTimeSelectionV2/index.tsx', () => ({- __esModule: true,- default: ({- onTimeChange,- }: {- onTimeChange?: (interval: string, dateTimeRange?: [number, number]) => void;- }): JSX.Element => (- <button- type="button"- data-testid="mock-datetime-selection"- onClick={(): void => {- onTimeChange?.('5m');- }}- >- Select Time- </button>- ),-}));--describe('EntityTraces', () => {- let capturedQueryRangePayloads: QueryRangePayloadV5[] = [];-- beforeEach(() => {- capturedQueryRangePayloads = [];- mockQueryRangeV5WithLogsResponse({- onReceiveRequest: async (req) => {- const body = (await req.json()) as QueryRangePayloadV5;- capturedQueryRangePayloads.push(body);- return {};- },- });- });-- it('should use V5 API for fetching traces', async () => {- act(() => {- render(- <NuqsTestingAdapter- searchParams={`${K8S_ENTITY_TRACES_EXPRESSION_KEY}=k8s.pod.name+%3D+%22x%22`}- >- <EntityTraces- timeRange={{ startTime: 1, endTime: 2 }}- isModalTimeSelection={false}- handleTimeChange={jest.fn()}- selectedInterval="5m"- queryKey="test"- category={InfraMonitoringEntity.PODS}- initialExpression='k8s.pod.name = "x"'- />- </NuqsTestingAdapter>,- );- });-- await waitFor(() => {- expect(- screen.queryByText('pending_data_placeholder'),- ).not.toBeInTheDocument();- });-- await waitFor(() => {- expect(capturedQueryRangePayloads).toHaveLength(1);- });-- const firstPayload = capturedQueryRangePayloads[0];- verifyEntityTracesV5Request({- payload: firstPayload,- expectedOffset: 0,- });- });-});diff --git a/frontend/src/container/InfraMonitoringK8s/EntityDetailsUtils/EntityTraces/__tests__/testUtils.tsx b/frontend/src/container/InfraMonitoringK8s/EntityDetailsUtils/EntityTraces/__tests__/testUtils.tsxnew file mode 100644index 0000000000..09414d6e03--- /dev/null+++ b/frontend/src/container/InfraMonitoringK8s/EntityDetailsUtils/EntityTraces/__tests__/testUtils.tsx@@ -0,0 +1,121 @@+import { ENVIRONMENT } from 'constants/env';+import { InfraMonitoringEntity } from 'container/InfraMonitoringK8s/constants';+import { server } from 'mocks-server/server';+import { rest } from 'msw';+import { NuqsTestingAdapter } from 'nuqs/adapters/testing';+import { render, RenderResult } from 'tests/test-utils';+import { QueryRangePayloadV5 } from 'types/api/v5/queryRange';++import EntityTraces from '../EntityTraces';+import { K8S_ENTITY_TRACES_EXPRESSION_KEY } from '../hooks';++// QuerySearch fires autocomplete requests on mount; without handlers MSW+// passes them through to the real network and the resulting AxiosError fails+// whichever test happens to be running.+beforeEach(() => {+ server.use(+ rest.get(`${ENVIRONMENT.baseURL}/api/v1/fields/keys`, (_, res, ctx) =>+ res(+ ctx.status(200),+ ctx.json({ status: 'success', data: { keys: {}, complete: true } }),+ ),+ ),+ rest.get(`${ENVIRONMENT.baseURL}/api/v1/fields/values`, (_, res, ctx) =>+ res(+ ctx.status(200),+ ctx.json({ status: 'success', data: { values: {}, complete: true } }),+ ),+ ),+ );+});++export interface RenderEntityTracesOptions {+ expression?: string;+ timeRange?: { startTime: number; endTime: number };+ category?: InfraMonitoringEntity;+ selectedInterval?: '5m' | '15m' | '30m' | '1h';+ pagination?: { offset: number; limit: number };+}++export function renderEntityTraces({+ expression = 'k8s.pod.name = "test-pod"',+ timeRange = { startTime: 1, endTime: 2 },+ category = InfraMonitoringEntity.PODS,+ selectedInterval = '5m',+ pagination,+}: RenderEntityTracesOptions = {}): RenderResult {+ const encodedExpression = encodeURIComponent(expression);+ let searchParams = `${K8S_ENTITY_TRACES_EXPRESSION_KEY}=${encodedExpression}`;++ if (pagination) {+ const paginationStr = encodeURIComponent(JSON.stringify(pagination));+ searchParams += `&pagination=${paginationStr}`;+ }++ return render(+ <NuqsTestingAdapter searchParams={searchParams}>+ <EntityTraces+ timeRange={timeRange}+ isModalTimeSelection={false}+ handleTimeChange={jest.fn()}+ selectedInterval={selectedInterval}+ queryKey="test"+ category={category}+ initialExpression={expression}+ />+ </NuqsTestingAdapter>,+ );+}++export function verifyQueryPayload({+ payload,+ expectedOffset,+ expectedLimit,+ expectedTimeRange,+}: {+ payload: QueryRangePayloadV5;+ expectedOffset?: number;+ expectedLimit?: number;+ expectedTimeRange?: { start: number; end: number };+}): void {+ const spec = payload.compositeQuery.queries[0]?.spec as {+ offset?: number;+ limit?: number;+ order?: Array<{ key: { name: string }; direction: string }>;+ };++ if (expectedOffset !== undefined) {+ expect(spec.offset).toBe(expectedOffset);+ }++ if (expectedLimit !== undefined) {+ expect(spec.limit).toBe(expectedLimit);+ }++ if (expectedTimeRange) {+ expect(payload.start).toBe(expectedTimeRange.start);+ expect(payload.end).toBe(expectedTimeRange.end);+ }++ const orderKeys = spec.order?.map((o) => o.key.name) ?? [];+ expect(orderKeys).toContain('timestamp');+}++jest.mock('container/TopNav/DateTimeSelectionV2/index.tsx', () => ({+ __esModule: true,+ default: ({+ onTimeChange,+ }: {+ onTimeChange?: (interval: string, dateTimeRange?: [number, number]) => void;+ }): JSX.Element => (+ <button+ type="button"+ data-testid="mock-datetime-selection"+ onClick={(): void => {+ onTimeChange?.('5m');+ }}+ >+ Select Time+ </button>+ ),+}));diff --git a/frontend/src/container/InfraMonitoringK8s/EntityDetailsUtils/EntityTraces/traceListColumns.module.scss b/frontend/src/container/InfraMonitoringK8s/EntityDetailsUtils/EntityTraces/traceListColumns.module.scssnew file mode 100644index 0000000000..d562010691--- /dev/null+++ b/frontend/src/container/InfraMonitoringK8s/EntityDetailsUtils/EntityTraces/traceListColumns.module.scss@@ -0,0 +1,7 @@+.pointer {+ cursor: pointer;+}++.cellText {+ color: var(--l2-foreground);+}diff --git a/frontend/src/container/InfraMonitoringK8s/EntityDetailsUtils/EntityTraces/traceListColumns.tsx b/frontend/src/container/InfraMonitoringK8s/EntityDetailsUtils/EntityTraces/traceListColumns.tsxindex 37465b9bef..fc8c3297ce 100644--- a/frontend/src/container/InfraMonitoringK8s/EntityDetailsUtils/EntityTraces/traceListColumns.tsx+++ b/frontend/src/container/InfraMonitoringK8s/EntityDetailsUtils/EntityTraces/traceListColumns.tsx@@ -1,6 +1,7 @@import { TableColumnsType as ColumnsType } from 'antd';import { Badge } from '@signozhq/ui/badge';import { Typography } from '@signozhq/ui/typography';+import HttpStatusBadge from 'components/HttpStatusBadge/HttpStatusBadge';import { getMs } from 'container/Trace/Filters/Panel/PanelBody/Duration/util';import {BlockLink,@@ -9,6 +10,7 @@ import {import { RowData } from 'lib/query/createTableColumnsFromQuery';import { BaseAutocompleteData } from 'types/api/queryBuilder/queryAutocompleteResponse';import { FormatTimezoneAdjustedTimestamp } from 'hooks/useTimezoneFormatter/useTimezoneFormatter';+import styles from './traceListColumns.module.scss';const keyToLabelMap: Record<string, string> = {timestamp: 'Timestamp',@@ -48,8 +50,9 @@ const getValueForKey = (data: Record<string, any>, key: string): any => {const aliases = keyAliases[primaryKey];if (aliases) {for (const alias of aliases) {- if (data[alias] !== undefined) {- return data[alias];+ const aliasedValue = data[alias] || data.resource?.[alias];+ if (aliasedValue !== undefined) {+ return aliasedValue;}}}@@ -78,7 +81,7 @@ export const getTraceListColumns = (return (<BlockLink to={getTraceLink(itemData)} openInNewTab>- <Typography.Text>{date}</Typography.Text>+ <Typography.Text className={styles.cellText}>{date}</Typography.Text></BlockLink>);}@@ -86,34 +89,81 @@ export const getTraceListColumns = (if (value === '') {return (<BlockLink to={getTraceLink(itemData)} openInNewTab>- <Typography data-testid={key}>N/A</Typography>+ <Typography data-testid={key} className={styles.cellText}>+ N/A+ </Typography></BlockLink>);}- if (primaryKey === 'httpMethod' || primaryKey === 'responseStatusCode') {+ if (primaryKey === 'httpMethod') {+ const httpMethod = getValueForKey(itemData, key);++ if (!httpMethod) {+ return (+ <BlockLink to={getTraceLink(itemData)} openInNewTab>+ <Typography className={styles.cellText}>N/A</Typography>+ </BlockLink>+ );+ }+return (<BlockLink to={getTraceLink(itemData)} openInNewTab>- <Badge data-testid={key} color="sakura">- {getValueForKey(itemData, key)}+ <Badge+ data-testid={key}+ color="robin"+ variant="outline"+ className={styles.pointer}+ >+ {httpMethod}</Badge></BlockLink>);}+ if (primaryKey === 'responseStatusCode') {+ const statusCode = getValueForKey(itemData, key);+ const numericCode = Number(statusCode);+ const isValidCode = !Number.isNaN(numericCode) && numericCode > 0;++ if (!isValidCode) {+ return (+ <BlockLink to={getTraceLink(itemData)} openInNewTab>+ <Typography className={styles.cellText}>+ {numericCode === 0 || !statusCode ? 'N/A' : statusCode}+ </Typography>+ </BlockLink>+ );+ }++ return (+ <BlockLink to={getTraceLink(itemData)} openInNewTab>+ <HttpStatusBadge+ statusCode={statusCode}+ testId={key}+ className={styles.pointer}+ />+ </BlockLink>+ );+ }+if (primaryKey === 'durationNano') {const durationNano = getValueForKey(itemData, key);return (<BlockLink to={getTraceLink(itemData)} openInNewTab>- <Typography data-testid={key}>{getMs(durationNano)}ms</Typography>+ <Typography data-testid={key} className={styles.cellText}>+ {getMs(durationNano)}ms+ </Typography></BlockLink>);}return (<BlockLink to={getTraceLink(itemData)} openInNewTab>- <Typography data-testid={key}>{getValueForKey(itemData, key)}</Typography>+ <Typography data-testid={key} className={styles.cellText}>+ {getValueForKey(itemData, key)}+ </Typography></BlockLink>);},diff --git a/frontend/src/container/InfraMonitoringK8s/constants.ts b/frontend/src/container/InfraMonitoringK8s/constants.tsindex 3a86dd35cd..b1f9b473a8 100644--- a/frontend/src/container/InfraMonitoringK8s/constants.ts+++ b/frontend/src/container/InfraMonitoringK8s/constants.ts@@ -34,8 +34,6 @@ export const VIEW_TYPES = {METRICS: VIEWS.METRICS,LOGS: VIEWS.LOGS,TRACES: VIEWS.TRACES,- CONTAINERS: VIEWS.CONTAINERS,- PROCESSES: VIEWS.PROCESSES,EVENTS: VIEWS.EVENTS,};@@ -394,41 +392,6 @@ export function GetClustersQuickFiltersConfig(];}-export function GetContainersQuickFiltersConfig(- dotMetricsEnabled: boolean,-): IQuickFiltersConfig[] {- const containerKey = dotMetricsEnabled- ? 'k8s.container.name'- : 'k8s_container_name';- const environmentKey = dotMetricsEnabled- ? 'deployment.environment'- : 'deployment_environment';-- return [- {- type: FiltersType.CHECKBOX,- title: 'Container',- attributeKey: {- key: containerKey,- dataType: DataTypes.String,- type: 'resource',- id: `${containerKey}--string--resource`,- },- defaultOpen: true,- },- {- type: FiltersType.CHECKBOX,- title: 'Environment',- attributeKey: {- key: environmentKey,- dataType: DataTypes.String,- type: 'resource',- },- defaultOpen: true,- },- ];-}-export function GetVolumesQuickFiltersConfig(dotMetricsEnabled: boolean,): IQuickFiltersConfig[] {