Skip to content

Fix OTLP trace-metrics attribute compliance gaps - #12144

Open
mabdinur wants to merge 17 commits into
masterfrom
munir/otlp-trace-metrics-fixes
Open

Fix OTLP trace-metrics attribute compliance gaps#12144
mabdinur wants to merge 17 commits into
masterfrom
munir/otlp-trace-metrics-fixes

Conversation

@mabdinur

@mabdinur mabdinur commented Aug 4, 2026

Copy link
Copy Markdown
Contributor

Summary

Aligns Java OTLP trace metrics with the cross-tracer contract tracked by system-tests#7466.

  • Emits service.name on every data point, canonical SPAN_KIND_* values, and string STATUS_CODE_* values.
  • Maps absent, empty, unknown, or unrecognized trace-metric span kinds to SPAN_KIND_INTERNAL; never emits SPAN_KIND_UNSPECIFIED.
  • Makes OTLP trace-metric output independent of DD_TRACE_OTEL_SEMANTICS_ENABLED; global parsing, telemetry, and the public config accessor remain unchanged.
  • Always emits available OTel and datadog.* attributes, including native booleans for datadog.span.top_level and known datadog.is_trace_root values.
  • Emits origin, peer tags, configured additional metric tags, and datadog.svc_src as a string when service source is present.
  • Adds Datadog runtime/process resource attributes and generated process-tag precedence.
  • Keeps aggregation extras as Map<String, Object>; no wrapper.

Validation:

  • focused writer and metrics-package tests
  • Spotless
  • forbidden APIs and SpotBugs

Brings the traces.span.sdk.metrics.duration OTLP export in line with
the RFC's attribute spec: emit datadog.process_tags as one arrayValue
resource attribute instead of split per-key attributes, add the
missing datadog.is_trace_root data-point attribute, canonicalize
span.kind to the OTel Span Metrics Connector's uppercase convention,
and emit status.code unconditionally with STATUS_CODE_OK/ERROR values
instead of only on error.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
@mabdinur mabdinur added type: bug fix Bug fix comp: metrics Metrics tag: ai generated Largely based on code generated by an AI or LLM labels Aug 4, 2026
Corrects a reversed static-import order in OtlpResourceJson.java and
reformats a few lines flagged by google-java-format.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
@datadog-prod-us1-3

datadog-prod-us1-3 Bot commented Aug 4, 2026

Copy link
Copy Markdown

🎯 Code Coverage (details)
Patch Coverage: 94.12%
Overall Coverage: 58.02% (+0.13%)

This comment will be updated automatically if new data arrives.
🔗 Commit SHA: af33600 | Docs | Datadog PR Page | Give us feedback!

@dd-octo-sts

dd-octo-sts Bot commented Aug 4, 2026

Copy link
Copy Markdown
Contributor

🟢 Java Benchmark SLOs — All performance SLOs passed

Suite Status
Startup 🟢 pass

SLO thresholds are defined here based on automatically generated metrics. A warning is raised when results are within 5% of the threshold.

PR vs. master results
Scenario Candidate master Δ (95% CI of mean)
startup:insecure-bank:iast:Agent 14.78 s 14.71 s [-0.4%; +1.5%] (no difference)
startup:insecure-bank:tracing:Agent 13.71 s 13.73 s [-1.1%; +0.8%] (no difference)
startup:petclinic:appsec:Agent 16.87 s 16.76 s [-0.3%; +1.6%] (no difference)
startup:petclinic:iast:Agent 16.93 s 17.00 s [-1.3%; +0.5%] (no difference)
startup:petclinic:profiling:Agent 16.75 s 16.71 s [-0.7%; +1.2%] (no difference)
startup:petclinic:sca:Agent 16.19 s 16.56 s [-6.4%; +2.0%] (no difference)
startup:petclinic:tracing:Agent 16.23 s 16.15 s [-0.5%; +1.5%] (no difference)

Commit: af336003 · CI Pipeline · Benchmarking Platform UI


Load and DaCapo benchmarks can be triggered manually in the GitLab pipeline. Results will appear in the Benchmarking Platform UI after completion.

service.name was only emitted on a data point when it differed from
the writer's configured default service, which contradicts the RFC's
always-present requirement already applied to status.code, span.kind,
and is_trace_root. Drop the now-unused defaultService field/param.
The earlier spotless fix collapsed this Javadoc onto one physical
line, but the formatter's own target (confirmed from the spotless
job trace) keeps the three-line /** ... */ block and only unwraps
the content itself onto a single line inside it.
mabdinur and others added 2 commits August 5, 2026 12:16
Reuses the existing STRING_ARRAY_ATTRIBUTE visitor plumbing already
wired for both proto and JSON collectors.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
@mabdinur
mabdinur requested a review from mhlidd August 5, 2026 19:51
@mabdinur
mabdinur marked this pull request as ready for review August 5, 2026 19:51
@mabdinur
mabdinur requested a review from a team as a code owner August 5, 2026 19:51

@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: e47c3183cf

ℹ️ 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".

@datadog-prod-us1-3 datadog-prod-us1-3 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.

Datadog Autotest: FAIL

When process-tag propagation is enabled, a user global tag named datadog.process_tags produces two OTLP resource attributes with the same key: the user string and the new process-tag array. Duplicate OTLP keys have ambiguous consumer behavior, so the generated array must take precedence.

View proposed fix
📊 Validated against 10 scenarios · Open Bits AI session

🤖 Datadog Autotest · Commit e47c318 · What is Autotest? · @DataDog review to ask questions · Any feedback? Reach out in #autotest

@mhlidd mhlidd left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Overall LGTM, just some small comments

@mabdinur

mabdinur commented Aug 7, 2026

Copy link
Copy Markdown
Contributor Author

/merge

@gh-worker-devflow-routing-ef8351

gh-worker-devflow-routing-ef8351 Bot commented Aug 7, 2026

Copy link
Copy Markdown

View all feedbacks in Devflow UI.

2026-08-07 05:20:13 UTC ℹ️ Start processing command /merge
Use /merge -c to cancel this operation!


2026-08-07 05:20:17 UTC ℹ️ MergeQueue: pull request added to the queue

The expected merge time in master is approximately 1h (p90).

Use /merge -c to cancel this operation!


⏳ Building merge commit 9345af5917 in pipeline 2486063532752091634...

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

comp: metrics Metrics tag: ai generated Largely based on code generated by an AI or LLM type: bug fix Bug fix

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants