TL;DRClone the HackerNews Analyzer, fill
.env with your OTLP endpoint and token, then paste the agent prompt. The backend needs no OpenTelemetry imports; the agent wires @hyperdx/node-opentelemetry at process start.Time required: about 10 minutesPrerequisites
- Node 18+ and npm
- A ClickStack OTLP/HTTP endpoint and ingestion token:
- ClickHouse Cloud: open the service, then ClickStack → Configure your OpenTelemetry exporter → Env vars. Protocol is
http/protobuf. Headers areauthorization=<ingestion token>with noBearerprefix. - Local collector: use
http://localhost:4318. If the collector is unsecured, leaveauthorization=empty.
- ClickHouse Cloud: open the service, then ClickStack → Configure your OpenTelemetry exporter → Env vars. Protocol is
Clone the repository
Clone HackerNews Analyzer, install dependencies, and copy the env template:.env in the next steps, then instrument from this directory.
Instrument the application
1
Run the application
From the cloned Open http://localhost:5001. You will see a year selector, summary statistics, an activity chart, top users and domains tables, and a search box. Click around: switch years, drill into stories.At this point the application is running but uninstrumented. ClickStack shows no data: it is waiting for telemetry.
hn-news-analyzer directory, start the app. The ClickHouse data source defaults to the public read-only demo cluster, so it runs without any further configuration:2
Configure environment
The SDKs read standard OpenTelemetry exporter variables. They are not hardcoded in source. Open
.env and set:OTEL_EXPORTER_OTLP_ENDPOINT is the OTLP/HTTP endpoint (port 4318). OTEL_EXPORTER_OTLP_HEADERS is the authorization header, in the form authorization=<token> with no Bearer prefix.If the collector does not enforce auth, leave the token empty (OTEL_EXPORTER_OTLP_HEADERS=authorization=). The variable must still be present; the SDK skips initialization if it is unset or fully empty.The browser SDK reuses these same values. vite.config.ts bakes the endpoint and token into the public bundle at build time, so use a throwaway ingestion token, not a production one.3
Instrument the application
Pick one path. All three end at the same instrumented app.
- Agent instrumentation
- Manual instrumentation
- Use a pre-instrumented branch
With the repo cloned and
.env filled in, paste this prompt into a coding agent in that directory to instrument the application.4
Generate traffic and view telemetry
Restart the application so the new launch command and freshly built browser bundle take effect:Confirm the startup banner prints three “Health check passed” lines for Logs, metrics, traces, and session replays land in the same UI, share the same query language, and are correlated automatically.
/v1/traces, /v1/metrics, and /v1/logs. Reload the browser tab so Vite serves the updated bundle, then switch years and click into stories to generate traffic.Open the ClickStack UI:- Go to Search and filter to the last 5 minutes. Logs for
hn-analyzer-apistream in.
- Click into a request and walk up the trace. You will see the Express handler span, a child HTTP span pointing at
sql-clickhouse.clickhouse.comwith real network duration, and correlatedconsole.logrecords on the same trace.
- Open Session Replay to play back a scrubbable video of a browser session, synced to the trace timeline.
Learn more
- HackerNews Analyzer: the demo repository this guide instruments.
- Session Replay: feature overview, SDK options, and privacy controls.
- Session Replay Demo: a self-contained demo with a local ClickStack instance.
- ClickStack Getting Started: deploy ClickStack and ingest your first data.
- All Sample Datasets: other example datasets and guides.