Skip to content

test(otel): observe the SDK's default OTLP protocol instead of hardcoding it - #8256

Merged
vpellan merged 1 commit into
mainfrom
vpellan/observe-otlp-default-protocol
Oct 30, 2026
Merged

vpellan merged 1 commit into
mainfrom
vpellan/observe-otlp-default-protocol

Conversation

@vpellan

@vpellan vpellan commented Oct 30, 2026

Copy link
Copy Markdown
Contributor

Motivation

The OTLP protocol tests hardcoded each SDK's default protocol per signal in utils.py. When an SDK migrates its default (.NET is doing so), the tests have to be disabled, updated and re-enabled.

Changes

The default is now observed at runtime instead of hardcoded. How the pieces fit:

  • default_protocol (fixture, otel_env_vars/conftest.py): returns a callable, default_protocol(signal). On first use it starts the SDK through test_library_factory with no protocol variable set and exports once to the HTTP listener (the content type gives http/protobuf or http/json), then falls back to the gRPC listener (grpc). The result is cached per signal and worker. Because it is a callable, it only runs when a test needs the default, so explicit-protocol tests don't depend on it.
  • sdk_default / sdk_non_default (utils.py): functions of (signal, default) used as parametrize values for inputs that depend on the default. sdk_non_default picks a transport the SDK supports that isn't its default; the case-insensitive tests call .upper() on it.
  • resolve_protocol (utils.py): turns a parametrize value into the env value. Functions are called with the observed default; literals pass through.
  • expected_protocol (utils.py): resolves protocol and generic_protocol, then applies precedence: signal variable, generic variable, then the SDK default (unset, empty or invalid).
  • expected_protocol (fixture, each test file): calls the util with the test's parametrize values. library_env uses it to point the endpoint at the HTTP or gRPC listener, and the test uses it for the content-type assertion, so both always agree.

Traces get the same treatment, with DD_TRACE_OTEL_ENABLED, DD_TRACE_OTEL_SEMANTICS_ENABLED and OTEL_TRACES_EXPORTER=otlp. test_unset_uses_specification_default still asserts http/protobuf. Test IDs are unchanged, so no manifest updates.

Empty and invalid values are now compared against the SDK's actual default instead of a documented one, so these XPASS:

  • Go logs test_empty / test_invalid (APMAPI-2501): Go uses http/protobuf while documenting http/json, which test_documented_json_default still catches.
  • .NET traces test_empty_is_treated_as_unset (APMAPI-2531): .NET defaults to http/json, which test_unset_uses_specification_default still catches.

Verified locally on dotnet 3.57.0, and on golang 2.13.0-dev and php 1.24.0 before the final helper refactor.

Workflow

  1. ⚠️ Create your PR as draft ⚠️
  2. Work on you PR until the CI passes
  3. Mark it as ready for review
    • Tests, manifest, weblog are modified -> you'll need a review from system-tests-reviewers: ask to one of youre co-worker familiar with the tested feature.
    • Framework is modified, or non obvious usage of it -> get a review from system-tests-core (slack)

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

🛟 #apm-shared-testing 🛟

🤖 Generated with Claude Code

…ding it

The OTLP protocol tests hardcoded each SDK's default protocol per signal,
so an SDK migrating its default required disabling, updating and
re-enabling the tests. A default_protocol fixture now observes it from an
unset control run, and inputs that depend on it are derived at runtime.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@github-actions

Copy link
Copy Markdown
Contributor

CODEOWNERS have been resolved as:

tests/parametric/otel_env_vars/conftest.py                              @DataDog/system-tests-reviewers
tests/parametric/otel_env_vars/test_otel_exporter_otlp_logs_protocol.py  @DataDog/system-tests-reviewers
tests/parametric/otel_env_vars/test_otel_exporter_otlp_metrics_protocol.py  @DataDog/system-tests-reviewers
tests/parametric/otel_env_vars/test_otel_exporter_otlp_protocol.py      @DataDog/system-tests-reviewers
tests/parametric/otel_env_vars/test_otel_exporter_otlp_traces_protocol.py  @DataDog/system-tests-reviewers
tests/parametric/otel_env_vars/utils.py                                 @DataDog/system-tests-reviewers

@vpellan
vpellan marked this pull request as ready for review October 30, 2026 15:06
@vpellan
vpellan requested a review from a team as a code owner October 30, 2026 15:06
@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Oct 30, 2026 •

Copy link
Copy Markdown

Codex Review Summary

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review ✅ Completed 2026-10-30T15:09:14.590454Z 0cf88bb Draft marked ready
ℹ️ 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" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

@vpellan
vpellan merged commit b76b165 into main Oct 30, 2026
481 checks passed
@vpellan
vpellan deleted the vpellan/observe-otlp-default-protocol branch October 30, 2026 16:13
p-datadog pushed a commit that referenced this pull request Nov 1, 2026
* u/main: (82 commits)
  Auto-activate nodejs easy wins for asm-libraries (#8265)
  Auto-activate nodejs easy wins for apm-sdk-capabilities (#8264)
  Auto-activate rust easy wins for apm-sdk-capabilities (#8217)
  Auto-activate golang easy wins for apm-sdk-capabilities (#8263)
  Auto-activate dotnet easy wins for apm-sdk-capabilities (#8262)
  test(ffe): cover Go and Java customer exposure hooks (#8094)
  Move the debugger scenarios to the mocked backend, with remote config sent through it (#8253)
  test(otel): observe the SDK's default OTLP protocol instead of hardcoding it (#8256)
  Revert "[debugger] Test that debugger metrics use the debugger telemetry namespace" (#8257)
  Check the mocked backend network aliases on GitLab (#8212)
  Agent on the mocked backend: set DD_SITE instead of each intake URL (#8254)
  [debugger] Test that debugger metrics use the debugger telemetry namespace (#8052)
  Fail SSI installs when component installation fails (#8246)
  Collect HotSpot hs_err logs from Java AWS SSI weblogs (#8249)
  FFE direct shutdown: detect the priming capture without the watchdog latency (#8250)
  Move DEBUGGER_TELEMETRY to the mocked backend, which serves remote config (#8239)
  PHP parametric base image (#8172)
  AI Guard: tests for backend-provided extra_tags on the ai_guard span (#8130)
  Cbeauchesne/rename dead and legacy features (#8240)
  Retry AWS SSI jobs when the installer cannot update apt sources (#8245)
  ...
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