Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions .changeset/demo-server-new-host.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
'@hyperdx/app': patch
---

fix: point the "Connect to Demo Server" connection at the new demo ClickHouse
52 changes: 36 additions & 16 deletions packages/app/src/components/OnboardingModal.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand All @@ -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',

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🟠 major — Demo connection is hardcoded to a ClickHouse staging host (*.clickhouse-staging.com:8443)

Before merging, point DEMO_CONNECTION.host at a production or stable public endpoint. Like the old sql-clickhouse.clickhouse.com, it should be a *.clickhouse.com host, not an auto-generated staging instance ID. Every self-hosted install and every Vercel preview will be wired to this host, and the legacy-migration branch rewrites existing Demo connections to it permanently.

Nothing blocks merge automatically, but a maintainer will expect this fixed if it is a real defect in code this PR changes. If it is about surrounding code, reply and say so instead of patching. Do not widen the PR. How to respond

username: 'otel_demo',
password: '',
};
const LEGACY_DEMO_CONNECTION = {
host: 'https://sql-clickhouse.clickhouse.com',

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🔵 minor — CONTRIBUTING.md still tells contributors to use the old demo host and the otel_v2 database

Update CONTRIBUTING.md lines 124-127 (the manual full-stack demo setup) to the new host and database otel, or reference DEMO_CONNECTION. Contributors who follow it now create a connection that the onboarding code treats as legacy and rewrites.

Advisory. Fix if it is a small defect in code this PR changes; otherwise reply in the thread. Do not widen the PR or touch files it did not already change. How to respond

username: 'otel_demo',
};

async function addOtelDemoSources({
connectionId,
createSourceMutation,
Expand Down Expand Up @@ -260,6 +275,7 @@ function OnboardingModalComponent({

const createSourceMutation = useCreateSource();
const createConnectionMutation = useCreateConnection();
const updateConnectionMutation = useUpdateConnection();
Comment thread
greptile-apps[bot] marked this conversation as resolved.
Resolved
const updateSourceMutation = useUpdateSource();
const deleteSourceMutation = useDeleteSource();
const metadata = useMetadataWithSettings();
Expand Down Expand Up @@ -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 (
Comment thread
pulpdrew marked this conversation as resolved.
Resolved
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 },
Comment thread
greptile-apps[bot] marked this conversation as resolved.
Resolved
});
} 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;
Expand All @@ -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',
Expand All @@ -716,7 +735,7 @@ function OnboardingModalComponent({
],
},
{
databaseName: 'otel_v2',
databaseName: 'otel',
tableName: 'otel_traces_1m_v2',
dimensionColumns: 'ServiceName, SpanName, SpanKind',
minGranularity: '1 minute',
Expand Down Expand Up @@ -788,6 +807,7 @@ function OnboardingModalComponent({
connections,
createSourceMutation,
createConnectionMutation,
updateConnectionMutation,
updateSourceMutation,
deleteSourceMutation,
sources,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -38,9 +38,11 @@ jest.mock('@/source', () => ({
const mockConnectionsResult = {
data: [{ id: 'conn-1', name: 'Default', host: 'http://localhost:8123' }],
};
const mockUpdateConnectionMutation = { mutateAsync: jest.fn() };

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🔵 minor — New legacy-connection migration path has no test; the mock only exists so the import resolves

Add a test that seeds mockConnectionsResult with {name:'Demo', host:'https://sql-clickhouse.clickhouse.com', username:'otel_demo'}, clicks "Connect to Demo Server", and checks that mockUpdateConnectionMutation.mutateAsync received the new host while create did not run. Add a second case where a Demo connection with a non-legacy host is left alone. Also check that the sources are created with databaseName: 'otel'.

Advisory. Fix if it is a small defect in code this PR changes; otherwise reply in the thread. Do not widen the PR or touch files it did not already change. How to respond

jest.mock('@/connection', () => ({
useConnections: () => mockConnectionsResult,
useCreateConnection: () => ({ mutate: jest.fn() }),
useUpdateConnection: () => mockUpdateConnectionMutation,
}));

const mockMetadata = {
Expand Down
Loading