This is an example of auto-instrumenting a simple express application with OpenTelemetry-JS and exporting traces to New Relic using OTLP/gRPC Trace Exporter.
-
Sign up for a free New Relic account.
-
Copy your New Relic account ingest license key.
-
Run
npm install
. -
Set the following environment variables:
export OTEL_EXPORTER_OTLP_ENDPOINT=otlp.nr-data.net:4317 export OTEL_EXPORTER_OTLP_HEADERS=api-key=<your_license_key_here>
- Replace
<your_license_key_here>
with your New Relic account ingest license key.
- Replace
-
Run the application:
npm start
- This is a script to load the tracing code before the application code.
The application exposes a simple endpoint at http://localhost:8080/ping
.
Invoke it via: curl http://localhost:8080/ping
to generate trace data.
The application produces trace data reporting to a service named OpenTelemetry-Node.JS-Example.