Skip to content

feat(tracing): export traces over OTLP with libdatadog - #6152

Draft
bm1549 wants to merge 3 commits into
masterfrom
brian.marks/native-otlp-trace-export
Draft

feat(tracing): export traces over OTLP with libdatadog#6152
bm1549 wants to merge 3 commits into
masterfrom
brian.marks/native-otlp-trace-export

Conversation

@bm1549

@bm1549 bm1549 commented Aug 5, 2026

Copy link
Copy Markdown
Collaborator

What does this PR do?

Concise implementation report

AI was used to help implement and review this change. I read and verified the resulting code.

Adds OTLP trace export for spans created by datadog, using the native libdatadog trace exporter. OTEL_TRACES_EXPORTER=otlp selects the path, with trace-specific endpoint, headers, timeout, and protocol settings taking precedence over the general OTLP settings.

Both http/json and http/protobuf are supported. Custom writers and synchronous test mode keep their existing flush behavior; native OTLP export sends complete local traces. Unsupported native platforms fail closed instead of sending traces to another destination.

Motivation:

dd-trace-py already reuses libdatadog for OTLP trace export. This brings the same transport shape to Ruby while sharing libdatadog's encoding and HTTP pipeline. The transport boundary can accept another protocol later without adding gRPC in this PR.

Change log entry

Yes. Export Datadog spans over OTLP HTTP with JSON or protobuf by setting OTEL_TRACES_EXPORTER=otlp.

Additional Notes:

This draft depends on the companion libdatadog C API change and a libdatadog package containing that API. Shared test activation is in system-tests #7458. Span links, span events, and structured metadata retain the documented native-transport limitations.

How to test the change?

  • bundle exec rake standard
  • bundle exec rake steep:check
  • native transport Rake suite against the locally generated libdatadog package — 135 passed
  • focused component specs — 52 passed
  • sdk-backend-verify with HTTP/protobuf — the header-enforcing proxy accepted the application batches and the backend returned the expected service metadata and 128-bit trace IDs

bm1549 and others added 3 commits August 4, 2026 22:33
Resolve every current Ruby appraisal and the YARD bundle to the published v38 packages. Refresh existing checksum entries while preserving newer dependency locks from master.
@bm1549 bm1549 added the AI Generated Largely based on code generated by an AI or LLM. This label is the same across all dd-trace-* repos label Aug 5, 2026
@dd-octo-sts dd-octo-sts Bot added core Involves Datadog core libraries tracing otel OpenTelemetry-related changes labels Aug 5, 2026
@dd-octo-sts

dd-octo-sts Bot commented Aug 5, 2026

Copy link
Copy Markdown
Contributor

Typing analysis

Note: Ignored files are excluded from the next sections.

Untyped methods

This PR introduces 2 partially typed methods, and clears 3 partially typed methods. It increases the percentage of typed methods from 69.43% to 69.62% (+0.19%).

Partially typed methods (+2-3)Introduced:
sig/datadog/opentelemetry/configuration/settings.rbs:55
└── def headers: () -> ::Hash[untyped, untyped]?
sig/datadog/opentelemetry/configuration/settings.rbs:73
└── def headers: () -> ::Hash[untyped, untyped]?
Cleared:
sig/datadog/opentelemetry/configuration/settings.rbs:33
└── def headers: () -> ::Hash[untyped, untyped]
sig/datadog/opentelemetry/configuration/settings.rbs:53
└── def headers: () -> ::Hash[untyped, untyped]?
sig/datadog/opentelemetry/configuration/settings.rbs:71
└── def headers: () -> ::Hash[untyped, untyped]?

If you believe a method or an attribute is rightfully untyped or partially typed, you can add # untyped:accept on the line before the definition to remove it from the stats.

@datadog-datadog-prod-us1-2

datadog-datadog-prod-us1-2 Bot commented Aug 5, 2026

Copy link
Copy Markdown

Pipelines  Tests

Unblock PR with BitsAI

⚠️ Warnings

🚦 83 Pipeline jobs failed

Build gem | Test gem (dev)   View in Datadog   GitHub Actions

🔧 Fix in code. This looks caused by changes in this PR. Error installing gem due to implicit declaration of function 'ddog_trace_exporter_config_add_otlp_header' causing compilation failure in trace_exporter.c.

Build gem | Test gem (final)   View in Datadog   GitHub Actions

🔧 Fix in code. This looks caused by changes in this PR. Compilation error in trace_exporter.c:216:16: implicit declaration of function ‘ddog_trace_exporter_config_add_otlp_header’.

Check Pull Request CI Status | all-jobs-are-green   View in Datadog   GitHub Actions

🔧 Fix in code. This looks caused by changes in this PR. 78 failed tests across various Ruby versions and configurations.

View all 83 failed jobs.

📋 Copy prompt for your agent
CI on my pull request is failing. Help me find and fix the root cause of each failing job below — they were flagged as caused by changes in this PR, so focus on the diff. For each job, explain the failure and propose a fix.

Branch: brian.marks/native-otlp-trace-export

Build gem | Test gem (dev)
Commit: 685f37d92360c8ce0b3807a703bfc052bccec408
Error (code / build):
Error installing gem due to implicit declaration of function 'ddog_trace_exporter_config_add_otlp_header' causing compilation failure in trace_exporter.c.
CI job: https://github.com/DataDog/dd-trace-rb/actions/runs/30969970786/job/92192027457

Build gem | Test gem (final)
Commit: 685f37d92360c8ce0b3807a703bfc052bccec408
Error (code / build):
Compilation error in trace_exporter.c:216:16: implicit declaration of function ‘ddog_trace_exporter_config_add_otlp_header’.
CI job: https://github.com/DataDog/dd-trace-rb/actions/runs/30969970786/job/92192027447

Check Pull Request CI Status | all-jobs-are-green
Commit: 685f37d92360c8ce0b3807a703bfc052bccec408
Error (code / test):
78 failed tests across various Ruby versions and configurations.
CI job: https://github.com/DataDog/dd-trace-rb/actions/runs/30969970725/job/92191974218

Plus 61 more failing jobs not shown here.

🧪 6 Tests failed in 1 job

Unit Tests | junit   GitHub Actions

All test failures are known flaky — job may pass on retry.

❄️ Known flaky: Kafka Data Streams instrumentation checkpointing automatically processes pathway context when consuming messages from rspec   View in Datadog
Libdatadog does not seem to be available: LoadError: cannot load such file -- libdatadog_api.3.4_x86_64-linux. Try running \`bundle exec rake clean compile\` before running this test.

Failure/Error:
  raise "Libdatadog does not seem to be available: #{Datadog::Core::LIBDATADOG_API_FAILURE}. " \
    "Try running \`bundle exec rake clean compile\` before running this test."

RuntimeError:
  Libdatadog does not seem to be available: LoadError: cannot load such file -- libdatadog_api.3.4_x86_64-linux. Try running \`bundle exec rake clean compile\` before running this test.
./spec/support/core_helpers.rb:83:in 'CoreHelpers#skip_if_libdatadog_not_supported'
./spec/datadog/tracing/contrib/kafka/data_streams_spec.rb:80:in 'block (3 levels) in <top (required)>'
...

Not introduced in this PR.

❄️ Known flaky: Kafka Data Streams instrumentation pathway context automatically injects pathway context when producing messages from rspec   View in Datadog
Libdatadog does not seem to be available: LoadError: cannot load such file -- libdatadog_api.3.4_x86_64-linux. Try running \`bundle exec rake clean compile\` before running this test.

Failure/Error:
  raise "Libdatadog does not seem to be available: #{Datadog::Core::LIBDATADOG_API_FAILURE}. " \
    "Try running \`bundle exec rake clean compile\` before running this test."

RuntimeError:
  Libdatadog does not seem to be available: LoadError: cannot load such file -- libdatadog_api.3.4_x86_64-linux. Try running \`bundle exec rake clean compile\` before running this test.
./spec/support/core_helpers.rb:83:in 'CoreHelpers#skip_if_libdatadog_not_supported'
./spec/datadog/tracing/contrib/kafka/data_streams_spec.rb:32:in 'block (3 levels) in <top (required)>'
...

Not introduced in this PR.

View all failed tests

ℹ️ Info

No other issues found (see more)

❄️ No new flaky tests detected

Useful? React with 👍 / 👎

This comment will be updated automatically if new data arrives.
🔗 Commit SHA: 685f37d | Docs | Datadog PR Page | Give us feedback!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

AI Generated Largely based on code generated by an AI or LLM. This label is the same across all dd-trace-* repos core Involves Datadog core libraries otel OpenTelemetry-related changes tracing

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants