Instrumenting your application
- Fully managed
- Self-managed
ClickHouse Observability is fully compatible with OpenTelemetry, so you can send browser telemetry (traces, exceptions) using the standard OpenTelemetry JavaScript SDK or any of the language SDKs. However, session replay requires the Browser SDK (The Browser SDK masks inputs and text by default. See privacy controls for privacy-sensitive applications, and attaching user information so you can search and filter sessions by user in the UI.
@clickhouse/clickstack-browser), which extends the OpenTelemetry SDK with session recording, console capture, and network request capture. If you only need traces without session replay, any OTel-compatible browser SDK will work with the service.The examples below use the Browser SDK. In your ClickHouse Observability service, open Team Settings → Data → Managed Telemetry and copy the OTLP HTTP endpoint and API key. Replace YOUR_OTEL_ENDPOINT and YOUR_API_KEY in the examples with these connection details.Use the full HTTPS endpoint as shown in Managed Telemetry, without signal paths such as /v1/traces. Pass the API key through apiKey with a Bearer prefix, as shown below. Then install and initialize the SDK in your application.- NPM
- Yarn
- Script Tag
The
traceOrigins option is key to connecting session replays with backend traces — set it to your API domain to enable full frontend-to-backend distributed tracing. For shared SDK options, including privacy controls and error reporting, see the Browser SDK reference. Use the managed connection details above when initializing the SDK.Viewing session replays
Navigate to Client Sessions from the left sidebar in the UI. This view lists all captured browser sessions with their duration and event count. Open a session, then select Play to replay the recorded interactions. The replay view shows the reconstructed user experience on the right, with a timeline of browser events — network requests, console logs, and errors — on the left. Switch between Highlighted and All Events modes to adjust the level of detail shown on the timeline. Errors are annotated in red, and clicking on any event navigates the replay to that point in the session.From session to trace
When you select a network request or error in the session timeline, you can click through to the Trace tab to follow the request through your backend services — seeing the associated logs, spans, and database queries that were triggered by that user interaction. This works because thetraceOrigins configuration links browser spans to server spans via the traceparent header, creating a connected distributed trace from the user’s click all the way to the database. For a detailed walkthrough of this in practice, including instrumenting both frontend and backend, see Instrumenting your NextJS application with OpenTelemetry and ClickStack.
From trace to session
The correlation works in the other direction too. When viewing a trace in the Search view, click on it to open the trace detail, then select the Session replay tab to see exactly what the user was experiencing at the time of that trace. This is especially useful when investigating errors or slow requests — you can start from the backend issue and immediately see the user’s perspective.Try it out
Follow the session replay demo to instrument an interactive application, send session data to your ClickHouse Observability service, and replay your interactions.Learn more
- Session replay demo — instrument an interactive application using your managed connection details
- Browser SDK reference — shared SDK options and advanced configuration
- Search — search syntax for filtering sessions and events
- Dashboards — build visualizations and dashboards from session and trace data
- Alerts — set up alerts on errors, latency, and other signals
- Architecture — how the service components fit together