Repository navigation
test(otel): OTel HTTP semantics coverage against the cross-tracer RFC - #7455
Merged
Merged
Conversation
🎉 All green!🧪 All tests passed 🔗 Commit SHA: 402c665 | Docs | View more details | Give us feedback! |
This was referenced Aug 17, 2026
9 tasks
marcotc
reviewed
Aug 19, 2026
marcotc
reviewed
Aug 19, 2026
marcotc
reviewed
Aug 19, 2026
Contributor
|
|
marcotc
reviewed
Aug 19, 2026
Member
|
@codex review |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 330d1e1e0f
ℹ️ 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".
Member
|
@codex review |
cbeauchesne
approved these changes
Aug 21, 2026
Co-authored-by: Ayan Khan <khanayan_123@hotmail.com> Co-authored-by: Zach Montoya <zach.montoya@datadoghq.com> Co-authored-by: Maximo Bautista <max.bautista97@gmail.com>
marcotc
force-pushed
the
otel-semantics-system-tests-v2
branch
from
August 21, 2026 22:55
69d0136 to
39e8ffe
Compare
Member
|
I rewrote commit history (!) to fix previous unsigned commits. |
This was referenced Aug 25, 2026
Open
gh-worker-dd-mergequeue-cf854d Bot
pushed a commit
to DataDog/libdatadog
that referenced
this pull request
Sep 2, 2026
…nsions (#2323) ### What does this PR do? Preserves OpenTelemetry HTTP semantics in libdatadog's in-process consumers and OTLP output. #### Trace stats and OTLP trace metrics - reads canonical Datadog HTTP method/status keys first, then falls back to `http.request.method` and `http.response.status_code` - accepts valid numeric or string status values without allowing empty, malformed, non-finite, or non-integral values to shadow a valid fallback - emits OTel trace-metric dimensions for method, status, route, span name, and kind - leaves successful `status.code` unset and prevents additional tags from overriding the computed status ### HTTP tag handling libdatadog does not rename tracer span tags in this PR. It accepts the Datadog and OpenTelemetry names below as equivalent inputs to trace-stat aggregation and emits the canonical OpenTelemetry name in OTLP trace metrics. | Concept | Datadog span input | OpenTelemetry span input | OTLP trace-metric output | | --- | --- | --- | --- | | HTTP method | `http.method` | `http.request.method` | `http.request.method` | | HTTP response status | `http.status_code` | `http.response.status_code` | `http.response.status_code` as an integer | | Span error status | Span error flag | Span error flag | `status.code=STATUS_CODE_ERROR` for errors; omitted for successful spans | When both naming variants are present, the Datadog name wins. Empty or malformed values fall through to the alternate name instead of hiding a valid value. #### OTLP sampled flags Sampling priority is a trace-level decision, but v0.4/v0.5 inputs may attach `_sampling_priority_v1` to only one span. The mapper now uses the same first-priority policy as `drop_chunks`, treats a missing priority as sampled, and applies one decision to every span in the chunk. This prevents sampled traces from exporting child spans with `flags=0` and keeps OTLP flags consistent with the existing chunk-retention policy. No public signature, wire-format, setting, or environment-variable change is introduced. ### Motivation Under `DD_TRACE_OTEL_SEMANTICS_ENABLED`, spans use OTel HTTP names before client-side stats are computed. Stats and OTLP metrics must preserve those dimensions, and all spans in an exported trace must carry the same sampled decision. Companion changes: - Historical full Python PR: [DataDog/dd-trace-py#19501](DataDog/dd-trace-py#19501) - Native Python stack: [foundation #20008](DataDog/dd-trace-py#20008), [client #20009](DataDog/dd-trace-py#20009), [server #20010](DataDog/dd-trace-py#20010) - [DataDog/dd-trace-js#9688](DataDog/dd-trace-js#9688) - [DataDog/system-tests#7455](DataDog/system-tests#7455) ### Testing - `cargo fmt --check -p libdd-trace-utils` - mapper unit tests: **31 passed** - OTLP trace-exporter integration tests: **3 passed** - trace-stats tests: **43 passed** End-to-end re-run from libdatadog head `0ed7fd9bd` with the final Python server layer and companion system tests: | Scenario | Result | | --- | ---: | | `OTEL_SEMANTICS_OTLP_TRACE_METRICS` | **4 passed** | | `OTEL_SEMANTICS_OTLP_SAMPLING_RULES` | **2 passed** | Co-authored-by: maximo.bautista <maximo.bautista@datadoghq.com>
gh-worker-dd-mergequeue-cf854d Bot
pushed a commit
to DataDog/dd-trace-go
that referenced
this pull request
Oct 7, 2026
### What does this PR do? This PR follows #5220 and applies its shared HTTP attributes to `net/http` client spans; later server PRs build on the same helpers. Keeping integration-specific request handling here leaves shared attribute definitions in #5220. When `DD_TRACE_OTEL_SEMANTICS_ENABLED=true`, `net/http` client spans use OpenTelemetry HTTP client names and attributes instead of Datadog names and attributes. Datadog semantics treat 4xx client responses as errors by default. OpenTelemetry semantics treat 4xx, 5xx, and invalid status codes as errors. `DD_TRACE_HTTP_CLIENT_ERROR_STATUSES` still overrides the default. Existing Datadog behavior does not change when the flag is false or unset. [DataDog/system-tests#7455](DataDog/system-tests#7455) covers this behavior. ### Motivation The [OpenTelemetry HTTP semantics RFC](https://docs.google.com/document/d/1SONUGEa38eLumE5b6gnNhykFhzZL9uQpsnMFq06uDMY) defines the required cross-tracer behavior and is the primary implementation and review reference for this PR. [APMAPI-2121](https://datadoghq.atlassian.net/browse/APMAPI-2121), part of [APMAPI-2036](https://datadoghq.atlassian.net/browse/APMAPI-2036), requires `net/http` client instrumentation to follow [OpenTelemetry HTTP client semantic conventions](https://opentelemetry.io/docs/specs/semconv/http/http-spans/) when users enable the opt-in mode. ### Reviewer's Checklist - [ ] Changed code has unit tests for its functionality at or near 100% coverage. - [ ] [System-Tests](https://github.com/DataDog/system-tests/) covering this feature have been added and enabled with the va.b.c-dev version tag. - [ ] There is a benchmark for any new code, or changes to existing code. - [ ] If this interacts with the agent in a new way, a system test has been added. - [ ] New code is free of linting errors. You can check this by running `make lint` locally. - [ ] New code doesn't break existing tests. You can check this by running `make test` locally. - [ ] Add an appropriate team label so this PR gets put in the right place for the release notes. - [ ] All generated files are up to date. You can check this by running `make generate` locally. - [ ] Non-trivial go.mod changes, e.g. adding new modules, are reviewed by @DataDog/dd-trace-go-guild. Make sure all nested modules are up to date by running `make fix-modules` locally. [APMAPI-2121]: https://datadoghq.atlassian.net/browse/APMAPI-2121?atlOrigin=eyJpIjoiNWRkNTljNzYxNjVmNDY3MDlhMDU5Y2ZhYzA5YTRkZjUiLCJwIjoiZ2l0aHViLWNvbS1KU1cifQ [APMAPI-2036]: https://datadoghq.atlassian.net/browse/APMAPI-2036?atlOrigin=eyJpIjoiNWRkNTljNzYxNjVmNDY3MDlhMDU5Y2ZhYzA5YTRkZjUiLCJwIjoiZ2l0aHViLWNvbS1KU1cifQ Co-authored-by: marco.costa <marco.costa@datadoghq.com>
gh-worker-dd-mergequeue-cf854d Bot
pushed a commit
to DataDog/dd-trace-go
that referenced
this pull request
Oct 9, 2026
### What does this PR do? This PR follows #5203 and adds shared server method naming, HTTP attributes, and error mapping to `instrumentation/httptrace`. Separate integration PRs supply route information because each framework exposes matched routes differently. Server span helpers currently emit Datadog names and attributes. When `DD_TRACE_OTEL_SEMANTICS_ENABLED=true`, known methods use canonical uppercase names such as `GET`, unknown methods use `HTTP`, and server spans use OpenTelemetry request and response attributes. When an HTTP status marks a span as an error, `error.type` contains the status code. Existing Datadog behavior does not change when the flag is false or unset. [DataDog/system-tests#7455](DataDog/system-tests#7455) covers this behavior. ### Motivation The [OpenTelemetry HTTP semantics RFC](https://docs.google.com/document/d/1SONUGEa38eLumE5b6gnNhykFhzZL9uQpsnMFq06uDMY) defines the required cross-tracer behavior and is the primary implementation and review reference for this PR. [APMAPI-2047](https://datadoghq.atlassian.net/browse/APMAPI-2047) requires six Go HTTP server integrations to apply the same OpenTelemetry method, attribute, and error rules. Shared server helpers define those rules once; each integration supplies its own route information. The tracer must use Datadog semantics by default. ### Validation - `go test ./instrumentation/httptrace/...` - `go test ./ddtrace/tracer/... -run 'Test.*(OTel|HTTP|Stats|Inferred)'` - Request-span benchmarks remain at `200 B/op` and `5 allocs/op` with OpenTelemetry semantics disabled or enabled. ### Reviewer's Checklist - [ ] Changed code has unit tests for its functionality at or near 100% coverage. - [ ] [System-Tests](https://github.com/DataDog/system-tests/) covering this feature have been added and enabled with the va.b.c-dev version tag. - [ ] There is a benchmark for any new code, or changes to existing code. - [ ] If this interacts with the agent in a new way, a system test has been added. - [ ] New code is free of linting errors. You can check this by running `make lint` locally. - [ ] New code doesn't break existing tests. You can check this by running `make test` locally. - [ ] Add an appropriate team label so this PR gets put in the right place for the release notes. - [ ] All generated files are up to date. You can check this by running `make generate` locally. - [ ] Non-trivial go.mod changes, e.g. adding new modules, are reviewed by @DataDog/dd-trace-go-guild. Make sure all nested modules are up to date by running `make fix-modules` locally. [APMAPI-2047]: https://datadoghq.atlassian.net/browse/APMAPI-2047?atlOrigin=eyJpIjoiNWRkNTljNzYxNjVmNDY3MDlhMDU5Y2ZhYzA5YTRkZjUiLCJwIjoiZ2l0aHViLWNvbS1KU1cifQ Co-authored-by: marco.costa <marco.costa@datadoghq.com>
gh-worker-dd-mergequeue-cf854d Bot
pushed a commit
to DataDog/dd-trace-go
that referenced
this pull request
Oct 9, 2026
### What does this PR do? This PR follows #5230 and applies its shared server semantics to `net/http` route handling, including Orchestrion. Route discovery remains integration-specific because each framework exposes matched routes differently. When `DD_TRACE_OTEL_SEMANTICS_ENABLED=true`, `contrib/net/http` uses span names such as `GET /users/{id}` for matched requests. Unknown methods use `HTTP` in place of the method. Requests without a matched route use only `GET` or `HTTP`. `http.route` contains the matched Go 1.22 route pattern, never the request path. Orchestrion uses the same naming behavior. Explicit resource names override default span names. Existing Datadog behavior does not change when the flag is false or unset. This PR implements [APMAPI-2127](https://datadoghq.atlassian.net/browse/APMAPI-2127) under [APMAPI-2047](https://datadoghq.atlassian.net/browse/APMAPI-2047). ### Motivation The [OpenTelemetry HTTP semantics RFC](https://docs.google.com/document/d/1SONUGEa38eLumE5b6gnNhykFhzZL9uQpsnMFq06uDMY) defines the required cross-tracer behavior and is the primary implementation and review reference for this PR. APMAPI-2127 requires `net/http` server spans to use stable route-based OpenTelemetry names. The integration must not place variable request paths in span names or change default behavior. ### Validation - `go test ./contrib/net/http/...` - Focused race tests for `ServeMux`, `WrapHandler`, `TraceAndServe`, Orchestrion, and OpenTelemetry behavior - The core semantics, custom-status, trace-metric, and sampling-rule suites in [DataDog/system-tests#7455](DataDog/system-tests#7455) pass for `net-http` and `net-http-orchestrion`. ### Reviewer's Checklist - [ ] Changed code has unit tests for its functionality at or near 100% coverage. - [ ] [System-Tests](https://github.com/DataDog/system-tests/) covering this feature have been added and enabled with the va.b.c-dev version tag. - [ ] There is a benchmark for any new code, or changes to existing code. - [ ] If this interacts with the agent in a new way, a system test has been added. - [ ] New code is free of linting errors. You can check this by running `make lint` locally. - [ ] New code doesn't break existing tests. You can check this by running `make test` locally. - [ ] Add an appropriate team label so this PR gets put in the right place for the release notes. - [ ] All generated files are up to date. You can check this by running `make generate` locally. - [ ] Non-trivial go.mod changes, e.g. adding new modules, are reviewed by @DataDog/dd-trace-go-guild. Make sure all nested modules are up to date by running `make fix-modules` locally. [APMAPI-2127]: https://datadoghq.atlassian.net/browse/APMAPI-2127?atlOrigin=eyJpIjoiNWRkNTljNzYxNjVmNDY3MDlhMDU5Y2ZhYzA5YTRkZjUiLCJwIjoiZ2l0aHViLWNvbS1KU1cifQ [APMAPI-2047]: https://datadoghq.atlassian.net/browse/APMAPI-2047?atlOrigin=eyJpIjoiNWRkNTljNzYxNjVmNDY3MDlhMDU5Y2ZhYzA5YTRkZjUiLCJwIjoiZ2l0aHViLWNvbS1KU1cifQ Co-authored-by: marco.costa <marco.costa@datadoghq.com>
gh-worker-dd-mergequeue-cf854d Bot
pushed a commit
to DataDog/dd-trace-go
that referenced
this pull request
Oct 10, 2026
…5235) ### What does this PR do? This PR follows #5234 and applies #5230's shared server semantics to Gin route and error handling. This behavior stays in a separate integration PR because Gin exposes routes and errors through framework-specific APIs. When `DD_TRACE_OTEL_SEMANTICS_ENABLED=true`, `contrib/gin-gonic/gin` uses span names such as `GET /users/:id` for matched requests. Unknown methods use `HTTP` in place of the method. Requests without a matched route use only `GET` or `HTTP`. The integration omits `http.route` for those requests. Custom resource names override default span names. Custom status rules decide which status codes count as errors. Existing Datadog behavior does not change when the flag is false or unset. This PR implements [APMAPI-2124](https://datadoghq.atlassian.net/browse/APMAPI-2124) under [APMAPI-2047](https://datadoghq.atlassian.net/browse/APMAPI-2047). ### Motivation The [OpenTelemetry HTTP semantics RFC](https://docs.google.com/document/d/1SONUGEa38eLumE5b6gnNhykFhzZL9uQpsnMFq06uDMY) defines the required cross-tracer behavior and is the primary implementation and review reference for this PR. APMAPI-2124 requires Gin server spans to use stable OpenTelemetry method-and-route names and attributes. The integration must not place variable request paths in span names or change default behavior. ### Validation - `go test ./contrib/gin-gonic/gin/...` - Focused race tests for middleware, resource naming, errors, OpenTelemetry behavior, and AppSec - The applicable core semantics, custom-status, trace-metric, and sampling-rule suites in [DataDog/system-tests#7455](DataDog/system-tests#7455) pass for the Gin weblog. ### Reviewer's Checklist - [ ] Changed code has unit tests for its functionality at or near 100% coverage. - [ ] [System-Tests](https://github.com/DataDog/system-tests/) covering this feature have been added and enabled with the va.b.c-dev version tag. - [ ] There is a benchmark for any new code, or changes to existing code. - [ ] If this interacts with the agent in a new way, a system test has been added. - [ ] New code is free of linting errors. You can check this by running `make lint` locally. - [ ] New code doesn't break existing tests. You can check this by running `make test` locally. - [ ] Add an appropriate team label so this PR gets put in the right place for the release notes. - [ ] All generated files are up to date. You can check this by running `make generate` locally. - [ ] Non-trivial go.mod changes, e.g. adding new modules, are reviewed by @DataDog/dd-trace-go-guild. Make sure all nested modules are up to date by running `make fix-modules` locally. [APMAPI-2124]: https://datadoghq.atlassian.net/browse/APMAPI-2124?atlOrigin=eyJpIjoiNWRkNTljNzYxNjVmNDY3MDlhMDU5Y2ZhYzA5YTRkZjUiLCJwIjoiZ2l0aHViLWNvbS1KU1cifQ [APMAPI-2047]: https://datadoghq.atlassian.net/browse/APMAPI-2047?atlOrigin=eyJpIjoiNWRkNTljNzYxNjVmNDY3MDlhMDU5Y2ZhYzA5YTRkZjUiLCJwIjoiZ2l0aHViLWNvbS1KU1cifQ Co-authored-by: marco.costa <marco.costa@datadoghq.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Adds tests for HTTP OpenTelemetry semantic conventions enabled by
DD_TRACE_OTEL_SEMANTICS_ENABLEDand exported over OTLP.Coverage includes HTTP server and client attributes, span naming and status (and custom error-status configuration), and trace metrics.
Scenarios
OTEL_SEMANTICS_OTLPTest_OtelSemantics_Spans_Http_ServerOTEL_SEMANTICS_OTLPTest_OtelSemantics_Spans_Http_ClientOTEL_SEMANTICS_OTLP_CUSTOM_ERROR_STATUSESTest_OtelSemantics_OTLP_Spans_Http_ErrorStatusConfigurationOTEL_SEMANTICS_OTLP_TRACE_METRICSTest_OtelSemantics_OTLP_TraceMetricsOTEL_SEMANTICS_OTLP_SAMPLING_RULESTest_OtelSemantics_SamplingRulesTest_OtelSemantics_Spans_Http_Servertest_otel_attributes_presenttest_datadog_attributes_absenttest_span_name_with_routetest_span_name_route_invariancetest_span_name_without_routetest_span_name_unknown_method_OTHERattributes andHTTPin the span name.test_status_500_no_exception_is_status_code_errortest_status_400_is_not_errortest_status_3xx_is_not_errortest_url_query_present_with_query_stringurl.queryis emitted when a query string is present.test_url_query_absent_without_query_stringurl.queryis omitted when no query string exists.test_url_query_obfuscationtest_user_agenttest_client_addresstest_network_peer_addresstest_server_addresstest_server_portserver.portis emitted as an OTLP integer.test_http_endpoint_retainedtest_span_kind_is_serverSERVER.Test_OtelSemantics_Spans_Http_Clienttest_otel_attributes_presenttest_datadog_attributes_absenttest_peer_service_suppressedtest_span_name_is_methodtest_span_name_unknown_method_OTHERattributes andHTTPin the span name.test_span_kind_is_clientCLIENT.test_status_400_is_errortest_status_500_is_errortest_status_3xx_not_errortest_url_full_credential_redactionurl.fullare removed or redacted.test_url_full_query_obfuscationurl.fullare obfuscated.Test_OtelSemantics_OTLP_Spans_Http_ErrorStatusConfigurationtest_server_error_statuses_config_overridestest_server_error_statuses_config_excludes_500test_client_error_statuses_config_overridestest_client_error_statuses_config_excludes_500Test_OtelSemantics_OTLP_TraceMetricstest_trace_metric_agrees_with_client_errortest_trace_metric_agrees_with_client_successstatus.codeunset.test_trace_metric_agrees_with_server_errortest_trace_metric_agrees_with_server_successstatus.codeunset.Test_OtelSemantics_SamplingRulestest_otel_span_name_is_available_to_sampling_rulestest_server_span_name_is_available_before_client_sampling