JavaScript OpenTelemetry APM

Complete these tasks to properly integrate OpenTelemetry APM in JavaScript:

Install

Run these install commands to install JavaScript packages:

npm install @opentelemetry/sdk-node \
  @opentelemetry/api \
  @opentelemetry/auto-instrumentations-node \
  @opentelemetry/sdk-metrics \
  @opentelemetry/sdk-trace-node

Set Up Instrumentation

To set up the instrumentation and use the APIs for manual instrumentation, follow these steps from the see OpenTelemetry’s documentation of Manual Instrumentation Setup:

For creating spans using the OpenTelemetry JS API, use the following OpenTelemetry documentation: Initialize Tracing.

To use auto-instrumentation instead of manually creating spans for your functions, explore the Instrumentation Libraries.

Instrumentation Libraries

OpenTelemetry JavaScript can automatically instrument and support a number of libraries, frameworks, and application servers, as separate NPN packages. We recommend that you review the available OpenTelemetry Registry for JavaScript.

Examples

You can use a set of fully-functional, working examples of OpenTelemetry JavaScript from OpenTelemetry JavaScript Examples. You can run them locally.