Interoperability of OpenTelemetry API and Datadog instrumented traces

Custom instrumentation with the OpenTelemetry API

Datadog tracing libraries provide an implementation of the OpenTelemetry API for instrumenting your code. This means you can maintain vendor-neutral instrumentation of all your services, while still taking advantage of Datadog’s native implementation, features, and products.

By instrumenting your code with OpenTelemetry API:

  • Your code remains free of vendor-specific API calls.
  • Your code does not depend on Datadog tracing libraries at compile time (only runtime).
  • Your code does not use the deprecated OpenTracing API.

Replace the OpenTelemetry SDK with the Datadog tracing library in the instrumented application, and the traces produced by your running code can be processed, analyzed, and monitored alongside Datadog traces and in Datadog proprietary products such as Continuous Profiler, Data Streams Monitoring, Application Security Management, and Live Processes.

W3C trace context propagation

To facilitate seamless handling of OpenTelemetry trace data within Datadog, and correlating it with trace data generated by Datadog instrumentation, the most recent versions of Datadog tracing libraries support both Datadog (datadog) and W3C (tracecontext) propagation styles by default. Update your runtime tracing library dependencies to the latest version.

This context propagation style allows Datadog tracers to operate in the same application environment with OpenTelemetry SDKs and other W3C compliant tracers.

128-bit trace IDs

W3C traces implicitly contain 128-bit trace IDs, rather than the 64-bit trace IDs that Datadog traces have historically used. The latest Datadog tracing libraries default configuration uses the setting DD_TRACE_128_BIT_TRACEID_GENERATION_ENABLED=True so that they also produce trace data with 128-bit trace IDs.

Following the W3C Trace Context recommendations, Datadog 128-bit trace IDs have randomness in the lower-order 64 bits. This restriction provides backward compatibility for systems that intermix libraries that generate 64-bit trace IDs with newer ones that support 128-bit IDs. In such systems, spans with the full 128-bit trace ID and spans with the truncated lower-order 64-bit trace ID can arrive at the backend and be treated as matching and part of the same trace.

128-bit Trace IDs can be passed with trace context to code whose tracing library generates 64-bit trace IDs, and Datadog successfully correlate them in the backend.

Further reading