• Public
  • Public/Protected
  • All

Interface TracerOptions

List of options available to the tracer.


  • TracerOptions



Optional appsec

appsec: boolean | { apiSecurity?: undefined | { enabled?: undefined | false | true; requestSampling?: undefined | number }; blockedTemplateGraphql?: undefined | string; blockedTemplateHtml?: undefined | string; blockedTemplateJson?: undefined | string; enabled?: undefined | false | true; eventTracking?: undefined | { mode?: "safe" | "extended" | "disabled" }; obfuscatorKeyRegex?: undefined | string; obfuscatorValueRegex?: undefined | string; rateLimit?: undefined | number; rules?: undefined | string; wafTimeout?: undefined | number }

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

Optional clientIpEnabled

clientIpEnabled: undefined | false | true

Whether to enable client IP collection from relevant IP headers



Optional clientIpHeader

clientIpHeader: undefined | string

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

Optional dbmPropagationMode

dbmPropagationMode: "disabled" | "service" | "full"

Enables DBM to APM link using tag injection.



Optional dogstatsd

dogstatsd: undefined | { hostname?: undefined | string; port?: undefined | number }

Options specific for the Dogstatsd agent.

Optional env

env: undefined | string

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

Optional experimental

experimental: undefined | { b3?: undefined | false | true; enableGetRumData?: undefined | false | true; exporter?: "log" | "agent" | "datadog"; iast?: boolean | { deduplicationEnabled?: undefined | false | true; enabled?: undefined | false | true; maxConcurrentRequests?: undefined | number; maxContextOperations?: undefined | number; redactionEnabled?: undefined | false | true; redactionNamePattern?: undefined | string; redactionValuePattern?: undefined | string; requestSampling?: undefined | number }; runtimeId?: undefined | false | true; traceparent?: undefined | false | true }

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



Optional flushInterval

flushInterval: undefined | number

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



Optional flushMinSpans

flushMinSpans: undefined | number

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



Optional hostname

hostname: undefined | string

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



Optional logInjection

logInjection: undefined | false | true

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



Optional logLevel

logLevel: "error" | "debug"

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



Optional logger

logger: undefined | { debug: (message: string) => void; error: (err: Error | string) => 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

Optional lookup

lookup: LookupFunction

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



Optional orphanable

orphanable: undefined | false | true

If false, require a parent in order to trace.




since version 4.0

Optional plugins

plugins: undefined | false | true

Whether to load all built-in plugins.



Optional port

port: number | string

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



Optional profiling

profiling: undefined | false | true

Whether to enable profiling.

Optional propagationStyle

propagationStyle: string[] | PropagationStyle

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

Optional protocolVersion

protocolVersion: undefined | 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.



Optional rateLimit

rateLimit: undefined | 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.

Optional remoteConfig

remoteConfig: undefined | { pollInterval?: undefined | number }

Configuration of ASM Remote Configuration

Optional reportHostname

reportHostname: undefined | false | true

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.



Optional runtimeMetrics

runtimeMetrics: undefined | false | true

Whether to enable runtime metrics.



Optional sampleRate

sampleRate: undefined | number

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

Optional samplingRules

samplingRules: SamplingRule[]

Sampling rules to apply to priority samplin. 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.



Optional scope

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.

Optional service

service: undefined | string

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

Optional serviceMapping

serviceMapping: undefined | {}

Provide service name mappings for each plugin.

Optional spanSamplingRules

spanSamplingRules: SpanSamplingRule[]

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



Optional startupLogs

startupLogs: undefined | false | true

Whether to enable startup logs.



Optional tags

tags: undefined | {}

Global tags that should be assigned to every span.

Optional url

url: undefined | string

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

Optional version

version: undefined | string

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

Generated using TypeDoc