diff --git a/.changeset/demo-server-new-host.md b/.changeset/demo-server-new-host.md new file mode 100644 index 0000000000..40d515ed39 --- /dev/null +++ b/.changeset/demo-server-new-host.md @@ -0,0 +1,5 @@ +--- +'@hyperdx/app': patch +--- + +fix: point the "Connect to Demo Server" connection at the new demo ClickHouse diff --git a/packages/app/src/components/OnboardingModal.tsx b/packages/app/src/components/OnboardingModal.tsx index f26f4b3358..6d8559ba64 100644 --- a/packages/app/src/components/OnboardingModal.tsx +++ b/packages/app/src/components/OnboardingModal.tsx @@ -20,7 +20,11 @@ import { IS_LOCAL_MODE, IS_PROMQL_ENABLED, } from '@/config'; -import { useConnections, useCreateConnection } from '@/connection'; +import { + useConnections, + useCreateConnection, + useUpdateConnection, +} from '@/connection'; import { useMetadataWithSettings } from '@/hooks/useMetadata'; import { inferTableSourceConfig, @@ -36,6 +40,17 @@ import { useBrandDisplayName } from '@/theme/ThemeProvider'; import { TableSourceForm } from './Sources/SourceForm'; import { SourcesList } from './Sources/SourcesList'; +const DEMO_CONNECTION = { + name: 'Demo', + host: 'https://b1g1gnrrz3.us-central1.gcp.clickhouse-staging.com:8443', + username: 'otel_demo', + password: '', +}; +const LEGACY_DEMO_CONNECTION = { + host: 'https://sql-clickhouse.clickhouse.com', + username: 'otel_demo', +}; + async function addOtelDemoSources({ connectionId, createSourceMutation, @@ -260,6 +275,7 @@ function OnboardingModalComponent({ const createSourceMutation = useCreateSource(); const createConnectionMutation = useCreateConnection(); + const updateConnectionMutation = useUpdateConnection(); const updateSourceMutation = useUpdateSource(); const deleteSourceMutation = useDeleteSource(); const metadata = useMetadataWithSettings(); @@ -652,16 +668,19 @@ function OnboardingModalComponent({ // Reuse existing demo connection if available, otherwise create one const existingDemoConnection = connections?.find(c => c.name === 'Demo'); let createdConnectionId = existingDemoConnection?.id ?? ''; - if (!existingDemoConnection) { + if ( + existingDemoConnection?.host === LEGACY_DEMO_CONNECTION.host && + existingDemoConnection.username === LEGACY_DEMO_CONNECTION.username + ) { + // Demo connections created before the demo server moved still point + // at the old host + await updateConnectionMutation.mutateAsync({ + id: existingDemoConnection.id, + connection: { ...existingDemoConnection, ...DEMO_CONNECTION }, + }); + } else if (!existingDemoConnection) { await createConnectionMutation.mutateAsync( - { - connection: { - name: 'Demo', - host: 'https://sql-clickhouse.clickhouse.com', - username: 'otel_demo', - password: '', - }, - }, + { connection: DEMO_CONNECTION }, { onSuccess(data) { createdConnectionId = data.id; @@ -680,23 +699,23 @@ function OnboardingModalComponent({ createSourceMutation, deleteSourceMutation, - logSourceDatabaseName: 'otel_v2', + logSourceDatabaseName: 'otel', logSourceName: 'Demo Logs', logSourceTableName: 'otel_logs', - metricsSourceDatabaseName: 'otel_v2', + metricsSourceDatabaseName: 'otel', metricsSourceName: 'Demo Metrics', - sessionSourceDatabaseName: 'otel_v2', + sessionSourceDatabaseName: 'otel', sessionSourceName: 'Demo Sessions', sessionSourceTableName: 'hyperdx_sessions', - traceSourceDatabaseName: 'otel_v2', + traceSourceDatabaseName: 'otel', traceSourceName: 'Demo Traces', traceSourceTableName: 'otel_traces', traceSourceMaterializedViews: [ { - databaseName: 'otel_v2', + databaseName: 'otel', tableName: 'otel_traces_1m', dimensionColumns: 'ServiceName, StatusCode', minGranularity: '1 minute', @@ -716,7 +735,7 @@ function OnboardingModalComponent({ ], }, { - databaseName: 'otel_v2', + databaseName: 'otel', tableName: 'otel_traces_1m_v2', dimensionColumns: 'ServiceName, SpanName, SpanKind', minGranularity: '1 minute', @@ -788,6 +807,7 @@ function OnboardingModalComponent({ connections, createSourceMutation, createConnectionMutation, + updateConnectionMutation, updateSourceMutation, deleteSourceMutation, sources, diff --git a/packages/app/src/components/__tests__/OnboardingModal.test.tsx b/packages/app/src/components/__tests__/OnboardingModal.test.tsx index 3a7407eb26..ac54701a4c 100644 --- a/packages/app/src/components/__tests__/OnboardingModal.test.tsx +++ b/packages/app/src/components/__tests__/OnboardingModal.test.tsx @@ -38,9 +38,11 @@ jest.mock('@/source', () => ({ const mockConnectionsResult = { data: [{ id: 'conn-1', name: 'Default', host: 'http://localhost:8123' }], }; +const mockUpdateConnectionMutation = { mutateAsync: jest.fn() }; jest.mock('@/connection', () => ({ useConnections: () => mockConnectionsResult, useCreateConnection: () => ({ mutate: jest.fn() }), + useUpdateConnection: () => mockUpdateConnectionMutation, })); const mockMetadata = {