Add Resource Attributes for OTLP Trace Metrics#11667
Conversation
|
🎯 Code Coverage (details) 🔗 Commit SHA: a00f34b | Docs | Datadog PR Page | Give us feedback! |
🟢 Java Benchmark SLOs — All performance SLOs passed
PR vs. master results
Commit: Load and DaCapo benchmarks can be triggered manually in the GitLab pipeline. Results will appear in the Benchmarking Platform UI after completion. |
e11a634 to
d202d88
Compare
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: eefcc4258d
ℹ️ 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".
94fbcc0 to
7b264b9
Compare
eefcc42 to
a00f34b
Compare
There was a problem hiding this comment.
Pull request overview
This PR extends the OTLP Resource attributes emitted for trace-metrics export by adding host.name (when trace.report-hostname is enabled) and by introducing a “Datadog attributes” Resource variant that can include datadog.runtime_id (and process tags) in default mode while omitting datadog.* attributes in OTel-semantics mode.
Changes:
- Add conditional emission of
host.nameinto the OTLP Resource whentrace.report-hostnameis enabled. - Add a second OTLP Resource message variant that can include
datadog.runtime_idand process tags (datadog.*) for default-mode trace-metrics export. - Add tests to assert
datadog.runtime_idpresence/absence across the two variants and across semantics modes.
Reviewed changes
Copilot reviewed 4 out of 4 changed files in this pull request and generated 2 comments.
| File | Description |
|---|---|
| dd-trace-core/src/main/java/datadog/trace/core/otlp/common/OtlpResourceProto.java | Adds host.name emission and a “with Datadog attrs” Resource variant that can write datadog.runtime_id + process tags. |
| dd-trace-core/src/main/java/datadog/trace/common/metrics/OtlpStatsMetricWriter.java | Switches trace-metrics payload assembly to select the appropriate Resource blob based on OTel-semantics mode. |
| dd-trace-core/src/test/java/datadog/trace/core/otlp/common/OtlpResourceProtoTest.java | Adds test coverage for host.name (report-hostname) and for runtime id presence in the Datadog-attrs Resource variant. |
| dd-trace-core/src/test/java/datadog/trace/common/metrics/OtlpStatsMetricWriterTest.java | Adds decoding/assertions for Resource attributes in emitted OTLP trace-metrics payloads, including datadog.runtime_id behavior. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| // report-hostname enabled: host.name written with the detected hostname | ||
| Arguments.of( | ||
| "report-hostname enabled", | ||
| props(SERVICE_NAME, "my-service", TRACE_REPORT_HOSTNAME, "true"), | ||
| attrs("service.name", "my-service", "host.name", Config.get().getHostName())), |
| this.resourceMessage = | ||
| otelSemanticsMode | ||
| ? OtlpResourceProto.RESOURCE_MESSAGE | ||
| : OtlpResourceProto.RESOURCE_MESSAGE_WITH_DATADOG_ATTRS; | ||
| } |
What Does This Do
This PR adds additional Resource Attributes for OTLP Trace Metrics.
host.nameis added to default trace metrics for both OTLP and Native CSS path, which OTLP will include the option of emittingdatadog.runtime_id, gated byDD_TRACE_OTEL_SEMANTICS_ENABLED.Motivation
Additional Notes
Contributor Checklist
type:and (comp:orinst:) labels in addition to any other useful labelsclose,fix, or any linking keywords when referencing an issueUse
solvesinstead, and assign the PR milestone to the issue/merge. You can also:/merge --commit-message "..."/merge -c/merge -f --reason "reason"; please use this judiciously, as some checks do not run at the PR-level (note: the PR still needs to be mergeable, this will only skip the pre-merge build)Jira ticket: [PROJ-IDENT]