Skip to content

test(otel): OTel HTTP semantics coverage against the cross-tracer RFC - #7455

Merged
link04 merged 5 commits into
mainfrom
otel-semantics-system-tests-v2
Aug 25, 2026
Merged

link04 merged 5 commits into
mainfrom
otel-semantics-system-tests-v2

Conversation

@link04

@link04 link04 commented Aug 4, 2026 •

Copy link
Copy Markdown
Contributor

Summary

Adds tests for HTTP OpenTelemetry semantic conventions enabled by DD_TRACE_OTEL_SEMANTICS_ENABLED and exported over OTLP.

Coverage includes HTTP server and client attributes, span naming and status (and custom error-status configuration), and trace metrics.

Scenarios

Scenario Test class Tests Coverage
OTEL_SEMANTICS_OTLP Test_OtelSemantics_Spans_Http_Server 19 Server attributes, naming, status semantics, URL handling, addressing, span kind, and endpoint retention
OTEL_SEMANTICS_OTLP Test_OtelSemantics_Spans_Http_Client 11 Client attributes, naming, status semantics, peer-service suppression, span kind, and URL redaction
OTEL_SEMANTICS_OTLP_CUSTOM_ERROR_STATUSES Test_OtelSemantics_OTLP_Spans_Http_ErrorStatusConfiguration 4 Configured client and server error-status ranges replace the defaults
OTEL_SEMANTICS_OTLP_TRACE_METRICS Test_OtelSemantics_OTLP_TraceMetrics 4 OTLP trace metrics agree with their corresponding HTTP spans
OTEL_SEMANTICS_OTLP_SAMPLING_RULES Test_OtelSemantics_SamplingRules 2 Semantic resource names are available when sampling decisions occur

Test_OtelSemantics_Spans_Http_Server

Test Description
test_otel_attributes_present Verifies canonical method, URL, and typed response-status attributes are present.
test_datadog_attributes_absent Verifies Datadog HTTP attribute aliases are omitted.
test_span_name_with_route Verifies a resolved low-cardinality route contributes to the span name.
test_span_name_route_invariance Verifies path-parameter values do not change the route or span name.
test_span_name_without_route Verifies an unresolved route never places the concrete URI path in the span name.
test_span_name_unknown_method Verifies unknown methods use _OTHER attributes and HTTP in the span name.
test_status_500_no_exception_is_status_code_error Verifies an HTTP 500 response marks the server span as an error.
test_status_400_is_not_error Verifies an HTTP 400 response does not mark a server span as an error.
test_status_3xx_is_not_error Verifies redirects do not mark server spans as errors.
test_url_query_present_with_query_string Verifies url.query is emitted when a query string is present.
test_url_query_absent_without_query_string Verifies url.query is omitted when no query string exists.
test_url_query_obfuscation Verifies sensitive query values are obfuscated.
test_user_agent Verifies the canonical original user-agent attribute.
test_client_address Verifies the canonical client address and removal of its Datadog alias.
test_network_peer_address Verifies the network peer address is available.
test_server_address Verifies the canonical server address and removal of its Datadog alias.
test_server_port Verifies server.port is emitted as an OTLP integer.
test_http_endpoint_retained Verifies the Datadog endpoint fallback remains available for route-less requests.
test_span_kind_is_server Verifies the OTLP span kind is SERVER.

Test_OtelSemantics_Spans_Http_Client

Test Description
test_otel_attributes_present Verifies canonical method, URL, server, and typed response-status attributes are present.
test_datadog_attributes_absent Verifies Datadog client HTTP aliases are omitted.
test_peer_service_suppressed Verifies peer-service defaults remain disabled in semantic-conventions mode.
test_span_name_is_method Verifies the client span name uses the normalized HTTP method without the URI path.
test_span_name_unknown_method Verifies unknown methods use _OTHER attributes and HTTP in the span name.
test_span_kind_is_client Verifies the OTLP span kind is CLIENT.
test_status_400_is_error Verifies an HTTP 400 response marks a client span as an error.
test_status_500_is_error Verifies an HTTP 500 response marks a client span as an error.
test_status_3xx_not_error Verifies redirects do not mark client spans as errors.
test_url_full_credential_redaction Verifies credentials embedded in url.full are removed or redacted.
test_url_full_query_obfuscation Verifies sensitive query values in url.full are obfuscated.

Test_OtelSemantics_OTLP_Spans_Http_ErrorStatusConfiguration

Test Description
test_server_error_statuses_config_overrides Verifies the configured server range can mark HTTP 200 as an error.
test_server_error_statuses_config_excludes_500 Verifies replacing the server range can exclude HTTP 500 from errors.
test_client_error_statuses_config_overrides Verifies the configured client range can mark HTTP 200 as an error.
test_client_error_statuses_config_excludes_500 Verifies replacing the client range can exclude HTTP 500 from errors.

Test_OtelSemantics_OTLP_TraceMetrics

Test Description
test_trace_metric_agrees_with_client_error Verifies an errored client metric matches the span method, status, name, kind, and error decision.
test_trace_metric_agrees_with_client_success Verifies a successful client metric matches the span and leaves status.code unset.
test_trace_metric_agrees_with_server_error Verifies an errored server metric matches the span method, status, name, kind, and error decision.
test_trace_metric_agrees_with_server_success Verifies a successful server metric matches the span and leaves status.code unset.

Test_OtelSemantics_SamplingRules

Test Description
test_otel_span_name_is_available_to_sampling_rules Verifies the normalized unknown-method resource matches its keep rule and every exported span is sampled.
test_server_span_name_is_available_before_client_sampling Verifies outbound propagation can sample the server trace and keep both server and client spans.

@datadog-prod-us1-5

datadog-prod-us1-5 Bot commented Aug 4, 2026 •

Copy link
Copy Markdown

Tests

🎉 All green!

🧪 All tests passed
❄️ No new flaky tests detected

This comment will be updated automatically if new data arrives.
🔗 Commit SHA: 402c665 | Docs | View more details | Give us feedback!

Comment thread tests/test_otel_http_semantics.py
Comment thread tests/test_otel_http_semantics.py Outdated
Comment thread tests/test_otel_http_semantics.py
Comment thread tests/test_otel_http_semantics.py Outdated
Comment thread tests/test_otel_http_semantics.py
Comment thread tests/test_otel_http_semantics.py Outdated
Comment thread tests/test_otel_http_semantics.py Outdated
Comment thread tests/test_otel_http_semantics.py Outdated
Comment thread tests/test_otel_http_semantics.py Outdated
Comment thread tests/test_otel_http_semantics.py Outdated
Comment thread tests/test_otel_http_semantics.py Outdated
Comment thread tests/test_otel_http_semantics.py
Comment thread tests/test_otel_http_semantics.py Outdated
Comment thread tests/test_otel_http_semantics.py Outdated
Comment thread tests/test_otel_http_semantics.py Outdated
Comment thread tests/test_otel_http_semantics.py Outdated
Comment thread tests/test_otel_http_semantics.py
Comment thread docs/understand/weblogs/end-to-end_weblog.md
Comment thread tests/test_otel_http_semantics.py Outdated
Comment thread tests/test_otel_http_semantics.py
@github-actions

github-actions Bot commented Aug 19, 2026 •

Copy link
Copy Markdown
Contributor

CODEOWNERS have been resolved as:

tests/test_otel_http_semantics.py                                       @DataDog/system-tests-core
.github/workflows/run-end-to-end.yml                                    @DataDog/system-tests-core
docs/understand/weblogs/end-to-end_weblog.md                            @DataDog/system-tests-core
manifests/c.yml                                                         @DataDog/system-tests-reviewers
manifests/cpp.yml                                                       @DataDog/system-tests-reviewers
manifests/cpp_httpd.yml                                                 @DataDog/system-tests-reviewers
manifests/cpp_kong.yml                                                  @DataDog/system-tests-reviewers
manifests/cpp_nginx.yml                                                 @DataDog/system-tests-reviewers
manifests/dotnet.yml                                                    @DataDog/system-tests-reviewers
manifests/golang.yml                                                    @DataDog/system-tests-reviewers
manifests/java.yml                                                      @DataDog/system-tests-reviewers
manifests/nodejs.yml                                                    @DataDog/system-tests-reviewers
manifests/php.yml                                                       @DataDog/system-tests-reviewers
manifests/python.yml                                                    @DataDog/system-tests-reviewers
manifests/ruby.yml                                                      @DataDog/system-tests-reviewers
manifests/rust.yml                                                      @DataDog/system-tests-reviewers
tests/otel/test_tracing_otlp.py                                         @DataDog/system-tests-core
utils/_context/_scenarios/__init__.py                                   @DataDog/system-tests-core
utils/build/docker/dotnet/weblog/Dependencies/HttpClientWrapper.cs      @DataDog/system-tests-reviewers
utils/build/docker/dotnet/weblog/Endpoints/MakeDistantCallEndpoint.cs   @DataDog/system-tests-reviewers
utils/build/docker/dotnet/weblog/Endpoints/ManualKeepDropEndpoint.cs    @DataDog/system-tests-reviewers
utils/build/docker/dotnet/weblog/Endpoints/OtelDropInEndpoint.cs        @DataDog/system-tests-reviewers
utils/build/docker/golang/app/net-http/main.go                          @DataDog/system-tests-reviewers
utils/build/docker/nodejs/express/app.js                                @DataDog/system-tests-reviewers
utils/build/docker/nodejs/express4-typescript/app.ts                    @DataDog/system-tests-reviewers
utils/build/docker/nodejs/fastify/app.js                                @DataDog/system-tests-reviewers
utils/build/docker/proxy.Dockerfile                                     @DataDog/system-tests-reviewers
utils/build/docker/python/django/app/urls.py                            @DataDog/system-tests-reviewers
utils/build/docker/python/fastapi/main.py                               @DataDog/system-tests-reviewers
utils/build/docker/python/flask/app.py                                  @DataDog/system-tests-reviewers
utils/build/docker/python/tornado/main.py                               @DataDog/system-tests-reviewers
utils/interfaces/_open_telemetry.py                                     @DataDog/system-tests-core
utils/proxy/traces/otlp_v1.py                                           @DataDog/system-tests-core

Comment thread tests/test_otel_http_semantics.py Outdated
@marcotc

marcotc commented Aug 20, 2026

Copy link
Copy Markdown
Member

@codex review

@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: 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".

Comment thread tests/test_otel_http_semantics.py
Comment thread utils/build/docker/golang/app/net-http/main.go Outdated
@marcotc

marcotc commented Aug 20, 2026

Copy link
Copy Markdown
Member

@codex review

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
marcotc force-pushed the otel-semantics-system-tests-v2 branch from 69d0136 to 39e8ffe Compare August 21, 2026 22:55
@marcotc

marcotc commented Aug 21, 2026

Copy link
Copy Markdown
Member

I rewrote commit history (!) to fix previous unsigned commits.

@marcotc
marcotc requested a review from a team as a code owner August 24, 2026 18:22
@link04
link04 merged commit 8bd5421 into main Aug 25, 2026
2835 of 2837 checks passed
@link04
link04 deleted the otel-semantics-system-tests-v2 branch August 25, 2026 01:49
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>
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.

5 participants