This guide covers Node.js applications running on ECS, EC2, Kubernetes, or any container/VM environment. For AWS Lambda, see the Node.js Lambda guide.
1. Install the OpenTelemetry SDK
2. Enable Auto Instrumentation
Enable auto instrumentation by requiring theauto-instrumentations-node module using the --require flag:
3. Set Environment Variables
Add these environment variables to your service. ReplaceYOUR_TRACE0_ENV_API_KEY with the API key from your Trace0 environment.
4. Add Trace0 logger
To correlate logs with traces in Trace0, the @trace0/otel-logger library must be installed in your app. This is necessary because the OpenTelemetry JavaScript library does not yet automatically bridge console output into the OTel Logs pipeline. First, install the library:5. Kubernetes Setup
If your application runs on Kubernetes, includingAmazon EKS, Google Kubernetes Engine or Azure Kubernetes Service, add the following environment variables to your container specification.