The Service Map for APM is here!

Tracing Node.js Applications

Installation And Getting Started

For descriptions of terminology used in APM, take a look at the official documentation.

For details about configuration and using the API, see Datadog’s API documentation.

For details about contributing, check out the development guide.

Quickstart

This library MUST be imported and initialized before any instrumented module. When using a transpiler, you MUST import and initialize the tracer library in an external file and then import that file as a whole when building your application. This prevents hoisting and ensures that the tracer library gets imported and initialized before importing any other instrumented module.

To begin tracing Node.js applications, first install and configure the Datadog Agent (see additional documentation for tracing Docker applications).

Next, install the Datadog Tracing library using npm:

npm install --save dd-trace

Finally, import and initialize the tracer:

// This line must come before importing any instrumented module.
const tracer = require('dd-trace').init()

See the tracer settings for the list of initialization options.

Compatibility

Node ^4.7, ^6.9 and >=8 are supported by this library. However, it benefits significantly from the performance improvements introduced in Node >=8.3.

Integrations

APM provides out-of-the-box instrumentation for many popular frameworks and libraries by using a plugin system. If you would like support for a module that is not listed, contact support to share a request.

For details about how to how to toggle and configure plugins, check out the API documentation.

Web Framework Compatibility

Module Versions Support Type Notes
express 4 Fully Supported Supports Sails, Loopback, and more
graphql 0.10 - 14 Fully Supported Supports Apollo Server and express-graphql
hapi 2 - 17 Fully Supported
koa 2 Fully Supported
restify 3 - 7 Fully Supported

Native Module Compatibility

Module Support Type
http Fully Supported
https Fully Supported

Data Store Compatibility

Module Versions Support Type Notes
cassandra-driver Coming Soon
elasticsearch 10 - 15 Fully Supported
ioredis 2 - 4 Fully Supported
memcached ^2.2 Fully Supported
mongodb-core 2 - 3 Fully Supported Supports Mongoose
mysql 2 Fully Supported
mysql2 1 Fully Supported
pg 4 - 7 Fully Supported pg-native support coming soon
redis 0.12 - 2.6 Fully Supported

Worker Compatibility

Module Versions Support Type Notes
amqp10 3 Fully Supported Supports AMQP 1.0 brokers (i.e. ActiveMQ, Apache Qpid)
amqplib 0.5 Fully Supported Supports AMQP 0.9 brokers (i.e. RabbitMQ, Apache Qpid)
kafka-node Coming Soon
rhea Coming Soon

Promise Library Compatibility

Module Versions Support Type
bluebird 2 - 3 Fully Supported
q 1 Fully Supported
when 3 Fully Supported

Further Reading