---
title: Enable Dynamic Instrumentation for Node.js
description: >-
  Set up Dynamic Instrumentation for Node.js applications to add probes and
  capture data without code changes.
breadcrumbs: >-
  Docs > APM > Application Instrumentation > Dynamic Instrumentation > Enabling
  Dynamic Instrumentation > Enable Dynamic Instrumentation for Node.js
---

# Enable Dynamic Instrumentation for Node.js

{% callout %}
# Important note for users on the following Datadog sites: app.ddog-gov.com

{% alert level="danger" %}
This product is not supported for your selected [Datadog site](https://docs.datadoghq.com/getting_started/site). ().
{% /alert %}

{% /callout %}

Dynamic Instrumentation is a feature of the Datadog tracing library that lets you add instrumentation to your application at runtime without code changes or redeployments. Follow these instructions to set up Dynamic Instrumentation for Node.js.

## Prerequisites{% #prerequisites %}

Before you begin, review the [Dynamic Instrumentation prerequisites](https://docs.datadoghq.com/dynamic_instrumentation/#prerequisites). Node.js applications also require:

- Tracing library [`dd-trace-js`](https://github.com/DataDog/dd-trace-js) version 5.48.0 or higher. See the [installation instructions](https://docs.datadoghq.com/tracing/trace_collection/dd_libraries/nodejs/) for setup details.

## Installation{% #installation %}

1. 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`.
1. 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.
1. 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.
1. After starting your service with Dynamic Instrumentation enabled, you can start using Dynamic Instrumentation on the [APM > Dynamic Instrumentation page](https://app.datadoghq.com/dynamic-instrumentation).

## Configuration{% #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](https://docs.datadoghq.com/getting_started/tagging/unified_service_tagging) name, for example, `web-backend`.    |
| `DD_ENV`                             | String  | The [environment](https://docs.datadoghq.com/getting_started/tagging/unified_service_tagging) name, for example, `production`. |
| `DD_VERSION`                         | String  | The [version](https://docs.datadoghq.com/getting_started/tagging/unified_service_tagging) 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{% #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`](https://www.typescriptlang.org/tsconfig/#inlineSourceMap) or [`sourceMap`](https://www.typescriptlang.org/tsconfig/#sourceMap) to `true` in the TypeScript config file.
- **Babel**: Configure the [`sourceMaps`](https://babeljs.io/docs/options#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`](https://webpack.js.org/configuration/devtool/) option in the Webpack config file.
- **CoffeeScript**: Use either `--inline-map` or `--map` as arguments to the [`coffee`](https://coffeescript.org/#usage) CLI.

**Note:** For better runtime performance, it's recommended *not* to include the original source code in the source maps.

## What to do next{% #what-to-do-next %}

See [Dynamic Instrumentation](https://docs.datadoghq.com/dynamic_instrumentation/) for information about adding instrumentations and browsing and indexing the data.

## Limitations{% #limitations %}

The following limitations apply to the Node.js implementation:

### Supported features{% #supported-features %}

- [Dynamic Logs](https://docs.datadoghq.com/dynamic_instrumentation/#creating-log-probes) attached to a specific file/line
- Capturing of variables for Dynamic Logs
- [PII redaction](https://docs.datadoghq.com/dynamic_instrumentation/sensitive-data-scrubbing/#custom-identifier-redaction) based on variable/property names
- [Source code integration](https://docs.datadoghq.com/integrations/guide/source-code-integration/?tab=nodejs#embed-git-information-in-your-build-artifacts) (including source map support)

### Unsupported features{% #unsupported-features %}

- Dynamic Metrics, Spans, and Span Tags
- Dynamic Logs attached to a function/method
- PII redaction based on specific classes or types

## Further reading{% #further-reading %}

- [Getting Started with Datadog Agent](https://docs.datadoghq.com/agent)
