Profile types
The Node.js profiler collects the following profile types:Wall time
Samples the call stack at regular intervals regardless of CPU state. Includes time spent in I/O, timers, and awaiting callbacks. Best for understanding overall latency.
CPU time
Measures time the CPU actively spends executing JavaScript. Useful for identifying compute-intensive code.
Heap allocation
Tracks object allocations by sampling the call stack at allocation time. Helps identify memory-hungry code paths and memory leaks.
Heap live objects
Snapshots live objects in the V8 heap at the end of each profiling interval. Useful for understanding memory usage patterns.
CPU profiling is enabled by default. Heap profiling can be enabled separately with
DD_PROFILING_HEAP_ENABLED=true.Enabling the profiler
Configuration
| Environment variable | Default | Description |
|---|---|---|
DD_PROFILING_ENABLED | false | Enable the profiler |
DD_PROFILING_CPU_ENABLED | true | Enable CPU / wall-time profiling |
DD_PROFILING_HEAP_ENABLED | false | Enable heap allocation profiling |
DD_PROFILING_WALLTIME_ENABLED | true | Enable wall-time profiling |
DD_PROFILING_UPLOAD_PERIOD | 65 | Profile upload interval in seconds |
DD_PROFILING_HEAP_SAMPLING_INTERVAL | — | Heap sampling interval in bytes |
DD_PROFILING_CODEHOTSPOTS_ENABLED | true | Link profiles to traces (Code Hotspots) |
DD_PROFILING_ENDPOINT_COLLECTION_ENABLED | true | Tag profiles with endpoint information |
DD_PROFILING_TIMELINE_ENABLED | false | Enable timeline view in profiles |
Code Hotspots
WhenDD_PROFILING_CODEHOTSPOTS_ENABLED=true (the default), the profiler links profiling data to APM traces. In the Datadog trace view, you can drill into a span and see the flame graph for exactly that span, making it easy to identify which function inside a slow request is consuming the most time.
Serverless environments
On AWS Lambda (AWS_LAMBDA_FUNCTION_NAME is set), the profiler uses a ServerlessProfiler variant that adapts profile upload timing to the Lambda execution lifecycle. Enable it the same way:
