JavaScript zero-code instrumentation

Capture telemetry from your application with zero source code modifications

Zero-code instrumentation for JavaScript provides a way to instrument any Node.js application and capture telemetry data from many popular libraries and frameworks without any code changes.


Run the following commands to install the appropriate packages.

npm install --save @opentelemetry/api
npm install --save @opentelemetry/auto-instrumentations-node

The @opentelemetry/api and @opentelemetry/auto-instrumentations-node packages install the API, SDK, and the instrumentation tools.

Configuring the module

The module is highly configurable.

One option is to configure the module by way of using env to set environment variables from the CLI:

node --require @opentelemetry/auto-instrumentations-node/register app.js

Alternatively, you can use export to set environment variables:

export OTEL_EXPORTER_OTLP_ENDPOINT="your-endpoint"
export OTEL_SERVICE_NAME="your-service-name"
export NODE_OPTIONS="--require @opentelemetry/auto-instrumentations-node/register"
node app.js

By default, all SDK resource detectors are used. You can use the environment variable OTEL_NODE_RESOURCE_DETECTORS to enable only certain detectors, or to completely disable them.

To see the full range of configuration options, see Module Configuration.

Supported libraries and frameworks

A number of popular Node.js libraries are auto-instrumented. For the full list, see supported instrumentation.


You can set the log level by setting the OTEL_LOG_LEVEL environment variable to one of the following:

  • none
  • error
  • warn
  • info
  • debug
  • verbose
  • all

The default level is info.

Zero-Code Instrumentation Configuration

Learn how to configure Zero-Code Instrumentation for Node.js