After you set up the Rust SDK with your application, you can optionally configure it using the following environment variables.

Unified Service Tagging

It is recommended to use DD_ENV, DD_SERVICE, and DD_VERSION to set env, service, and version for your services.

DD_ENV
Default: (none)
Set the application’s environment, for example: prod, staging.
DD_SERVICE
Default: unnamed-rust-service
Sets the service name for your application.
DD_VERSION
Default: (none)
Set the application’s version, for example: 1.2.3 or 6c44da20.
DD_TAGS
Default: (none)
A list of default tags to be added to every span, in key:value format, separated by commas. Example: layer:api,team:intake.

Traces

DD_TRACE_ENABLED
Default: true
Set to false to disable tracing.
DD_TRACE_STATS_COMPUTATION_ENABLED
Default: true
Enable computation of trace statistics.
DD_TRACE_X_DATADOG_TAGS_MAX_LENGTH
Default: 512
Maximum length of the x-datadog-tags header in bytes.
DD_TRACE_PARTIAL_FLUSH_ENABLED
Default: false
Enable partial flushing of traces.
DD_TRACE_PARTIAL_FLUSH_MIN_SPANS
Default: 300
Minimum number of spans in a trace before partial flush is triggered.
DD_REMOTE_CONFIGURATION_ENABLED
Default: true
Enable or disable remote configuration. Also accepts the alias DD_REMOTE_CONFIG_ENABLED.
DD_REMOTE_CONFIG_POLL_INTERVAL_SECONDS
Default: 5.0
Interval in seconds for polling remote configuration updates.

Agent

DD_AGENT_HOST
Default: localhost
Sets the hostname of the Datadog Agent.
DD_TRACE_AGENT_PORT
Default: 8126
Sets the port of the Datadog Agent for trace collection.
DD_TRACE_AGENT_URL
Default: (none)
Sets the URL of the Datadog Agent. Example: http://localhost:8126. This takes precedence over DD_AGENT_HOST and DD_TRACE_AGENT_PORT.
DD_DOGSTATSD_HOST
Default: localhost
Sets the hostname for DogStatsD metric collection.
DD_DOGSTATSD_PORT
Default: 8125
Sets the port for DogStatsD metric collection.
DD_DOGSTATSD_URL
Default: (none)
Sets the URL for DogStatsD. This takes precedence over DD_DOGSTATSD_HOST and DD_DOGSTATSD_PORT.
DD_INSTRUMENTATION_TELEMETRY_ENABLED
Default: true
Enable or disable telemetry data collection and sending.
DD_TELEMETRY_HEARTBEAT_INTERVAL
Default: 60.0
Interval in seconds for sending telemetry heartbeat messages.
DD_TELEMETRY_LOG_COLLECTION_ENABLED
Default: true
Enable or disable log collection for telemetry.

Logging

DD_LOG_LEVEL
Default: ERROR
Sets the internal log level for the tracer. Valid values: DEBUG, INFO, WARN, ERROR.

Sampling

DD_TRACE_SAMPLING_RULES
Default: (none)
A JSON array of objects to apply for trace sampling. Each rule must have a sample_rate between 0.0 and 1.0 (inclusive).
DD_TRACE_RATE_LIMIT
Default: 100
Maximum number of traces to sample per second.

Trace context propagation

DD_TRACE_PROPAGATION_STYLE
Default: datadog,tracecontext
A comma-separated list of propagation styles to use for both extraction and injection. Supported values are datadog and tracecontext. See Propagating Rust Trace Context for more information.
DD_TRACE_PROPAGATION_STYLE_EXTRACT
Default: (none)
A comma-separated list of propagation styles to use for extraction. When set, this overrides DD_TRACE_PROPAGATION_STYLE for extraction.
DD_TRACE_PROPAGATION_STYLE_INJECT
Default: (none)
A comma-separated list of propagation styles to use for injection. When set, this overrides DD_TRACE_PROPAGATION_STYLE for injection.
DD_TRACE_PROPAGATION_EXTRACT_FIRST
Default: false
When set to true, stops extracting after the first successful trace context extraction.

Further reading