dd-trace
    Preparing search index...

    Interface TracerOptions

    List of options available to the tracer.

    interface TracerOptions {
        apmTracingEnabled?: boolean;
        appsec?:
            | boolean
            | {
                apiSecurity?: {
                    enabled?: boolean;
                    endpointCollectionEnabled?: boolean;
                    endpointCollectionMessageLimit?: number;
                };
                blockedTemplateGraphql?: string;
                blockedTemplateHtml?: string;
                blockedTemplateJson?: string;
                enabled?: boolean;
                eventTracking?: {
                    mode?: | "disabled"
                    | "anonymous"
                    | "anon"
                    | "safe"
                    | "identification"
                    | "ident"
                    | "extended";
                };
                extendedHeadersCollection?: {
                    enabled: boolean;
                    maxHeaders: number;
                    redaction: boolean;
                };
                obfuscatorKeyRegex?: string;
                obfuscatorValueRegex?: string;
                rasp?: { bodyCollection?: boolean; enabled?: boolean };
                rateLimit?: number;
                rules?: string;
                stackTrace?: {
                    enabled?: boolean;
                    maxDepth?: number;
                    maxStackTraces?: number;
                };
                wafTimeout?: number;
            };
        clientIpEnabled?: boolean;
        clientIpHeader?: string;
        cloudPayloadTagging?: {
            maxDepth?: number;
            request?: string;
            response?: string;
        };
        codeOriginForSpans?: { enabled?: boolean };
        dbmPropagationMode?: "full" | "service" | "disabled";
        dogstatsd?: { hostname?: string; port?: number };
        env?: string;
        experimental?: {
            aiguard?: {
                enabled?: boolean;
                endpoint?: string;
                maxContentSize?: number;
                maxMessagesLength?: number;
                timeout?: number;
            };
            appsec?: { standalone?: { enabled?: boolean } };
            b3?: boolean;
            enableGetRumData?: boolean;
            exporter?: "log" | "agent" | "datadog";
            iast?: boolean | IastOptions;
            runtimeId?: boolean;
            traceparent?: boolean;
        };
        flushInterval?: number;
        flushMinSpans?: number;
        hostname?: string;
        iast?: boolean
        | IastOptions;
        llmobs?: LLMObsEnableOptions;
        logger?: {
            debug: (message: string) => void;
            error: (err: string | Error) => void;
            info: (message: string) => void;
            warn: (message: string) => void;
        };
        logInjection?: boolean;
        logLevel?: "error"
        | "debug";
        lookup?: LookupFunction;
        orphanable?: boolean;
        plugins?: boolean;
        port?: string | number;
        profiling?: boolean;
        propagationStyle?: string[] | PropagationStyle;
        protocolVersion?: string;
        rateLimit?: number;
        remoteConfig?: { pollInterval?: number };
        reportHostname?: boolean;
        runtimeMetrics?:
            | boolean
            | { enabled?: boolean; eventLoop?: boolean; gc?: boolean };
        sampleRate?: number;
        samplingRules?: SamplingRule[];
        scope?:
            | "async_hooks"
            | "async_local_storage"
            | "async_resource"
            | "sync"
            | "noop";
        service?: string;
        serviceMapping?: { [key: string]: string };
        spanSamplingRules?: SpanSamplingRule[];
        startupLogs?: boolean;
        tags?: { [key: string]: any };
        url?: string;
        version?: string;
    }
    Index

    Properties

    apmTracingEnabled?: boolean

    Used to disable APM Tracing when using standalone products

    true
    
    appsec?:
        | boolean
        | {
            apiSecurity?: {
                enabled?: boolean;
                endpointCollectionEnabled?: boolean;
                endpointCollectionMessageLimit?: number;
            };
            blockedTemplateGraphql?: string;
            blockedTemplateHtml?: string;
            blockedTemplateJson?: string;
            enabled?: boolean;
            eventTracking?: {
                mode?: | "disabled"
                | "anonymous"
                | "anon"
                | "safe"
                | "identification"
                | "ident"
                | "extended";
            };
            extendedHeadersCollection?: {
                enabled: boolean;
                maxHeaders: number;
                redaction: boolean;
            };
            obfuscatorKeyRegex?: string;
            obfuscatorValueRegex?: string;
            rasp?: { bodyCollection?: boolean; enabled?: boolean };
            rateLimit?: number;
            rules?: string;
            stackTrace?: {
                enabled?: boolean;
                maxDepth?: number;
                maxStackTraces?: number;
            };
            wafTimeout?: number;
        }

    Configuration of the AppSec protection. Can be a boolean as an alias to appsec.enabled.

    Type Declaration

    • boolean
    • {
          apiSecurity?: {
              enabled?: boolean;
              endpointCollectionEnabled?: boolean;
              endpointCollectionMessageLimit?: number;
          };
          blockedTemplateGraphql?: string;
          blockedTemplateHtml?: string;
          blockedTemplateJson?: string;
          enabled?: boolean;
          eventTracking?: {
              mode?: | "disabled"
              | "anonymous"
              | "anon"
              | "safe"
              | "identification"
              | "ident"
              | "extended";
          };
          extendedHeadersCollection?: {
              enabled: boolean;
              maxHeaders: number;
              redaction: boolean;
          };
          obfuscatorKeyRegex?: string;
          obfuscatorValueRegex?: string;
          rasp?: { bodyCollection?: boolean; enabled?: boolean };
          rateLimit?: number;
          rules?: string;
          stackTrace?: {
              enabled?: boolean;
              maxDepth?: number;
              maxStackTraces?: number;
          };
          wafTimeout?: number;
      }
      • OptionalapiSecurity?: {
            enabled?: boolean;
            endpointCollectionEnabled?: boolean;
            endpointCollectionMessageLimit?: number;
        }

        Configuration for Api Security

        • Optionalenabled?: boolean

          Whether to enable Api Security.

          true
          
        • OptionalendpointCollectionEnabled?: boolean

          Whether to enable endpoint collection for API Security.

          true
          
        • OptionalendpointCollectionMessageLimit?: number

          Maximum number of endpoints that can be serialized per message.

          300
          
      • OptionalblockedTemplateGraphql?: string

        Specifies a path to a custom blocking template json file for graphql requests

      • OptionalblockedTemplateHtml?: string

        Specifies a path to a custom blocking template html file.

      • OptionalblockedTemplateJson?: string

        Specifies a path to a custom blocking template json file.

      • Optionalenabled?: boolean

        Whether to enable AppSec.

        false
        
      • OptionaleventTracking?: {
            mode?:
                | "disabled"
                | "anonymous"
                | "anon"
                | "safe"
                | "identification"
                | "ident"
                | "extended";
        }

        Controls the automated user event tracking configuration

        • Optionalmode?:
              | "disabled"
              | "anonymous"
              | "anon"
              | "safe"
              | "identification"
              | "ident"
              | "extended"

          Controls the automated user tracking mode for user IDs and logins collections. Possible values:

          • 'anonymous': will hash user IDs and user logins before collecting them

          • 'anon': alias for 'anonymous'

          • 'safe': deprecated alias for 'anonymous'

          • 'identification': will collect user IDs and logins without redaction

          • 'ident': alias for 'identification'

          • 'extended': deprecated alias for 'identification'

          • 'disabled': will not collect user IDs and logins

          Unknown values will be considered as 'disabled'

          'identification'
          
      • OptionalextendedHeadersCollection?: { enabled: boolean; maxHeaders: number; redaction: boolean }

        Configuration for extended headers collection tied to security events

        • enabled: boolean

          Whether to enable extended headers collection

          false
          
        • maxHeaders: number

          Specifies the maximum number of headers collected.

          50
          
        • redaction: boolean

          Whether to redact collected headers

          true
          
      • OptionalobfuscatorKeyRegex?: string

        Specifies a regex that will redact sensitive data by its key in attack reports.

      • OptionalobfuscatorValueRegex?: string

        Specifies a regex that will redact sensitive data by its value in attack reports.

      • Optionalrasp?: { bodyCollection?: boolean; enabled?: boolean }

        Configuration for RASP

        • OptionalbodyCollection?: boolean

          Whether to enable request body collection on RASP event

          false
          
        • Optionalenabled?: boolean

          Whether to enable RASP.

          false
          
      • OptionalrateLimit?: number

        Controls the maximum amount of traces sampled by AppSec attacks, per second.

        100
        
      • Optionalrules?: string

        Specifies a path to a custom rules file.

      • OptionalstackTrace?: { enabled?: boolean; maxDepth?: number; maxStackTraces?: number }

        Configuration for stack trace reporting

        • Optionalenabled?: boolean

          Whether to enable stack trace reporting.

          true
          
        • OptionalmaxDepth?: number

          Specifies the maximum depth of a stack trace to be reported.

          32
          
        • OptionalmaxStackTraces?: number

          Specifies the maximum number of stack traces to be reported.

          2
          
      • OptionalwafTimeout?: number

        Controls the maximum amount of time in microseconds the WAF is allowed to run synchronously for.

        5000
        
    clientIpEnabled?: boolean

    Whether to enable client IP collection from relevant IP headers

    false
    
    clientIpHeader?: string

    Custom header name to source the http.client_ip tag from.

    cloudPayloadTagging?: { maxDepth?: number; request?: string; response?: string }

    Cloud payload report as tags

    Type Declaration

    • OptionalmaxDepth?: number

      Maximum depth of payload traversal for tags

    • Optionalrequest?: string

      Additional JSONPath queries to replace with redacted in request payloads Undefined or invalid JSONPath queries disable the feature for requests.

    • Optionalresponse?: string

      Additional JSONPath queries to replace with redacted in response payloads Undefined or invalid JSONPath queries disable the feature for responses.

    codeOriginForSpans?: { enabled?: boolean }

    Configuration for Code Origin for Spans.

    Type Declaration

    • Optionalenabled?: boolean

      Whether to enable Code Origin for Spans.

      true
      
    dbmPropagationMode?: "full" | "service" | "disabled"

    Enables DBM to APM link using tag injection.

    'disabled'
    
    dogstatsd?: { hostname?: string; port?: number }

    Options specific for the Dogstatsd agent.

    Type Declaration

    • Optionalhostname?: string

      The hostname of the Dogstatsd agent that the metrics will submitted to.

    • Optionalport?: number

      The port of the Dogstatsd agent that the metrics will submitted to.

      8125
      
    env?: string

    Set an application’s environment e.g. prod, pre-prod, stage.

    experimental?: {
        aiguard?: {
            enabled?: boolean;
            endpoint?: string;
            maxContentSize?: number;
            maxMessagesLength?: number;
            timeout?: number;
        };
        appsec?: { standalone?: { enabled?: boolean } };
        b3?: boolean;
        enableGetRumData?: boolean;
        exporter?: "log" | "agent" | "datadog";
        iast?: boolean | IastOptions;
        runtimeId?: boolean;
        traceparent?: boolean;
    }

    Experimental features can be enabled individually using key / value pairs.

    Type Declaration

    • Optionalaiguard?: {
          enabled?: boolean;
          endpoint?: string;
          maxContentSize?: number;
          maxMessagesLength?: number;
          timeout?: number;
      }
      • Optionalenabled?: boolean

        Set to true to enable the SDK.

      • Optionalendpoint?: string

        URL of the AI Guard REST API.

      • OptionalmaxContentSize?: number

        Max size of the content property set in the meta-struct

      • OptionalmaxMessagesLength?: number

        Maximum number of conversational messages allowed to be set in the meta-struct

      • Optionaltimeout?: number

        Timeout used in calls to the AI Guard REST API in milliseconds (default 5000)

    • Optionalappsec?: { standalone?: { enabled?: boolean } }
      • Optionalstandalone?: { enabled?: boolean }

        Configuration of Standalone ASM mode Deprecated in favor of apmTracingEnabled.

        • Optionalenabled?: boolean

          Whether to enable Standalone ASM.

          false
          
    • Optionalb3?: boolean
    • OptionalenableGetRumData?: boolean

      Whether to enable the experimental getRumData method.

      false
      
    • Optionalexporter?: "log" | "agent" | "datadog"

      Whether to write traces to log output or agentless, rather than send to an agent

      false
      
    • Optionaliast?: boolean | IastOptions

      Configuration of the IAST. Can be a boolean as an alias to iast.enabled.

    • OptionalruntimeId?: boolean

      Whether to add an auto-generated runtime-id tag to metrics.

      false
      
    • Optionaltraceparent?: boolean
    {}
    
    flushInterval?: number

    Interval in milliseconds at which the tracer will submit traces to the agent.

    2000
    
    flushMinSpans?: number

    Number of spans before partially exporting a trace. This prevents keeping all the spans in memory for very large traces.

    1000
    
    hostname?: string

    The address of the trace agent that the tracer will submit to.

    '127.0.0.1'
    
    iast?: boolean | IastOptions

    Configuration of the IAST. Can be a boolean as an alias to iast.enabled.

    Configuration enabling LLM Observability. Enablement is superseded by the DD_LLMOBS_ENABLED environment variable.

    logger?: {
        debug: (message: string) => void;
        error: (err: string | Error) => void;
        info: (message: string) => void;
        warn: (message: string) => void;
    }

    Custom logger to be used by the tracer (if debug = true), should support error(), warn(), info(), and debug() methods see https://datadog.github.io/dd-trace-js/#custom-logging

    logInjection?: boolean

    Whether to enable trace ID injection in log records to be able to correlate traces with logs.

    false
    
    logLevel?: "error" | "debug"

    A string representing the minimum tracer log level to use when debug logging is enabled

    'debug'
    
    lookup?: LookupFunction

    Custom function for DNS lookups when sending requests to the agent.

    dns.lookup()
    
    orphanable?: boolean

    If false, require a parent in order to trace.

    true
    

    since version 4.0

    plugins?: boolean

    Whether to load all built-in plugins.

    true
    
    port?: string | number

    The port of the trace agent that the tracer will submit to.

    8126
    
    profiling?: boolean

    Whether to enable profiling.

    propagationStyle?: string[] | PropagationStyle

    The selection and priority order of context propagation injection and extraction mechanisms.

    protocolVersion?: string

    Protocol version to use for requests to the agent. The version configured must be supported by the agent version installed or all traces will be dropped.

    0.4
    
    rateLimit?: number

    Global rate limit that is applied on the global sample rate and all rules, and controls the ingestion rate limit between the agent and the backend. Defaults to deferring the decision to the agent.

    remoteConfig?: { pollInterval?: number }

    Configuration of ASM Remote Configuration

    Type Declaration

    • OptionalpollInterval?: number

      Specifies the remote configuration polling interval in seconds

      5
      
    reportHostname?: boolean

    Whether to report the hostname of the service host. This is used when the agent is deployed on a different host and cannot determine the hostname automatically.

    false
    
    runtimeMetrics?:
        | boolean
        | { enabled?: boolean; eventLoop?: boolean; gc?: boolean }

    Whether to enable runtime metrics, or an object specifying whether to enable specific metric types.

    false
    
    sampleRate?: number

    Controls the ingestion sample rate (between 0 and 1) between the agent and the backend.

    samplingRules?: SamplingRule[]

    Sampling rules to apply to priority sampling. Each rule is a JSON, consisting of service and name, which are regexes to match against a trace's service and name, and a corresponding sampleRate. If not specified, will defer to global sampling rate for all spans.

    []
    
    scope?:
        | "async_hooks"
        | "async_local_storage"
        | "async_resource"
        | "sync"
        | "noop"

    Specifies which scope implementation to use. The default is to use the best implementation for the runtime. Only change this if you know what you are doing.

    service?: string

    The service name to be used for this program. If not set, the service name will attempted to be inferred from package.json

    serviceMapping?: { [key: string]: string }

    Provide service name mappings for each plugin.

    spanSamplingRules?: SpanSamplingRule[]

    Span sampling rules that take effect when the enclosing trace is dropped, to ingest single spans

    []
    
    startupLogs?: boolean

    Whether to enable startup logs.

    true
    
    tags?: { [key: string]: any }

    Global tags that should be assigned to every span.

    url?: string

    The url of the trace agent that the tracer will submit to. Takes priority over hostname and port, if set.

    version?: string

    The version number of the application. If not set, the version will attempted to be inferred from package.json.