---
title: Enabling the Node.js Profiler
description: Datadog, the leading service for cloud-scale monitoring.
breadcrumbs: >-
  Docs > Continuous Profiler > Enabling the Profiler > Enabling the Node.js
  Profiler
---

# Enabling the Node.js Profiler

The profiler is shipped within Datadog tracing libraries. If you are already using [APM to collect traces](https://docs.datadoghq.com/tracing/trace_collection.md) for your application, you can skip installing the library and go directly to enabling the profiler.

## Requirements{% #requirements %}

For a summary of the minimum and recommended runtime and tracer versions across all languages, read [Supported Language and Tracer Versions](https://docs.datadoghq.com/profiler/enabling/supported_versions.md).

The Datadog Profiler requires at least Node.js 18.

Continuous Profiler support is in Preview for some serverless platforms, such as [AWS Lambda](https://docs.datadoghq.com/serverless/aws_lambda/profiling.md).

Continuous Profiler support is in Preview for Google Cloud Run.

## Installation{% #installation %}

To begin profiling applications:

1. Ensure Datadog Agent v6+ is installed and running. Datadog recommends using [Datadog Agent v7+](https://app.datadoghq.com/account/settings/agent/latest?platform=overview).

1. Run `npm install --save dd-trace@latest` to add a dependency on the `dd-trace` module which includes the profiler.

1. Enable the profiler using **one** of the following approaches:

   {% tab title="Environment variables" %}
   
   ```shell
   export DD_PROFILING_ENABLED=true
   export DD_ENV=prod
   export DD_SERVICE=my-web-app
   export DD_VERSION=1.0.3
   ```

**Note**: If you're already using Datadog APM, you are already calling `init` and don't need to do so again. If you are not, ensure the tracer and the profiler are loaded together:

   ```
   node -r dd-trace/init app.js
   ```

      {% /tab %}

   {% tab title="In code" %}
   
   ```js
   const tracer = require('dd-trace').init({
     profiling: true,
     env: 'prod',
     service: 'my-web-app',
     version: '1.0.3'
   })
   ```

**Note**: If you're already using Datadog APM, you are already calling `init` and don't need to do so again. If you are not, ensure the tracer and the profiler are loaded together:

   ```gdscript3
   const tracer = require('dd-trace/init')
   ```

      {% /tab %}

1. A couple of minutes after you start your application, your profiles appear on the [APM > Profiler page](https://app.datadoghq.com/profiling). If they do not, see the [Troubleshooting](https://docs.datadoghq.com/profiler/profiler_troubleshooting/nodejs.md) guide.

1. Optional: Set up [Source Code Integration](https://docs.datadoghq.com/integrations/guide/source-code-integration.md?tab=nodejs) to connect your profiling data with your Git repositories.

1. Optional: [Upload Source Maps](https://docs.datadoghq.com/real_user_monitoring/guide/upload-javascript-source-maps.md) (Preview).
Join the Preview!: Profiler support for uploaded source maps is in Preview.
If you deploy source maps with your application, the profiler reads them and produces mapped locations in profiles. Source maps in `.map` files and inline source maps are both supported. To reduce deployment sizes (for example, in serverless environments), you can choose not to deploy source maps and instead upload them to Datadog.

**Note**: Uploaded source maps require dd-trace version 5.93.0 or newer. Your deployed source files must also contain the `@sourceMappingURL` annotation so the profiler knows to use the uploaded maps.

## Not sure what to do next?{% #not-sure-what-to-do-next %}

The [Getting Started with Profiler](https://docs.datadoghq.com/getting_started/profiler.md) guide takes a sample service with a performance problem and shows you how to use Continuous Profiler to understand and fix the problem.

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

- [Getting Started with Profiler](https://docs.datadoghq.com/getting_started/profiler.md)
- [Learn more about available profile visualizations](https://docs.datadoghq.com/profiler/profile_visualizations.md)
- [Fix problems you encounter while using the profiler](https://docs.datadoghq.com/profiler/profiler_troubleshooting.md)
