Skip to content

Add otel endpoint in weblog [php@MilanGarnier/propagation-behavior-extract]#7190

Draft
MilanGarnier wants to merge 6 commits into
mainfrom
milan.garnier/php-weblog
Draft

Add otel endpoint in weblog [php@MilanGarnier/propagation-behavior-extract]#7190
MilanGarnier wants to merge 6 commits into
mainfrom
milan.garnier/php-weblog

Conversation

@MilanGarnier

@MilanGarnier MilanGarnier commented Jun 22, 2026

Copy link
Copy Markdown
Contributor

Motivation

Add a PHP weblog endpoint that extracts distributed tracing context via the
OTel propagator API and forwards a request to a downstream URL. This is needed
to test DD_TRACE_PROPAGATION_BEHAVIOR_EXTRACT behavior (restart / ignore)
when context extraction goes through the OTel drop-in bridge.

Changes

  • New endpoint GET /otel_drop_in_extract_and_make_distant_call?url=<url>
    (utils/build/docker/php/common/otel_drop_in_extract_and_make_distant_call.php):
    • Extracts incoming trace context using OpenTelemetry\API\Globals::propagator()->extract(),
      which the DDTrace bridge maps to consume_distributed_tracing_headers.
    • Creates an OTel server span parented to the extracted context.
    • Makes an outbound cURL request to the provided url, propagating the
      active context through DDTrace's auto-instrumentation.
    • Returns JSON with url, status_code, request_headers, and
      response_headers for assertion in tests.
  • Rewrite rule added in rewrite-rules.conf (with [QSA] to preserve
    the url query parameter).
  • Enables Test_ExtractBehavior_Restart_Otel for PHP >= 8.1 versions

Workflow

  1. ⚠️ Create your PR as draft ⚠️
  2. Work on you PR until the CI passes
  3. Mark it as ready for review
    • Test logic is modified? -> Get a review from RFC owner.
    • Framework is modified, or non obvious usage of it -> get a review from R&P team

🚀 Once your PR is reviewed and the CI green, you can merge it!

🛟 #apm-shared-testing 🛟

Reviewer checklist

  • Anything but tests/ or manifests/ is modified ? I have the approval from R&P team
  • A docker base image is modified?
    • the relevant build-XXX-image label is present
  • A scenario is added, removed or renamed?

@github-actions

github-actions Bot commented Jun 22, 2026

Copy link
Copy Markdown
Contributor

CODEOWNERS have been resolved as:

utils/build/docker/php/common/otel_drop_in_extract_and_make_distant_call.php  @DataDog/apm-php @DataDog/system-tests-core
manifests/php.yml                                                       @DataDog/apm-php @DataDog/asm-php
utils/build/docker/php/common/rewrite-rules.conf                        @DataDog/apm-php @DataDog/system-tests-core

@datadog-datadog-prod-us1

datadog-datadog-prod-us1 Bot commented Jun 22, 2026

Copy link
Copy Markdown

Pipelines  Tests

Fix all issues with BitsAI

⚠️ Warnings

🚦 9 Pipeline jobs failed

Testing the test | System Tests (php, dev) / End-to-end #10 / php-fpm-8.1 10   View in Datadog   GitHub Actions

🧪 3 Tests failed

tests.test_library_conf.Test_ExtractBehavior_Restart_Otel.test_multiple_tracecontexts[php-fpm-8.1] from system_tests_suite   View in Datadog
AssertionError: assert &#39;1&#39; != &#39;1&#39;
 &#43;  where &#39;1&#39; = &lt;bound method DataDogAgentSpanLegacy.get of &lt;utils.dd_types._datadog_agent_trace.DataDogAgentSpanLegacy object at 0x7f35fc379160&gt;&gt;(&#39;traceID&#39;)
 &#43;    where &lt;bound method DataDogAgentSpanLegacy.get of &lt;utils.dd_types._datadog_agent_trace.DataDogAgentSpanLegacy object at 0x7f35fc379160&gt;&gt; = &lt;utils.dd_types._datadog_agent_trace.DataDogAgentSpanLegacy object at 0x7f35fc379160&gt;.get

self = &lt;tests.test_library_conf.Test_ExtractBehavior_Restart_Otel object at 0x7f3614b38e30&gt;

    def test_multiple_tracecontexts(self):
        interfaces.library.assert_trace_exists(self.r)
        spans = interfaces.agent.get_spans_list(self.r)
    
...
tests.test_library_conf.Test_ExtractBehavior_Restart_Otel.test_multiple_tracecontexts_with_overrides[php-fpm-8.1] from system_tests_suite   View in Datadog
AssertionError: assert &#39;1&#39; != &#39;1&#39;
 &#43;  where &#39;1&#39; = &lt;bound method DataDogAgentSpanLegacy.get of &lt;utils.dd_types._datadog_agent_trace.DataDogAgentSpanLegacy object at 0x7f35fc515490&gt;&gt;(&#39;traceID&#39;)
 &#43;    where &lt;bound method DataDogAgentSpanLegacy.get of &lt;utils.dd_types._datadog_agent_trace.DataDogAgentSpanLegacy object at 0x7f35fc515490&gt;&gt; = &lt;utils.dd_types._datadog_agent_trace.DataDogAgentSpanLegacy object at 0x7f35fc515490&gt;.get

self = &lt;tests.test_library_conf.Test_ExtractBehavior_Restart_Otel object at 0x7f3614b38e60&gt;

    def test_multiple_tracecontexts_with_overrides(self):
        interfaces.library.assert_trace_exists(self.r)
        spans = interfaces.agent.get_spans_list(self.r)
    
...
View all 3 test failures

Testing the test | System Tests (php, dev) / End-to-end #4 / apache-mod-8.2 4   View in Datadog   GitHub Actions

🧪 3 Tests failed

tests.test_library_conf.Test_ExtractBehavior_Restart_Otel.test_multiple_tracecontexts[apache-mod-8.2] from system_tests_suite   View in Datadog
AssertionError: assert &#39;1&#39; != &#39;1&#39;
 &#43;  where &#39;1&#39; = &lt;bound method DataDogAgentSpanLegacy.get of &lt;utils.dd_types._datadog_agent_trace.DataDogAgentSpanLegacy object at 0x7fe784bd7d10&gt;&gt;(&#39;traceID&#39;)
 &#43;    where &lt;bound method DataDogAgentSpanLegacy.get of &lt;utils.dd_types._datadog_agent_trace.DataDogAgentSpanLegacy object at 0x7fe784bd7d10&gt;&gt; = &lt;utils.dd_types._datadog_agent_trace.DataDogAgentSpanLegacy object at 0x7fe784bd7d10&gt;.get

self = &lt;tests.test_library_conf.Test_ExtractBehavior_Restart_Otel object at 0x7fe7ac4670b0&gt;

    def test_multiple_tracecontexts(self):
        interfaces.library.assert_trace_exists(self.r)
        spans = interfaces.agent.get_spans_list(self.r)
    
...
tests.test_library_conf.Test_ExtractBehavior_Restart_Otel.test_multiple_tracecontexts_with_overrides[apache-mod-8.2] from system_tests_suite   View in Datadog
AssertionError: assert &#39;1&#39; != &#39;1&#39;
 &#43;  where &#39;1&#39; = &lt;bound method DataDogAgentSpanLegacy.get of &lt;utils.dd_types._datadog_agent_trace.DataDogAgentSpanLegacy object at 0x7fe784917290&gt;&gt;(&#39;traceID&#39;)
 &#43;    where &lt;bound method DataDogAgentSpanLegacy.get of &lt;utils.dd_types._datadog_agent_trace.DataDogAgentSpanLegacy object at 0x7fe784917290&gt;&gt; = &lt;utils.dd_types._datadog_agent_trace.DataDogAgentSpanLegacy object at 0x7fe784917290&gt;.get

self = &lt;tests.test_library_conf.Test_ExtractBehavior_Restart_Otel object at 0x7fe7ac467b90&gt;

    def test_multiple_tracecontexts_with_overrides(self):
        interfaces.library.assert_trace_exists(self.r)
        spans = interfaces.agent.get_spans_list(self.r)
    
...
View all 3 test failures

Testing the test | System Tests (php, dev) / End-to-end #5 / apache-mod-8.2-zts 5   View in Datadog   GitHub Actions

🧪 3 Tests failed

tests.test_library_conf.Test_ExtractBehavior_Restart_Otel.test_multiple_tracecontexts[apache-mod-8.2-zts] from system_tests_suite   View in Datadog
AssertionError: assert &#39;1&#39; != &#39;1&#39;
 &#43;  where &#39;1&#39; = &lt;bound method DataDogAgentSpanLegacy.get of &lt;utils.dd_types._datadog_agent_trace.DataDogAgentSpanLegacy object at 0x7fd5f4e8a5a0&gt;&gt;(&#39;traceID&#39;)
 &#43;    where &lt;bound method DataDogAgentSpanLegacy.get of &lt;utils.dd_types._datadog_agent_trace.DataDogAgentSpanLegacy object at 0x7fd5f4e8a5a0&gt;&gt; = &lt;utils.dd_types._datadog_agent_trace.DataDogAgentSpanLegacy object at 0x7fd5f4e8a5a0&gt;.get

self = &lt;tests.test_library_conf.Test_ExtractBehavior_Restart_Otel object at 0x7fd609dd9220&gt;

    def test_multiple_tracecontexts(self):
        interfaces.library.assert_trace_exists(self.r)
        spans = interfaces.agent.get_spans_list(self.r)
    
...
tests.test_library_conf.Test_ExtractBehavior_Restart_Otel.test_multiple_tracecontexts_with_overrides[apache-mod-8.2-zts] from system_tests_suite   View in Datadog
AssertionError: assert &#39;1&#39; != &#39;1&#39;
 &#43;  where &#39;1&#39; = &lt;bound method DataDogAgentSpanLegacy.get of &lt;utils.dd_types._datadog_agent_trace.DataDogAgentSpanLegacy object at 0x7fd5f47d7890&gt;&gt;(&#39;traceID&#39;)
 &#43;    where &lt;bound method DataDogAgentSpanLegacy.get of &lt;utils.dd_types._datadog_agent_trace.DataDogAgentSpanLegacy object at 0x7fd5f47d7890&gt;&gt; = &lt;utils.dd_types._datadog_agent_trace.DataDogAgentSpanLegacy object at 0x7fd5f47d7890&gt;.get

self = &lt;tests.test_library_conf.Test_ExtractBehavior_Restart_Otel object at 0x7fd609dd93a0&gt;

    def test_multiple_tracecontexts_with_overrides(self):
        interfaces.library.assert_trace_exists(self.r)
        spans = interfaces.agent.get_spans_list(self.r)
    
...
View all 3 test failures

View all 9 failed jobs.

ℹ️ 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: dc09660 | Docs | Datadog PR Page | Give us feedback!

@datadog-system-tests-org

datadog-system-tests-org Bot commented Jun 22, 2026

Copy link
Copy Markdown

Pipelines

⚠️ Warnings

🚦 31 Pipeline jobs failed

Testing the test | Fail if target branch is specified   View in Datadog   GitHub Actions

Testing the test | System Tests (php, dev) / End-to-end #1 / apache-mod-7.0-zts 1   View in Datadog   GitHub Actions

Testing the test | System Tests (php, dev) / End-to-end #1 / php-fpm-7.1 1   View in Datadog   GitHub Actions

View all 31 failed jobs.

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

@MilanGarnier MilanGarnier changed the title Add otel endpoint in weblog Add otel endpoint in weblog [php@MilanGarnier/propagation-behavior-extract] Jun 22, 2026
@MilanGarnier MilanGarnier marked this pull request as ready for review June 23, 2026 12:13
@MilanGarnier MilanGarnier requested review from a team as code owners June 23, 2026 12:13
@MilanGarnier MilanGarnier marked this pull request as draft June 23, 2026 12:14

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

Copy link
Copy Markdown

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: b8a4af3722

ℹ️ About Codex in GitHub

Codex has been enabled to automatically 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 👍.

When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback".

Comment thread manifests/php.yml Outdated
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.

1 participant