Skip to main content
All configuration can be provided through environment variables. Programmatic options passed to init() always take precedence.

Core identity

VariableProgrammatic optionDescription
DD_SERVICEserviceService name. Inferred from package.json if not set.
DD_ENVenvEnvironment name (e.g., prod, staging).
DD_VERSIONversionApplication version. Inferred from package.json if not set.
DD_TAGStagsGlobal tags as comma-separated key:value pairs.

Agent connectivity

VariableProgrammatic optionDefaultDescription
DD_AGENT_HOSThostname127.0.0.1Hostname of the Datadog Agent.
DD_TRACE_AGENT_PORTport8126Port of the Datadog Agent.
DD_TRACE_AGENT_URLurlFull URL of the Agent. Overrides host/port.
DD_TRACE_AGENT_PROTOCOL_VERSIONprotocolVersion0.4Trace API protocol version.

Tracing behavior

VariableProgrammatic optionDefaultDescription
DD_TRACE_ENABLEDtrueMaster switch. Set to false to disable all tracing.
DD_APM_TRACING_ENABLEDapmTracingEnabledtrueEnable APM tracing (distinct from standalone AppSec).
DD_TRACE_FLUSH_INTERVALflushInterval2000Interval (ms) between trace flushes to the Agent.
DD_TRACE_PARTIAL_FLUSH_MIN_SPANSflushMinSpans1000Number of spans to trigger a partial trace flush.
DD_TRACE_REPORT_HOSTNAMEreportHostnamefalseAdd the hostname tag to all spans.
DD_TRACE_STARTUP_LOGSstartupLogsfalsePrint tracer configuration at startup.
DD_TRACE_LOG_LEVELlogLeveldebugLog level when debug logging is enabled.
DD_TRACE_HEADER_TAGSheaderTagsComma-separated HTTP headers to capture as span tags.
DD_SERVICE_MAPPINGserviceMappingOverride service names per plugin, e.g. pg:my-pg,redis:my-redis.
DD_TRACE_SPAN_ATTRIBUTE_SCHEMAv0Span attribute naming schema version (v0 or v1).
DD_TRACE_PROPAGATION_STYLEtracePropagationStyledatadog,tracecontextContext propagation styles (comma-separated).
DD_TRACE_PROPAGATION_STYLE_INJECTtracePropagationStyle.injectPropagation styles for injection only.
DD_TRACE_PROPAGATION_STYLE_EXTRACTtracePropagationStyle.extractPropagation styles for extraction only.
DD_TRACE_OBFUSCATION_QUERY_STRING_REGEXPRegex to obfuscate query string values in http.url tags.

Sampling

VariableProgrammatic optionDefaultDescription
DD_TRACE_SAMPLE_RATEsampleRateGlobal sample rate (0–1). Defers to Agent if not set.
DD_TRACE_RATE_LIMITrateLimitMaximum traces per second after sampling rules.
DD_TRACE_SAMPLING_RULESsamplingRules[]JSON array of sampling rules with service, name, sampleRate.
DD_SPAN_SAMPLING_RULESspanSamplingRules[]JSON array of span sampling rules for dropped traces.
DD_SPAN_SAMPLING_RULES_FILEspanSamplingRulesPath to a JSON file containing span sampling rules.

Log injection

VariableProgrammatic optionDefaultDescription
DD_LOGS_INJECTIONlogInjectionfalseInject trace IDs into log records.

Runtime metrics

VariableProgrammatic optionDefaultDescription
DD_RUNTIME_METRICS_ENABLEDruntimeMetricsfalseEnable runtime metrics collection.
DD_RUNTIME_METRICS_GC_ENABLEDruntimeMetrics.gcEnable garbage collection metrics.
DD_RUNTIME_METRICS_EVENT_LOOP_ENABLEDruntimeMetrics.eventLoopEnable event loop lag metrics.
DD_RUNTIME_METRICS_RUNTIME_ID_ENABLEDruntimeMetricsRuntimeIdfalseAdd runtime-id tag to runtime metrics.
DD_DOGSTATSD_HOSTdogstatsd.hostname127.0.0.1DogStatsD Agent hostname for runtime metrics.
DD_DOGSTATSD_PORTdogstatsd.port8125DogStatsD Agent port.

Profiling

VariableProgrammatic optionDefaultDescription
DD_PROFILING_ENABLEDprofilingfalseEnable continuous profiling.
DD_PROFILING_EXPORTERSagentProfiling data exporter.
DD_PROFILING_SOURCE_MAPtrueUse source maps in profiling output.

AppSec

VariableProgrammatic optionDefaultDescription
DD_APPSEC_ENABLEDappsec.enabledfalseEnable Application Security Monitoring.
DD_APPSEC_RULESappsec.rulesPath to a custom WAF rules JSON file.
DD_APPSEC_TRACE_RATE_LIMITappsec.rateLimit100Max AppSec attack traces per second.
DD_APPSEC_WAF_TIMEOUTappsec.wafTimeout5000Max WAF execution time in microseconds.
DD_APPSEC_OBFUSCATION_PARAMETER_KEY_REGEXPappsec.obfuscatorKeyRegexRegex to redact sensitive keys in attack reports.
DD_APPSEC_OBFUSCATION_PARAMETER_VALUE_REGEXPappsec.obfuscatorValueRegexRegex to redact sensitive values in attack reports.
DD_APPSEC_HTTP_BLOCKED_TEMPLATE_HTMLappsec.blockedTemplateHtmlPath to custom HTML block page template.
DD_APPSEC_HTTP_BLOCKED_TEMPLATE_JSONappsec.blockedTemplateJsonPath to custom JSON block response template.
DD_APPSEC_AUTO_USER_INSTRUMENTATION_MODEappsec.eventTracking.modeidentificationUser tracking mode: identification, anonymous, or disabled.
DD_APPSEC_RASP_ENABLEDappsec.rasp.enabledfalseEnable Runtime Application Self-Protection (RASP).
DD_APPSEC_STACK_TRACE_ENABLEDappsec.stackTrace.enabledtrueEnable stack trace reporting in AppSec events.
DD_APPSEC_MAX_STACK_TRACESappsec.stackTrace.maxStackTraces2Maximum number of stack traces per event.
DD_APPSEC_MAX_STACK_TRACE_DEPTHappsec.stackTrace.maxDepth32Maximum stack frame depth per trace.
DD_API_SECURITY_ENABLEDappsec.apiSecurity.enabledtrueEnable API Security schema collection.

IAST

VariableProgrammatic optionDefaultDescription
DD_IAST_ENABLEDiast.enabledfalseEnable IAST vulnerability detection.
DD_IAST_REQUEST_SAMPLING30Percentage of requests analyzed (0–100).
DD_IAST_MAX_CONCURRENT_REQUESTS2Max requests analyzed concurrently.
DD_IAST_REDACTION_ENABLEDtrueEnable redaction of sensitive values in vulnerability reports.
DD_IAST_DEDUPLICATION_ENABLEDtrueSuppress duplicate vulnerability reports.

Remote configuration

VariableProgrammatic optionDefaultDescription
DD_REMOTE_CONFIGURATION_ENABLEDtrueEnable Remote Configuration.
DD_REMOTE_CONFIG_POLL_INTERVAL_SECONDSremoteConfig.pollInterval5Seconds between Remote Config polls.

Data Streams and DBM

VariableProgrammatic optionDefaultDescription
DD_DATA_STREAMS_ENABLEDdsmEnabledfalseEnable Data Streams Monitoring.
DD_DBM_PROPAGATION_MODEdbmPropagationModedisabledDBM–APM link mode: disabled, service, or full.

Client IP

VariableProgrammatic optionDefaultDescription
DD_TRACE_CLIENT_IP_ENABLEDclientIpEnabledfalseCollect client IP from request headers.
DD_TRACE_CLIENT_IP_HEADERclientIpHeaderHeader name to read client IP from.

Code origin for spans

VariableProgrammatic optionDefaultDescription
DD_CODE_ORIGIN_FOR_SPANS_ENABLEDcodeOriginForSpans.enabledtrueAttach source code location to span metadata.

Dynamic instrumentation

VariableDescription
DD_DYNAMIC_INSTRUMENTATION_ENABLEDEnable Dynamic Instrumentation (live debugging).
DD_DYNAMIC_INSTRUMENTATION_PROBE_FILEPath to a file containing probe definitions.
DD_DYNAMIC_INSTRUMENTATION_REDACTED_IDENTIFIERSComma-separated variable names to redact from DI snapshots.

LLM Observability

VariableDescription
DD_LLMOBS_ENABLEDEnable LLM Observability.
DD_LLMOBS_ML_APPML application name for LLMObs grouping.
DD_LLMOBS_AGENTLESS_ENABLEDSubmit LLMObs data directly to the Datadog backend without an Agent.

OpenTelemetry compatibility

The following OTel environment variables are mapped to Datadog equivalents:
OTel variableDatadog equivalentNotes
OTEL_SERVICE_NAMEDD_SERVICE
OTEL_RESOURCE_ATTRIBUTESDD_TAGS
OTEL_TRACES_SAMPLERDD_TRACE_SAMPLE_RATEparentbased_traceidratio → sample rate
OTEL_TRACES_SAMPLER_ARGDD_TRACE_SAMPLE_RATEUsed together with OTEL_TRACES_SAMPLER
OTEL_PROPAGATORSDD_TRACE_PROPAGATION_STYLE
OTEL_LOG_LEVELDD_TRACE_LOG_LEVEL
OTEL_METRICS_EXPORTERDD_RUNTIME_METRICS_ENABLEDnone → disabled
OTEL_SDK_DISABLEDDD_TRACE_OTEL_ENABLED
If both an OTel variable and its Datadog equivalent are set, the Datadog variable takes precedence and a telemetry counter is incremented to track the conflict.

Crash tracking

VariableDefaultDescription
DD_CRASHTRACKING_ENABLEDtrue (non-serverless)Enable crash tracking. Automatically disabled in serverless environments.

Debugging

VariableDescription
DD_TRACE_DEBUGSet to true to enable debug logging to stdout/stderr.
DD_TRACE_STARTUP_LOGSSet to true to print tracer configuration at startup.
DD_TRACE_SPAN_LEAK_DEBUGEnable span leak detection (values: 0, 1, 2).

Build docs developers (and LLMs) love