Enable Dynamic Instrumentation for Node.js
Join the Preview
Dynamic Instrumentation for Node.js is in limited preview, and is not available to all customers.
Request access to join the waiting list.
Note that some limitations apply to the preview.
Request AccessDynamic Instrumentation is a feature of supporting Datadog tracing libraries. If you are already using APM to collect traces for your application, ensure your Agent and tracing library are on the required version. Then, go directly to enabling Dynamic Instrumentation in step 4.
Installation
- Install or upgrade your Agent to version 7.45.0 or higher.
- If you don’t already have APM enabled, in your Agent configuration, set the
DD_APM_ENABLED
environment variable to true
and listening to the port 8126/TCP
. - Install or upgrade the Node.js tracing library to version 5.39.0 or higher, by following the relevant instructions.
- If your source code is transpiled during deployment (for example, if using TypeScript), ensure that source maps are published along with the deployed Node.js application.
- Run your service with Dynamic Instrumentation enabled by setting the
DD_DYNAMIC_INSTRUMENTATION_ENABLED
environment variable to true
. Specify DD_SERVICE
, DD_ENV
, and DD_VERSION
Unified Service Tags so you can filter and group your instrumentations and target active clients across these dimensions. - After starting your service with Dynamic Instrumentation enabled, you can start using Dynamic Instrumentation on the APM > Dynamic Instrumentation page.
Configuration
Configure Dynamic Instrumentation using the following environment variables:
Environment variable | Type | Description |
---|
DD_DYNAMIC_INSTRUMENTATION_ENABLED | Boolean | Set to true to enable Dynamic Instrumentation. |
DD_SERVICE | String | The service name, for example, web-backend . |
DD_ENV | String | The environment name, for example, production . |
DD_VERSION | String | The version of your service. |
DD_TAGS | String | Tags to apply to produced data. Must be a list of <key>:<value> separated by commas such as: layer:api,team:intake . |
Source map support
If the source code of your Node.js application is transpiled or bundled,
you need to generate and publish the source maps along with the code, either inline or as separate files.
- TypeScript: Set either
inlineSourceMap
or sourceMap
to true
in the TypeScript config file. - Babel: Configure the
sourceMaps
option in the Babel config file (see also the special --source-maps
CLI option, used to generate separate source map files). - Webpack: Configure the
devtools
option in the Webpack config file. - CoffeeScript: Use either
--inline-map
or --map
as arguments to the coffee
CLI.
Note: For better runtime performance, it’s recommended not to include the original source code in the source maps.
What to do next
See Dynamic Instrumentation for information about adding instrumentations and browsing and indexing the data.
Limitations
The following limitations apply to the limited preview:
Supported features
Unsupported features
- Dynamic Metrics, Spans, and Span Tags
- Dynamic Logs attached to a function/method
- Custom template for Dynamic Logs
- Dynamic Log conditions
- PII redaction based on specific classes or types
Further reading
Additional helpful documentation, links, and articles: