From 3ba198923e370c7671939e23bdc640b57b5405ae Mon Sep 17 00:00:00 2001 From: Tom Alexander Date: Thu, 1 Oct 2026 10:52:22 -0400 Subject: [PATCH 1/2] fix(app): use plural source kind labels and OTel spelling The source form's data type options and the sources list now share one label map: Logs, Traces, OTel Metrics, Sessions, PromQL. --- .changeset/plural-source-kind-labels.md | 7 +++++ .../SourceForm/MetricTableModelForm.tsx | 4 +-- .../Sources/SourceForm/SourceForm.tsx | 31 +++++++++++++++---- .../Sources/SourceForm/constants.ts | 11 ++++++- .../src/components/Sources/SourcesList.tsx | 4 +-- .../components/__tests__/SourcesList.test.tsx | 22 ++++++++++--- packages/app/src/utils.ts | 4 --- .../features/metric-table-autofill.spec.ts | 4 +-- .../app/tests/e2e/features/sources.spec.ts | 10 +++--- 9 files changed, 70 insertions(+), 27 deletions(-) create mode 100644 .changeset/plural-source-kind-labels.md diff --git a/.changeset/plural-source-kind-labels.md b/.changeset/plural-source-kind-labels.md new file mode 100644 index 0000000000..41c10a62c5 --- /dev/null +++ b/.changeset/plural-source-kind-labels.md @@ -0,0 +1,7 @@ +--- +'@hyperdx/app': patch +--- + +fix: use plural source kind labels and "OTel" spelling on the Sources page + +The source form's data type options and the sources list now read Logs, Traces, OTel Metrics, Sessions, and PromQL. diff --git a/packages/app/src/components/Sources/SourceForm/MetricTableModelForm.tsx b/packages/app/src/components/Sources/SourceForm/MetricTableModelForm.tsx index b7a3cbe86a..3950106646 100644 --- a/packages/app/src/components/Sources/SourceForm/MetricTableModelForm.tsx +++ b/packages/app/src/components/Sources/SourceForm/MetricTableModelForm.tsx @@ -86,7 +86,7 @@ export function MetricTableModelForm({ if (!isValid) { notifications.show({ color: 'red', - message: `${newValue} is not a valid OTEL ${metricType} schema.`, + message: `${newValue} is not a valid OTel ${metricType} schema.`, }); } } @@ -121,7 +121,7 @@ export function MetricTableModelForm({ if (!isValid) { notifications.show({ color: 'red', - message: `${seriesTable} is not a valid OTEL series schema.`, + message: `${seriesTable} is not a valid OTel series schema.`, }); } } diff --git a/packages/app/src/components/Sources/SourceForm/SourceForm.tsx b/packages/app/src/components/Sources/SourceForm/SourceForm.tsx index 4cb391eb76..f3d9f5e792 100644 --- a/packages/app/src/components/Sources/SourceForm/SourceForm.tsx +++ b/packages/app/src/components/Sources/SourceForm/SourceForm.tsx @@ -60,7 +60,11 @@ import { PairingWarning, } from '@/utils/sourceFieldSuggestions'; -import { DEFAULT_DATABASE, PROMETHEUS_PLACEHOLDER } from './constants'; +import { + DEFAULT_DATABASE, + PROMETHEUS_PLACEHOLDER, + SOURCE_KIND_LABELS, +} from './constants'; import { CORRELATION_FIELD_MAP, CorrelationField, @@ -626,16 +630,31 @@ export function TableSourceForm({ withAsterisk > - - + + {IS_METRICS_ENABLED && ( - + )} {IS_SESSIONS_ENABLED && ( - + )} {IS_PROMQL_ENABLED && ( - + )} diff --git a/packages/app/src/components/Sources/SourceForm/constants.ts b/packages/app/src/components/Sources/SourceForm/constants.ts index 99fa056c39..42f932a968 100644 --- a/packages/app/src/components/Sources/SourceForm/constants.ts +++ b/packages/app/src/components/Sources/SourceForm/constants.ts @@ -1,4 +1,4 @@ -import { UseTextIndex } from '@hyperdx/common-utils/dist/types'; +import { SourceKind, UseTextIndex } from '@hyperdx/common-utils/dist/types'; import { MV_AGGREGATE_FUNCTIONS, @@ -6,6 +6,15 @@ import { } from '@/utils/materializedViews'; export const DEFAULT_DATABASE = 'default'; + +export const SOURCE_KIND_LABELS: Record = { + [SourceKind.Log]: 'Logs', + [SourceKind.Trace]: 'Traces', + [SourceKind.Metric]: 'OTel Metrics', + [SourceKind.Session]: 'Sessions', + [SourceKind.Promql]: 'PromQL', +}; + export const KNOWN_COLUMNS_EXPRESSION_HELP_TEXT = 'For Distributed table sources whose target tables have non-matching column sets. Provide a list of columns supported across all target tables; it is used instead of SELECT * when fetching full row data (e.g. the row side panel). Leave blank to select all columns. This should be a comma-separated list of column names - do not include non-column expressions or aliases.'; diff --git a/packages/app/src/components/Sources/SourcesList.tsx b/packages/app/src/components/Sources/SourcesList.tsx index 7fda356ebf..945f0aded5 100644 --- a/packages/app/src/components/Sources/SourcesList.tsx +++ b/packages/app/src/components/Sources/SourcesList.tsx @@ -30,8 +30,8 @@ import { import { IS_LOCAL_MODE } from '@/config'; import { useConnections } from '@/connection'; import { useSources } from '@/source'; -import { capitalizeFirstLetter } from '@/utils'; +import { SOURCE_KIND_LABELS } from './SourceForm/constants'; import { TableSourceForm } from './SourceForm'; import styles from './Sources.module.scss'; @@ -213,7 +213,7 @@ export function SourcesList({ - {capitalizeFirstLetter(s.kind)} + {SOURCE_KIND_LABELS[s.kind]} {s.section && ( diff --git a/packages/app/src/components/__tests__/SourcesList.test.tsx b/packages/app/src/components/__tests__/SourcesList.test.tsx index 34177ac417..49c59a8458 100644 --- a/packages/app/src/components/__tests__/SourcesList.test.tsx +++ b/packages/app/src/components/__tests__/SourcesList.test.tsx @@ -11,9 +11,6 @@ jest.mock('next/router', () => ({ jest.mock('@/source', () => ({ useSources: jest.fn() })); jest.mock('@/connection', () => ({ useConnections: jest.fn() })); jest.mock('@/config', () => ({ IS_LOCAL_MODE: false })); -jest.mock('@/utils', () => ({ - capitalizeFirstLetter: (s: string) => s.charAt(0).toUpperCase() + s.slice(1), -})); // TableSourceForm only renders while editing/creating; stub it so the list test // does not pull in the full source form. jest.mock('../Sources/SourceForm', () => ({ TableSourceForm: () => null })); @@ -61,13 +58,28 @@ describe('SourcesList section display', () => { it('shows no section labels when no source has a section', () => { asMock(useSources).mockReturnValue({ - data: [makeSource('a', 'Logs'), makeSource('b', 'Traces')], + data: [makeSource('a', 'App'), makeSource('b', 'Host')], + isLoading: false, + refetch: jest.fn(), + }); + renderWithMantine(); + + expect(screen.getByText('App')).toBeInTheDocument(); + expect(screen.getByText('Host')).toBeInTheDocument(); + }); + + it('shows the plural kind label for each source', () => { + asMock(useSources).mockReturnValue({ + data: [ + makeSource('a', 'App'), + makeSource('b', 'Host', { kind: SourceKind.Metric }), + ], isLoading: false, refetch: jest.fn(), }); renderWithMantine(); expect(screen.getByText('Logs')).toBeInTheDocument(); - expect(screen.getByText('Traces')).toBeInTheDocument(); + expect(screen.getByText('OTel Metrics')).toBeInTheDocument(); }); }); diff --git a/packages/app/src/utils.ts b/packages/app/src/utils.ts index e9644d36e8..55de463f50 100644 --- a/packages/app/src/utils.ts +++ b/packages/app/src/utils.ts @@ -60,10 +60,6 @@ export const isValidUrl = (input: string) => { } }; -export const capitalizeFirstLetter = (input: string) => { - return input.charAt(0).toUpperCase() + input.slice(1); -}; - export const getShortUrl = (url: string) => { try { const parsedUrl = new URL(url); diff --git a/packages/app/tests/e2e/features/metric-table-autofill.spec.ts b/packages/app/tests/e2e/features/metric-table-autofill.spec.ts index b2b5f229f0..8b04d32de3 100644 --- a/packages/app/tests/e2e/features/metric-table-autofill.spec.ts +++ b/packages/app/tests/e2e/features/metric-table-autofill.spec.ts @@ -80,9 +80,9 @@ test.describe( await searchPage.sourceActionsMenu.click(); await searchPage.createNewSourceItem.click(); - // Switching the kind to OTEL Metrics renders the metric table selects for + // Switching the kind to OTel Metrics renders the metric table selects for // the default database, which is what autofill reacts to. - await sourceForm.selectSourceKind('OTEL Metrics'); + await sourceForm.selectSourceKind('OTel Metrics'); await sourceForm.waitForMetricTableAutofill(); await expect(sourceForm.getMetricTableInput('gauge')).toHaveValue( diff --git a/packages/app/tests/e2e/features/sources.spec.ts b/packages/app/tests/e2e/features/sources.spec.ts index b8b6d045a0..179ddf0bd7 100644 --- a/packages/app/tests/e2e/features/sources.spec.ts +++ b/packages/app/tests/e2e/features/sources.spec.ts @@ -80,12 +80,12 @@ const editableSourcesData = [ { name: DEFAULT_LOGS_SOURCE_NAME, fields: LOG_FIELDS, - radioButtonName: 'Log', + radioButtonName: 'Logs', }, { name: DEFAULT_TRACES_SOURCE_NAME, fields: TRACE_FIELDS, - radioButtonName: 'Trace', + radioButtonName: 'Traces', }, ]; @@ -94,12 +94,12 @@ const allSourcesData = [ { name: DEFAULT_METRICS_SOURCE_NAME, fields: METRIC_FIELDS, - radioButtonName: 'OTEL Metrics', + radioButtonName: 'OTel Metrics', }, { name: DEFAULT_SESSIONS_SOURCE_NAME, fields: SESSION_FIELDS, - radioButtonName: 'Session', + radioButtonName: 'Sessions', }, ]; @@ -348,7 +348,7 @@ test.describe('Sources Functionality', { tag: ['@sources'] }, () => { await searchPage.createNewSourceItem.click(); await searchPage.page - .getByLabel('OTEL Metrics', { exact: true }) + .getByLabel('OTel Metrics', { exact: true }) .click(); await searchPage.sourceModalShowOptionalFields(); From c3cf531e31c889c21f1d61ebccdaea0f9fef1696 Mon Sep 17 00:00:00 2001 From: Tom Alexander Date: Thu, 1 Oct 2026 12:14:56 -0400 Subject: [PATCH 2/2] fix(app): sentence-case the OTel metrics label, test every kind label --- .changeset/plural-source-kind-labels.md | 2 +- .../components/Sources/SourceForm/constants.ts | 2 +- .../components/__tests__/SourcesList.test.tsx | 18 ++++++++++++++---- .../e2e/features/metric-table-autofill.spec.ts | 4 ++-- .../app/tests/e2e/features/sources.spec.ts | 4 ++-- 5 files changed, 20 insertions(+), 10 deletions(-) diff --git a/.changeset/plural-source-kind-labels.md b/.changeset/plural-source-kind-labels.md index 41c10a62c5..29156c8742 100644 --- a/.changeset/plural-source-kind-labels.md +++ b/.changeset/plural-source-kind-labels.md @@ -4,4 +4,4 @@ fix: use plural source kind labels and "OTel" spelling on the Sources page -The source form's data type options and the sources list now read Logs, Traces, OTel Metrics, Sessions, and PromQL. +The source form's data type options and the sources list now read Logs, Traces, OTel metrics, Sessions, and PromQL. diff --git a/packages/app/src/components/Sources/SourceForm/constants.ts b/packages/app/src/components/Sources/SourceForm/constants.ts index 42f932a968..9ab4f2f95d 100644 --- a/packages/app/src/components/Sources/SourceForm/constants.ts +++ b/packages/app/src/components/Sources/SourceForm/constants.ts @@ -10,7 +10,7 @@ export const DEFAULT_DATABASE = 'default'; export const SOURCE_KIND_LABELS: Record = { [SourceKind.Log]: 'Logs', [SourceKind.Trace]: 'Traces', - [SourceKind.Metric]: 'OTel Metrics', + [SourceKind.Metric]: 'OTel metrics', [SourceKind.Session]: 'Sessions', [SourceKind.Promql]: 'PromQL', }; diff --git a/packages/app/src/components/__tests__/SourcesList.test.tsx b/packages/app/src/components/__tests__/SourcesList.test.tsx index 49c59a8458..138a69d450 100644 --- a/packages/app/src/components/__tests__/SourcesList.test.tsx +++ b/packages/app/src/components/__tests__/SourcesList.test.tsx @@ -71,15 +71,25 @@ describe('SourcesList section display', () => { it('shows the plural kind label for each source', () => { asMock(useSources).mockReturnValue({ data: [ - makeSource('a', 'App'), - makeSource('b', 'Host', { kind: SourceKind.Metric }), + makeSource('a', 'A'), + makeSource('b', 'B', { kind: SourceKind.Trace }), + makeSource('c', 'C', { kind: SourceKind.Metric }), + makeSource('d', 'D', { kind: SourceKind.Session }), + makeSource('e', 'E', { kind: SourceKind.Promql }), ], isLoading: false, refetch: jest.fn(), }); renderWithMantine(); - expect(screen.getByText('Logs')).toBeInTheDocument(); - expect(screen.getByText('OTel Metrics')).toBeInTheDocument(); + for (const label of [ + 'Logs', + 'Traces', + 'OTel metrics', + 'Sessions', + 'PromQL', + ]) { + expect(screen.getByText(label)).toBeInTheDocument(); + } }); }); diff --git a/packages/app/tests/e2e/features/metric-table-autofill.spec.ts b/packages/app/tests/e2e/features/metric-table-autofill.spec.ts index 8b04d32de3..40693c6c49 100644 --- a/packages/app/tests/e2e/features/metric-table-autofill.spec.ts +++ b/packages/app/tests/e2e/features/metric-table-autofill.spec.ts @@ -80,9 +80,9 @@ test.describe( await searchPage.sourceActionsMenu.click(); await searchPage.createNewSourceItem.click(); - // Switching the kind to OTel Metrics renders the metric table selects for + // Switching the kind to OTel metrics renders the metric table selects for // the default database, which is what autofill reacts to. - await sourceForm.selectSourceKind('OTel Metrics'); + await sourceForm.selectSourceKind('OTel metrics'); await sourceForm.waitForMetricTableAutofill(); await expect(sourceForm.getMetricTableInput('gauge')).toHaveValue( diff --git a/packages/app/tests/e2e/features/sources.spec.ts b/packages/app/tests/e2e/features/sources.spec.ts index 179ddf0bd7..0ee087888a 100644 --- a/packages/app/tests/e2e/features/sources.spec.ts +++ b/packages/app/tests/e2e/features/sources.spec.ts @@ -94,7 +94,7 @@ const allSourcesData = [ { name: DEFAULT_METRICS_SOURCE_NAME, fields: METRIC_FIELDS, - radioButtonName: 'OTel Metrics', + radioButtonName: 'OTel metrics', }, { name: DEFAULT_SESSIONS_SOURCE_NAME, @@ -348,7 +348,7 @@ test.describe('Sources Functionality', { tag: ['@sources'] }, () => { await searchPage.createNewSourceItem.click(); await searchPage.page - .getByLabel('OTel Metrics', { exact: true }) + .getByLabel('OTel metrics', { exact: true }) .click(); await searchPage.sourceModalShowOptionalFields();