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: select column option in export button (#10709)
Tushar Vats73da474563f7
diff --git a/frontend/src/components/DownloadOptionsMenu/DownloadOptionsMenu.test.tsx b/frontend/src/components/DownloadOptionsMenu/DownloadOptionsMenu.test.tsxindex 6de2dfc1be..fa5b202362 100644--- a/frontend/src/components/DownloadOptionsMenu/DownloadOptionsMenu.test.tsx+++ b/frontend/src/components/DownloadOptionsMenu/DownloadOptionsMenu.test.tsx@@ -116,7 +116,12 @@ describe.each([expect(screen.getByRole('dialog')).toBeInTheDocument();expect(screen.getByText('FORMAT')).toBeInTheDocument();expect(screen.getByText('Number of Rows')).toBeInTheDocument();- expect(screen.getByText('Columns')).toBeInTheDocument();++ if (dataSource === DataSource.TRACES) {+ expect(screen.queryByText('Columns')).not.toBeInTheDocument();+ } else {+ expect(screen.getByText('Columns')).toBeInTheDocument();+ }});it('allows changing export format', () => {@@ -146,6 +151,17 @@ describe.each([});it('allows changing columns scope', () => {+ if (dataSource === DataSource.TRACES) {+ renderWithStore(dataSource);+ fireEvent.click(screen.getByTestId(testId));++ expect(screen.queryByRole('radio', { name: 'All' })).not.toBeInTheDocument();+ expect(+ screen.queryByRole('radio', { name: 'Selected' }),+ ).not.toBeInTheDocument();+ return;+ }+renderWithStore(dataSource);fireEvent.click(screen.getByTestId(testId));@@ -210,7 +226,12 @@ describe.each([mockUseQueryBuilder.mockReturnValue({ stagedQuery: mockQuery });renderWithStore(dataSource);fireEvent.click(screen.getByTestId(testId));- fireEvent.click(screen.getByRole('radio', { name: 'Selected' }));++ // For traces, column scope is always Selected and the radio is hidden+ if (dataSource !== DataSource.TRACES) {+ fireEvent.click(screen.getByRole('radio', { name: 'Selected' }));+ }+fireEvent.click(screen.getByText('Export'));await waitFor(() => {@@ -227,6 +248,11 @@ describe.each([});it('sends no selectFields when column scope is All', async () => {+ // For traces, column scope is always Selected — this test only applies to other sources+ if (dataSource === DataSource.TRACES) {+ return;+ }+renderWithStore(dataSource);fireEvent.click(screen.getByTestId(testId));fireEvent.click(screen.getByRole('radio', { name: 'All' }));diff --git a/frontend/src/components/DownloadOptionsMenu/DownloadOptionsMenu.tsx b/frontend/src/components/DownloadOptionsMenu/DownloadOptionsMenu.tsxindex 7b9d522719..04664b15f0 100644--- a/frontend/src/components/DownloadOptionsMenu/DownloadOptionsMenu.tsx+++ b/frontend/src/components/DownloadOptionsMenu/DownloadOptionsMenu.tsx@@ -1,5 +1,6 @@import { useCallback, useMemo, useState } from 'react';import { Button, Popover, Radio, Tooltip, Typography } from 'antd';+import { TelemetryFieldKey } from 'api/v5/v5';import { useExportRawData } from 'hooks/useDownloadOptionsMenu/useDownloadOptionsMenu';import { Download, DownloadIcon, Loader2 } from 'lucide-react';import { DataSource } from 'types/common/queryBuilder';@@ -14,10 +15,12 @@ import './DownloadOptionsMenu.styles.scss';interface DownloadOptionsMenuProps {dataSource: DataSource;+ selectedColumns?: TelemetryFieldKey[];}export default function DownloadOptionsMenu({dataSource,+ selectedColumns,}: DownloadOptionsMenuProps): JSX.Element {const [exportFormat, setExportFormat] = useState<string>(DownloadFormats.CSV);const [rowLimit, setRowLimit] = useState<number>(DownloadRowCounts.TEN_K);@@ -35,9 +38,19 @@ export default function DownloadOptionsMenu({await handleExportRawData({format: exportFormat,rowLimit,- clearSelectColumns: columnsScope === DownloadColumnsScopes.ALL,+ clearSelectColumns:+ dataSource !== DataSource.TRACES &&+ columnsScope === DownloadColumnsScopes.ALL,+ selectedColumns,});- }, [exportFormat, rowLimit, columnsScope, handleExportRawData]);+ }, [+ exportFormat,+ rowLimit,+ columnsScope,+ selectedColumns,+ handleExportRawData,+ dataSource,+ ]);const popoverContent = useMemo(() => (@@ -72,18 +85,22 @@ export default function DownloadOptionsMenu({</Radio.Group></div>- <div className="horizontal-line" />+ {dataSource !== DataSource.TRACES && (+ <>+ <div className="horizontal-line" />- <div className="columns-scope">- <Typography.Text className="title">Columns</Typography.Text>- <Radio.Group- value={columnsScope}- onChange={(e): void => setColumnsScope(e.target.value)}- >- <Radio value={DownloadColumnsScopes.ALL}>All</Radio>- <Radio value={DownloadColumnsScopes.SELECTED}>Selected</Radio>- </Radio.Group>- </div>+ <div className="columns-scope">+ <Typography.Text className="title">Columns</Typography.Text>+ <Radio.Group+ value={columnsScope}+ onChange={(e): void => setColumnsScope(e.target.value)}+ >+ <Radio value={DownloadColumnsScopes.ALL}>All</Radio>+ <Radio value={DownloadColumnsScopes.SELECTED}>Selected</Radio>+ </Radio.Group>+ </div>+ </>+ )}<Buttontype="primary"@@ -97,7 +114,14 @@ export default function DownloadOptionsMenu({</Button></div>),- [exportFormat, rowLimit, columnsScope, isDownloading, handleExport],+ [+ exportFormat,+ rowLimit,+ columnsScope,+ isDownloading,+ handleExport,+ dataSource,+ ],);return (diff --git a/frontend/src/container/LogsExplorerViews/LogsActionsContainer.tsx b/frontend/src/container/LogsExplorerViews/LogsActionsContainer.tsxindex 080f022260..7cb3ee1585 100644--- a/frontend/src/container/LogsExplorerViews/LogsActionsContainer.tsx+++ b/frontend/src/container/LogsExplorerViews/LogsActionsContainer.tsx@@ -92,7 +92,10 @@ function LogsActionsContainer({/></div><div className="download-options-container">- <DownloadOptionsMenu dataSource={DataSource.LOGS} />+ <DownloadOptionsMenu+ dataSource={DataSource.LOGS}+ selectedColumns={options?.selectColumns}+ /></div><div className="format-options-container"><LogsFormatOptionsMenudiff --git a/frontend/src/container/TracesExplorer/ListView/index.tsx b/frontend/src/container/TracesExplorer/ListView/index.tsxindex c472c202e2..93655f2ebf 100644--- a/frontend/src/container/TracesExplorer/ListView/index.tsx+++ b/frontend/src/container/TracesExplorer/ListView/index.tsx@@ -239,7 +239,10 @@ function ListView({/></div>- <DownloadOptionsMenu dataSource={DataSource.TRACES} />+ <DownloadOptionsMenu+ dataSource={DataSource.TRACES}+ selectedColumns={options?.selectColumns}+ /><TraceExplorerControlsisLoading={isFetching}diff --git a/frontend/src/hooks/useDownloadOptionsMenu/useDownloadOptionsMenu.ts b/frontend/src/hooks/useDownloadOptionsMenu/useDownloadOptionsMenu.tsindex 3aef11a2bf..6738269036 100644--- a/frontend/src/hooks/useDownloadOptionsMenu/useDownloadOptionsMenu.ts+++ b/frontend/src/hooks/useDownloadOptionsMenu/useDownloadOptionsMenu.ts@@ -3,7 +3,7 @@ import { useCallback, useState } from 'react';import { useSelector } from 'react-redux';import { message } from 'antd';import { downloadExportData } from 'api/v1/download/downloadExportData';-import { prepareQueryRangePayloadV5 } from 'api/v5/v5';+import { prepareQueryRangePayloadV5, TelemetryFieldKey } from 'api/v5/v5';import { PANEL_TYPES } from 'constants/queryBuilder';import { useQueryBuilder } from 'hooks/queryBuilder/useQueryBuilder';import { AppState } from 'store/reducers';@@ -14,6 +14,7 @@ interface ExportOptions {format: string;rowLimit: number;clearSelectColumns: boolean;+ selectedColumns?: TelemetryFieldKey[];}interface UseExportRawDataProps {@@ -42,6 +43,7 @@ export function useExportRawData({format,rowLimit,clearSelectColumns,+ selectedColumns,}: ExportOptions): Promise<void> => {if (!stagedQuery) {return;@@ -50,6 +52,12 @@ export function useExportRawData({try {setIsDownloading(true);+ const selectColumnsOverride = clearSelectColumns+ ? {}+ : selectedColumns?.length+ ? { selectColumns: selectedColumns }+ : {};+const exportQuery = {...stagedQuery,builder: {@@ -59,7 +67,7 @@ export function useExportRawData({groupBy: [],having: { expression: '' },limit: rowLimit,- ...(clearSelectColumns && { selectColumns: [] }),+ ...selectColumnsOverride,})),queryTraceOperator: (stagedQuery.builder.queryTraceOperator || []).map((traceOp) => ({@@ -67,7 +75,7 @@ export function useExportRawData({groupBy: [],having: { expression: '' },limit: rowLimit,- ...(clearSelectColumns && { selectColumns: [] }),+ ...selectColumnsOverride,}),),},