Prerequisites
- A ClickHouse Observability service
- For your application, Node.js 22 or newer and npm
- For the demo, Docker and
curl
Connection details
- Fully managed
- Self-managed
Open ClickHouse Observability and go to Team Settings → Data → Managed Telemetry. Copy your OTLP HTTP endpoint and API key. You can use Copy connection details to copy the configuration, or Reveal key to view the masked key.Set these connection variables in the terminal where you will run your application or demo collector:Replace the placeholders with the exact endpoint, including its port, and API key from your service. Use the base HTTP endpoint without a
/v1/traces suffix; the exporter appends the signal path.Integration with an existing Node.js application
1
Install OpenTelemetry
From your application’s directory, install the instrumentation packages:These steps use OpenTelemetry automatic instrumentation for CommonJS applications. Native ES modules require the ESM setup. Use one instrumentation setup per application to avoid duplicate spans.
2
Configure tracing and start your application
In the terminal where you set the connection variables, run:Replace
app.js with your application entry point. The preload initializes instrumentation before your application imports its libraries. For a self-managed endpoint without authentication, omit the headers export and run unset OTEL_EXPORTER_OTLP_HEADERS.The endpoint must be reachable from the application. If it runs in a container, localhost refers to that container.3
Generate traffic
Make requests to an endpoint your application serves. For an application listening on port Allow a few seconds for the exporter to send the spans.
3000:4
Verify traces
Open Search, select Traces, filter for
ServiceName:nodejs-service, and select Last 15 minutes. Open a trace to inspect its spans, timing, and attributes.Demo dataset
The sample contains 822 spans fromnodejs-demo-api. You do not need a running Node.js application.
1
Download the sample dataset
2
Configure the demo collector
Save the following as
nodejs-traces-demo.yaml in the download directory:The demo-only
transform/demo_timestamps processor shifts this sample into roughly the past 24 hours, ending two minutes before ingestion, while preserving span durations and the traffic pattern. Omit this processor for your own Node.js traces so their original timestamps are preserved. Sending the sample again can produce duplicate spans.3
Run the demo collector
For a destination collector running on this computer, set
OTEL_EXPORTER_OTLP_ENDPOINT to http://host.docker.internal:4318. The command below includes the Docker host mapping.0.161.0 from the directory containing the configuration, in the terminal where you set the connection variables. Keep this terminal open:14318 to avoid conflicting with an existing collector on port 4318. The collector forwards the traces to your configured endpoint using the authentication settings above.4
Send the traces
In another terminal, from the download directory, send the original sample to the local collector:An empty success response such as
{} or {"partialSuccess":{}} indicates the local collector accepted the request. Check the collector’s output for export errors and allow a few seconds for the batch to reach your service. Stop the demo collector with Ctrl+C when finished.5
Verify the demo traces
Open Search, select Traces, filter for
ServiceName:nodejs-demo-api, and select Last 2 days to include the full shifted dataset. Open a trace to inspect the HTTP attributes.Dashboards and visualization
1
2
Import the dashboard
- Open Dashboards and click Import in the upper-right corner.
- Upload
nodejs-traces-dashboard.json. - Map the charts to your Traces source and click Finish Import.
3
View the dashboard
For the sample, select Last 2 days and optionally filter for
ServiceName:nodejs-demo-api. For your application, select its service name and a time range covering your requests.The dashboard uses the sample’s HTTP span attributes. Instrumentation versions can use different attribute names; adjust chart fields if your application’s spans differ.Troubleshooting
No application traces appear
Check application output for export errors. Verify the endpoint, protocol, and authentication settings. Load instrumentation before application libraries, generate requests, and check the service-name filter and time range. For native ES modules, follow the linked ESM setup.Demo traces do not appear
Check the demo collector output for authentication or export errors. A successfulcurl response confirms local acceptance; allow a few seconds for forwarding to your service. Include transform/demo_timestamps in the pipeline and select Last 2 days. Resending the sample can create duplicates.
Next steps
- Set up alerts for errors and latency.
- Create additional dashboards.