---
title: Configuring the C++ Tracing Library
description: Datadog, the leading service for cloud-scale monitoring.
breadcrumbs: >-
  Docs > APM > Application Instrumentation > Configure the Datadog Tracing
  Library > Configuring the C++ Tracing Library
---

# 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](https://docs.datadoghq.com/getting_started/tagging/unified_service_tagging/).
To verify your runtime configuration and confirm settings, view the current configuration of your service in Datadog. Navigate to the **APM Service Page**, click **Service Config**, and select the **SDK Configuration** tab.
It is recommended to use `DD_SERVICE`, `DD_ENV`, and `DD_VERSION` to set `env`, `service` and `version` for your services. Refer to the [Unified Service Tagging](https://docs.datadoghq.com/getting_started/tagging/unified_service_tagging/) docummentation recommendations on which value to set for environment variables.

## Environment variables{% #environment-variables %}

To configure the tracer using environment variables, set the variables before launching the instrumented application.

### Unified service tagging{% #unified-service-tagging %}

{% dl %}

{% dt %}
`DD_SERVICE`
{% /dt %}

{% dd %}
**Since**: v0.1.0Sets the service name.
{% /dd %}

{% dt %}
`DD_ENV`
{% /dt %}

{% dd %}
**Since**: v0.1.0**Example**: `prod`, `pre-prod`, or `staging`Adds the `env` tag with the specified value to all generated spans.
{% /dd %}

{% dt %}
`DD_VERSION`
{% /dt %}

{% dd %}
**Since**: v0.1.0**Example**: `1.2.3`, `6c44da20`, `2020.02.13`Sets the version of the service.
{% /dd %}

{% /dl %}

### Traces{% #traces %}

{% dl %}

{% dt %}
`DD_TRACE_ENABLED`
{% /dt %}

{% dd %}
**Since**: 0.1.0**Default**: `true`Submit or not traces to the Datadog Agent.When `false`, the library stop sending traces to the Datadog Agent. However, the library continues to generate traces, report telemetry and poll for remote configuration updates.See also [DD_APM_TRACING_ENABLED](https://docs.datadoghq.com/tracing/trace_collection/library_config/#traces).
{% /dd %}

{% dt %}
`DD_TRACE_AGENT_PORT`
{% /dt %}

{% dd %}
**Since**: v0.1.0**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. If the [Agent configuration](https://docs.datadoghq.com/agent/configuration/network/#configure-ports) sets `receiver_port` or `DD_APM_RECEIVER_PORT` to something other than the default `8126`, then `DD_TRACE_AGENT_PORT` or `DD_TRACE_AGENT_URL` must match it.
{% /dd %}

{% dt %}
`DD_TRACE_AGENT_URL`
{% /dt %}

{% dd %}
**Since**: v0.1.0**Default**: `http://<DD_AGENT_HOST>:<DD_TRACE_AGENT_PORT>` if they are set, or `http://localhost:8126`. **Examples**:HTTP URL: `http://localhost:8126`Unix Domain Socket: `unix:///var/run/datadog/apm.socket`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.If the [Agent configuration](https://docs.datadoghq.com/agent/configuration/network/#configure-ports) sets `receiver_port` or `DD_APM_RECEIVER_PORT` to something other than the default `8126`, then `DD_TRACE_AGENT_PORT` or `DD_TRACE_AGENT_URL` must match it.
{% /dd %}

{% dt %}
`DD_TRACE_RATE_LIMIT`
{% /dt %}

{% dd %}
**Since**: 0.1.0**Default**: `200`Maximum number of traces allowed to be submitted per second.
{% /dd %}

{% dt %}
`DD_SPAN_SAMPLING_RULES_FILE`
{% /dt %}

{% dd %}
**Since**: 0.1.0Points to a JSON file that contains the span sampling rules. See `DD_SPAN_SAMPLING_RULES` for the rule format.
{% /dd %}

{% dt %}
`DD_TRACE_REPORT_HOSTNAME`
{% /dt %}

{% dd %}
**Since**: 0.1.0**Default**: `false`Adds the `hostname` tag with the result of `gethostname`.
{% /dd %}

{% dt %}
`DD_TRACE_STARTUP_LOGS`
{% /dt %}

{% dd %}
**Since**: 0.1.0**Default**: `true`Log the tracer configuration once the tracer is fully initialized.
{% /dd %}

{% dt %}
`DD_TRACE_128_BIT_TRACEID_GENERATION_ENABLED`
{% /dt %}

{% dd %}
**Since**: 0.1.6**Default**: `true`If `true`, the tracer will generate 128-bit trace IDs.If `false`, the tracer will generate legacy 64-bit trace IDs.
{% /dd %}

{% dt %}
`DD_REMOTE_CONFIGURATION_ENABLED`
{% /dt %}

{% dd %}
**Since**: 0.2.0**Default**: `true`Enable the capability that allows to remotely configure and change the behavior of the tracer.When `false` this feature is disabled.For more information, see [Remote Configuration](https://docs.datadoghq.com/remote_configuration).
{% /dd %}

{% dt %}
`DD_REMOTE_CONFIG_POLL_INTERVAL_SECONDS`
{% /dt %}

{% dd %}
**Since**: 0.2.0**Default**: `5.0`Sets how often, in seconds, the Datadog Agent is queried for Remote Configuration updates.
{% /dd %}

{% dt %}
`DD_TRACE_DELEGATE_SAMPLING`
{% /dt %}

{% dd %}
**Version**: 0.2.0**Default**: `false`If `true`, delegate trace sampling decision to a child service and prefer the resulting decision over its own, if appropriate.
{% /dd %}

{% /dl %}

### Agent{% #agent %}

{% dl %}

{% dt %}
`DD_TAGS`
{% /dt %}

{% dd %}
**Since**: v0.1.0**Example**: `team:intake,layer:api,foo:bar`A comma separated list of `key:value` pairs to be added to all generated spans.
{% /dd %}

{% dt %}
`DD_AGENT_HOST`
{% /dt %}

{% dd %}
**Since**: v0.1.0**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 %}

{% dt %}
`DD_INSTRUMENTATION_TELEMETRY_ENABLED`
{% /dt %}

{% dd %}
**Since**: 0.1.12**Default**: `true`Datadog may collect [environmental and diagnostic information about your system](https://docs.datadoghq.com/tracing/configure_data_security#telemetry-collection) to improve the product. When `false`, telemetry data are not collected.
{% /dd %}

{% /dl %}

### Trace context propagation{% #trace-context-propagation %}

{% dl %}

{% dt %}
`DD_PROPAGATION_STYLE`
{% /dt %}

{% dd %}
**Since**: 0.1.0Comma separated list of propagation styles to use when extracting and injecting tracing context.When multiple values are given, the order of matching is based on the order of values.
{% /dd %}

{% dt %}
`DD_TRACE_PROPAGATION_STYLE_INJECT`
{% /dt %}

{% dd %}
**Since**: v0.1.6**Default**: `datadog,tracecontext,baggage`**Accepted values**: `datadog`, `tracecontext`, `b3`, `baggage`Comma separated list of propagation styles to use when injecting tracing context. When multiple values are given, the order of matching is based on the order of values.
{% /dd %}

{% dt %}
`DD_TRACE_PROPAGATION_STYLE_EXTRACT`
{% /dt %}

{% dd %}
**Since**: v0.1.6**Default**: `datadog,tracecontext,baggage`**Accepted values**: `datadog`, `tracecontext`, `b3`, `baggage`Comma separated list of propagation styles to use when extracting tracing context. When multiple values are given, the order of matching is based on the order of values.
{% /dd %}

{% /dl %}

## Further Reading{% #further-reading %}

- [Source code](https://github.com/DataDog/dd-trace-cpp)
- [Explore your services, resources and traces](https://docs.datadoghq.com/tracing/glossary/)
- [Propagating trace context](https://docs.datadoghq.com/tracing/trace_collection/trace_context_propagation/)
