Prerequisites
- An OTel collector available and reachable, ingesting into your Managed ClickStack service. You need its OTLP endpoint and an ingestion token.
- Node 18+ and npm.
Clone and run the application
Clone the repository, install dependencies, and create your.env file:Get the connection details
The application needs two values to reach the collector:OTEL_EXPORTER_OTLP_ENDPOINT: the OTLP endpoint your collector exposes (commonly port4318for OTLP over HTTP).OTEL_EXPORTER_OTLP_HEADERS: the authorization header carrying your ingestion token, in the formauthorization=<token>.
.env and set them:OTEL_EXPORTER_OTLP_HEADERS to set the authorization header for all three signals: traces, metrics, and logs. If your collector runs locally and doesn’t enforce auth, you can leave the value empty (OTEL_EXPORTER_OTLP_HEADERS=authorization=), but the variable must be present; the SDK skips initialization entirely if it’s unset or fully empty.Instrument the application
Instrumentation has three parts: install the SDKs, switch the launch command, and enable the browser SDK. None of it changes the application’s business logic.Install the SDKs
Install both the backend and browser OpenTelemetry SDKs:Use the opentelemetry-instrument CLI
The application is launched byrun.sh, which has two exec lines at the bottom: one active, one commented. Switch which one is active so Node is wrapped by opentelemetry-instrument:opentelemetry-instrument at process start.Enable the browser SDK
To capture distributed traces (browser to backend) and session replays, enable the browser SDK insrc/web/telemetry.ts. Uncomment the import and the HyperDX.init({...}) block:.env edits are required. __OTLP_ENDPOINT__ and __OTLP_AUTH_TOKEN__ are compile-time constants injected by vite.config.ts: the endpoint is OTEL_EXPORTER_OTLP_ENDPOINT and the token is parsed out of OTEL_EXPORTER_OTLP_HEADERS, the same values the backend uses.Generate traffic and view telemetry
Restart the application so the new launch command and freshly built browser bundle take effect:- 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 the ClickHouse cluster with real network duration, and correlated
console.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
- 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.