Skip to content

feat(otel): add support for opentelemetry logs#3748

Open
rachelyangdog wants to merge 4 commits intomasterfrom
rachel.yang/otel-logs
Open

feat(otel): add support for opentelemetry logs#3748
rachelyangdog wants to merge 4 commits intomasterfrom
rachel.yang/otel-logs

Conversation

@rachelyangdog
Copy link
Copy Markdown
Contributor

@rachelyangdog rachelyangdog commented Mar 27, 2026

Description

Adds OpenTelemetry logs support to dd-trace-php, gated behind a new DD_LOGS_OTEL_ENABLED configuration flag.

New config flag: DD_LOGS_OTEL_ENABLED (default: false) enables OTel log collection and OTLP export. When enabled, Datadog's own log injection is suppressed so the two pipelines don't conflict.

  • CompositeResolver now handles logs signal endpoints and protocols alongside the existing metrics support. Endpoint/protocol resolution is refactored from metrics-specific to signal-agnostic

Reviewer checklist

  • Test coverage seems ok.
  • Appropriate labels assigned.

@rachelyangdog rachelyangdog requested review from a team as code owners March 27, 2026 20:42
@rachelyangdog rachelyangdog marked this pull request as draft March 27, 2026 20:42
@rachelyangdog rachelyangdog requested a review from bwoebi March 27, 2026 20:42
@codecov-commenter
Copy link
Copy Markdown

codecov-commenter commented Mar 27, 2026

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 68.78%. Comparing base (fd1ba67) to head (5e7dc32).

Additional details and impacted files

Impacted file tree graph

@@            Coverage Diff             @@
##           master    #3748      +/-   ##
==========================================
- Coverage   68.85%   68.78%   -0.08%     
==========================================
  Files         166      166              
  Lines       19015    19015              
  Branches     1792     1792              
==========================================
- Hits        13093    13079      -14     
- Misses       5111     5124      +13     
- Partials      811      812       +1     
Flag Coverage Δ
helper-rust-integration 78.82% <ø> (ø)
helper-rust-unit 49.36% <ø> (ø)

Flags with carried forward coverage won't be shown. Click here to find out more.
see 3 files with indirect coverage changes


Continue to review full report in Codecov by Sentry.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update fd1ba67...5e7dc32. Read the comment docs.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@datadog-prod-us1-5
Copy link
Copy Markdown

datadog-prod-us1-5 Bot commented Mar 27, 2026

Tests

Fix all issues with BitsAI or with Cursor

⚠️ Warnings

🧪 31 Tests failed

tests.appsec.test_automated_login_events.Test_V3_Login_Events_Blocking.test_login_event_blocking_auto_id[apache-mod-8.0] from system_tests_suite   View in Datadog   (Fix with Cursor)
AssertionError: assert 500 == 200
 +  where 500 = HttpResponse(status_code:500, headers:{'Date': 'Thu, 07 May 2026 19:52:27 GMT', 'Server': 'Apache/2.4.66 (Debian)', 'X...ed-By': 'PHP/8.0.18', 'Content-Length': '0', 'Connection': 'close', 'Content-Type': 'text/html; charset=UTF-8'}, text:).status_code
 +    where HttpResponse(status_code:500, headers:{'Date': 'Thu, 07 May 2026 19:52:27 GMT', 'Server': 'Apache/2.4.66 (Debian)', 'X...ed-By': 'PHP/8.0.18', 'Content-Length': '0', 'Connection': 'close', 'Content-Type': 'text/html; charset=UTF-8'}, text:) = <tests.appsec.test_automated_login_events.Test_V3_Login_Events_Blocking object at 0x7f1cd818eae0>.r_login

self = <tests.appsec.test_automated_login_events.Test_V3_Login_Events_Blocking object at 0x7f1cd818eae0>

    def test_login_event_blocking_auto_id(self):
>       assert self.r_login.status_code == 200
E       AssertionError: assert 500 == 200
E        +  where 500 = HttpResponse(status_code:500, headers:{'Date': 'Thu, 07 May 2026 19:52:27 GMT', 'Server': 'Apache/2.4.66 (Debian)', 'X...ed-By': 'PHP/8.0.18', 'Content-Length': '0', 'Connection': 'close', 'Content-Type': 'text/html; charset=UTF-8'}, text:).status_code
...
tests.appsec.test_automated_login_events.Test_V3_Login_Events_Blocking.test_login_event_blocking_auto_id[php-fpm-8.5] from system_tests_suite   View in Datadog   (Fix with Cursor)
AssertionError: assert 500 == 200
 +  where 500 = HttpResponse(status_code:500, headers:{'Date': 'Thu, 07 May 2026 19:51:58 GMT', 'Server': 'Apache/2.4.67 (Ubuntu)', 'X...red-By': 'PHP/8.5.5', 'Content-Length': '0', 'Connection': 'close', 'Content-Type': 'text/html; charset=UTF-8'}, text:).status_code
 +    where HttpResponse(status_code:500, headers:{'Date': 'Thu, 07 May 2026 19:51:58 GMT', 'Server': 'Apache/2.4.67 (Ubuntu)', 'X...red-By': 'PHP/8.5.5', 'Content-Length': '0', 'Connection': 'close', 'Content-Type': 'text/html; charset=UTF-8'}, text:) = <tests.appsec.test_automated_login_events.Test_V3_Login_Events_Blocking object at 0x7f76502d62d0>.r_login

self = <tests.appsec.test_automated_login_events.Test_V3_Login_Events_Blocking object at 0x7f76502d62d0>

    def test_login_event_blocking_auto_id(self):
>       assert self.r_login.status_code == 200
E       AssertionError: assert 500 == 200
E        +  where 500 = HttpResponse(status_code:500, headers:{'Date': 'Thu, 07 May 2026 19:51:58 GMT', 'Server': 'Apache/2.4.67 (Ubuntu)', 'X...red-By': 'PHP/8.5.5', 'Content-Length': '0', 'Connection': 'close', 'Content-Type': 'text/html; charset=UTF-8'}, text:).status_code
...
tests.appsec.test_automated_login_events.Test_V3_Login_Events_Blocking.test_login_event_blocking_auto_login[apache-mod-8.0] from system_tests_suite   View in Datadog   (Fix with Cursor)
AssertionError: assert 500 == 200
 +  where 500 = HttpResponse(status_code:500, headers:{'Date': 'Thu, 07 May 2026 19:52:55 GMT', 'Server': 'Apache/2.4.66 (Debian)', 'X...ed-By': 'PHP/8.0.18', 'Content-Length': '0', 'Connection': 'close', 'Content-Type': 'text/html; charset=UTF-8'}, text:).status_code
 +    where HttpResponse(status_code:500, headers:{'Date': 'Thu, 07 May 2026 19:52:55 GMT', 'Server': 'Apache/2.4.66 (Debian)', 'X...ed-By': 'PHP/8.0.18', 'Content-Length': '0', 'Connection': 'close', 'Content-Type': 'text/html; charset=UTF-8'}, text:) = <tests.appsec.test_automated_login_events.Test_V3_Login_Events_Blocking object at 0x7f1cd818f380>.r_login

self = <tests.appsec.test_automated_login_events.Test_V3_Login_Events_Blocking object at 0x7f1cd818f380>

    def test_login_event_blocking_auto_login(self):
>       assert self.r_login.status_code == 200
E       AssertionError: assert 500 == 200
E        +  where 500 = HttpResponse(status_code:500, headers:{'Date': 'Thu, 07 May 2026 19:52:55 GMT', 'Server': 'Apache/2.4.66 (Debian)', 'X...ed-By': 'PHP/8.0.18', 'Content-Length': '0', 'Connection': 'close', 'Content-Type': 'text/html; charset=UTF-8'}, text:).status_code
...
View all

ℹ️ Info

No other issues found (see more)

❄️ No new flaky tests detected

🎯 Code Coverage (details)
Patch Coverage: 100.00%
Overall Coverage: 60.71% (-0.00%)

Useful? React with 👍 / 👎

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

@pr-commenter
Copy link
Copy Markdown

pr-commenter Bot commented Mar 27, 2026

Benchmarks [ tracer ]

Benchmark execution time: 2026-05-07 20:37:08

Comparing candidate commit d0b32bc in PR branch rachel.yang/otel-logs with baseline commit 9fe0330 in branch master.

Found 3 performance improvements and 2 performance regressions! Performance is the same for 187 metrics, 2 unstable metrics.

scenario:EmptyFileBench/benchEmptyFileBaseline

  • 🟩 execution_time [-296.522µs; -89.518µs] or [-9.083%; -2.742%]

scenario:MessagePackSerializationBench/benchMessagePackSerialization

  • 🟩 execution_time [-8.746µs; -7.654µs] or [-7.765%; -6.796%]

scenario:MessagePackSerializationBench/benchMessagePackSerialization-opcache

  • 🟩 execution_time [-7.537µs; -5.683µs] or [-6.886%; -5.192%]

scenario:PDOBench/benchPDOOverheadWithDBM

  • 🟥 execution_time [+5.312µs; +7.758µs] or [+2.142%; +3.128%]

scenario:PHPRedisBench/benchRedisOverhead-opcache

  • 🟥 execution_time [+34.198µs; +47.533µs] or [+3.399%; +4.725%]

@rachelyangdog rachelyangdog marked this pull request as ready for review May 7, 2026 19:18
Copy link
Copy Markdown

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: d0b32bc04a

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment on lines +22 to +24
if ($name === 'OTEL_PHP_AUTOLOAD_ENABLED') {
return \dd_trace_env_config('DD_METRICS_OTEL_ENABLED')
|| \dd_trace_env_config('DD_LOGS_OTEL_ENABLED');
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge Prevent logs mode from enabling all OTel signals

When only DD_LOGS_OTEL_ENABLED=true is set, this makes OTEL_PHP_AUTOLOAD_ENABLED resolve to true, and the OpenTelemetry PHP autoloader initializes tracer, meter, and logger providers together. Because this resolver does not also force OTEL_TRACES_EXPORTER and OTEL_METRICS_EXPORTER to none, their SDK defaults remain otlp, so enabling Datadog's OTel logs mode can also start exporting traces and metrics for applications that did not opt into those signals.

Useful? React with 👍 / 👎.

@rachelyangdog rachelyangdog changed the title WIP: feat(otel): add support for opentelemetry logs feat(otel): add support for opentelemetry logs May 7, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants