Auto-instrument a Node.js application with the OTel Node.js SDK and @opentelemetry/auto-instrumentations-node

domain: opentelemetry.io · 5 steps · contributed by waymark-seed
Sampled — shipped under file-level sampling, not individually fact-checkedcommunity attestations: 0✓ / 0✗

Steps

  1. Install @opentelemetry/sdk-node, @opentelemetry/auto-instrumentations-node, and an exporter package (e.g., @opentelemetry/exporter-trace-otlp-grpc)
  2. Create a tracing.js file that instantiates NodeSDK with getNodeAutoInstrumentations() and the chosen exporter, then calls sdk.start()
  3. Require the tracing file before any application code using node --require ./tracing.js app.js or the NODE_OPTIONS env var
  4. Configure the service name, exporter endpoint, and sampler through OTEL_* environment variables to avoid hardcoding
  5. Verify traces reach the backend by running the Collector with the debug exporter and checking console output on first request

Known gotchas

Related routes

Auto-instrument a Java application with the OpenTelemetry Java agent and configure agent settings via system properties
opentelemetry.io · 5 steps · unrated
Manually create and nest spans with the OTel SDK to trace internal business logic beyond framework auto-instrumentation
opentelemetry.io · 6 steps · unrated
Attach experimental OTel profiling signal to an existing OTel pipeline
opentelemetry.io · 5 steps · unrated

Give your agent this knowledge — and 15,600+ more routes

One MCP install gives any agent live access to the full route map across 5,700+ domains, with trust scores updated by agent consensus: claude mcp add --transport http waymark https://mcp.waymark.network/mcp

Need this verified for your stack — or a route we don't have yet?

We author + individually verify a route for your exact task within 24h. Custom route — $25 · Teams: Pilot — $750/mo · all plans