Repository navigation
feat(contrib/net/http): support OpenTelemetry client semantics - #5203
gh-worker-dd-mergequeue-cf854d[bot] merged 23 commits into
Conversation
|
✅ All CI checks and tests passed. 🎉 All green!🧪 All tests passed 🎯 Code Coverage (details) 🔗 Commit SHA: 2b55544 | Docs | View more details | Give us feedback! |
Config Audit |
664ffc8 to
3f4e936
Compare
BenchmarksBenchmark execution time: 2026-10-06 21:06:25 Comparing candidate commit 2b55544 in PR branch Found 0 performance improvements and 0 performance regressions! Performance is the same for 340 metrics, 1 unstable metrics, 1 known flaky benchmarks.
|
6131df9 to
5469abf
Compare
47f429b to
6e89339
Compare
There was a problem hiding this comment.
Pull request overview
Adds OpenTelemetry HTTP client semantics to net/http instrumentation and aligns configuration, OTLP export, naming, and trace metrics.
Changes:
- Emits OTel HTTP client attributes, names, and error semantics.
- Applies global OTel-mode configuration overrides and typed OTLP attributes.
- Adds unit, system-test support, and benchmark coverage.
Reviewed changes
Copilot reviewed 29 out of 29 changed files in this pull request and generated 7 comments.
Show a summary per file
| File | Description |
|---|---|
internal/namingschema/namingschema.go |
Loads effective schema from config. |
internal/namingschema/namingschema_test.go |
Tests schema refresh and overrides. |
internal/config/config.go |
Applies OTel configuration overrides. |
internal/config/config_test.go |
Tests override behavior and telemetry. |
instrumentation/internal/namingschema/namingschema.go |
Uses effective schema configuration. |
instrumentation/internal/namingschema/namingschema_test.go |
Tests OTel schema selection. |
instrumentation/instrumentation.go |
Exposes OTel semantics state. |
instrumentation/instrumentation_test.go |
Tests semantics state access. |
instrumentation/httptrace/method.go |
Normalizes HTTP methods. |
instrumentation/httptrace/method_test.go |
Tests method normalization. |
ddtrace/tracer/stats.go |
Reads OTel HTTP methods for stats. |
ddtrace/tracer/stats_test.go |
Tests OTel trace metrics. |
ddtrace/tracer/spancontext_test.go |
Tests peer-service suppression. |
ddtrace/tracer/span_to_otlp.go |
Converts semantic attributes to OTLP types. |
ddtrace/tracer/span_to_otlp_test.go |
Tests semantic OTLP conversion. |
ddtrace/tracer/option.go |
Loads naming from effective config. |
ddtrace/tracer/option_test.go |
Tests option overrides. |
ddtrace/tracer/doc.go |
Documents OTel semantics mode. |
ddtrace/opentelemetry/span_test.go |
Validates direct OTLP output. |
ddtrace/ext/tags.go |
Adds OTel HTTP attribute constants. |
contrib/net/http/roundtripper_test.go |
Tests client semantic behavior. |
contrib/net/http/option.go |
Configures OTel client defaults. |
contrib/net/http/internal/wrap/roundtrip.go |
Emits semantic request and response tags. |
contrib/net/http/internal/wrap/roundtrip_test.go |
Tests semantic tags and addressing. |
contrib/net/http/internal/orchestrion/roundtrip.go |
Adds semantics to auto-instrumentation. |
contrib/net/http/internal/orchestrion/roundtrip_test.go |
Tests Orchestrion defaults. |
contrib/net/http/internal/config/config.go |
Defines client error-status behavior. |
contrib/net/http/internal/config/config_test.go |
Tests status predicates. |
.gitlab/benchmarks/micro/gitlab-ci.yml |
Registers the new benchmark. |
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
6e89339 to
617dd04
Compare
net/http.Client
f8af0d2 to
1dc2f67
Compare
There was a problem hiding this comment.
Pull request overview
Copilot reviewed 32 out of 32 changed files in this pull request and generated no new comments.
Suppressed comments (2)
contrib/net/http/internal/wrap/roundtrip.go:245
- OTel response handling never records
resp.Proto, so normal client spans omit the knownnetwork.protocol.version(and a non-HTTPnetwork.protocol.name). These are part of the HTTP response attributes emitted by the OpenTelemetry-Go reference named in the PR; add them before finishing the span and cover HTTP/1.1 and HTTP/2 responses.
if cfg.OTelSemanticsEnabled {
span.SetTag(ext.HTTPResponseStatusCode, statusCode)
} else {
span.SetTag(ext.HTTPCode, statusCode)
}
internal/config/config.go:492
parseSpanAttributeSchemaalready logs invalid values ininternal/config/config_helpers.go:158, so this branch guarantees two warnings for one bad setting. The new test only counts this new message and therefore misses the existing “invalid value, ignoring” warning. Keep warning ownership in one layer and assert that only one warning is emitted.
} else {
log.Warn("DD_TRACE_SPAN_ATTRIBUTE_SCHEMA=%s is not a valid value, setting to default of v0", schemaStr)
2497a15 to
bc51857
Compare
349766e to
504f8b5
Compare
ce97578 to
ba85666
Compare
There was a problem hiding this comment.
|
/merge |
|
View all feedbacks in Devflow UI.
The expected merge time in
|
What does this PR do?
This PR follows #5220 and applies its shared HTTP attributes to
net/httpclient 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/httpclient 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_STATUSESstill overrides the default.Existing Datadog behavior does not change when the flag is false or unset.
DataDog/system-tests#7455 covers this behavior.
Motivation
The OpenTelemetry HTTP semantics RFC defines the required cross-tracer behavior and is the primary implementation and review reference for this PR.
APMAPI-2121, part of APMAPI-2036, requires
net/httpclient instrumentation to follow OpenTelemetry HTTP client semantic conventions when users enable the opt-in mode.Reviewer's Checklist
make lintlocally.make testlocally.make generatelocally.make fix-moduleslocally.