Configuring the C++ Tracing Library

After you set up the tracing library with your code and configure the Agent to collect APM data, optionally configure the tracing library as desired, including setting up Unified Service Tagging.

Environment variables

DD_AGENT_HOST
Version: v0.3.6
Default: localhost
Sets the host where traces are sent (the host running the Agent). Can be a hostname or an IP address. Ignored if DD_TRACE_AGENT_URL is set.
DD_TRACE_AGENT_PORT
Version: v0.3.6
Default: 8126
Sets the port where traces are sent (the port where the Agent is listening for connections). Ignored if DD_TRACE_AGENT_URL is set.
DD_TRACE_AGENT_URL
Version: v1.1.4
Sets the URL endpoint where traces are sent. Overrides DD_AGENT_HOST and DD_TRACE_AGENT_PORT if set. This URL supports http, https and unix address schemes.
DD_ENV
Version: v1.0.0
If specified, adds the env tag with the specified value to all generated spans.
DD_SERVICE
Version: v1.1.4
If specified, sets the default service name. Otherwise, the service name must be provided via TracerOptions or JSON configuration.
DD_TRACE_ANALYTICS_ENABLED
Deprecated
Default: false
Enable App Analytics globally for the application.
DD_TRACE_ANALYTICS_SAMPLE_RATE
Deprecated
Sets the App Analytics sampling rate. Overrides DD_TRACE_ANALYTICS_ENABLED if set. A floating point number between 0.0 and 1.0.
DD_TRACE_SAMPLING_RULES
Version: v1.1.4
Default: [{"sample_rate": 1.0}]
A JSON array of objects. Each object must have a sample_rate, and the name and service fields are optional. The sample_rate value must be between 0.0 and 1.0 (inclusive). Rules are applied in configured order to determine the trace’s sample rate.
DD_SPAN_SAMPLING_RULES
Version: v1.3.3
Default: nil
A JSON array of objects. Rules are applied in configured order to determine the span’s sample rate. The sample_rate value must be between 0.0 and 1.0 (inclusive). For more information, see Ingestion Mechanisms.
Example:
  • Set the span sample rate to 50% for the service my-service and operation name http.request, up to 50 traces per second: '[{"service": "my-service", "name": "http.request", "sample_rate":0.5, "max_per_second": 50}]'
DD_VERSION
Version: v1.1.4
If specified, adds the version tag with the specified value to all generated spans.
DD_TAGS
Version: v1.1.4
If specified, will add tags to all generated spans. A comma-separated list of key:value pairs.
DD_PROPAGATION_STYLE_INJECT
Version: v0.4.1
Default: Datadog
Propagation style(s) to use when injecting tracing headers. Datadog, B3, or Datadog B3.
DD_PROPAGATION_STYLE_EXTRACT
Version: v0.4.1
Default: Datadog
Propagation style(s) to use when extracting tracing headers. Datadog, B3, or Datadog B3.

Further Reading

Additional helpful documentation, links, and articles: