Skip to content

Fix OTLP trace-metrics attribute compliance gaps - #12144

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

Fix OTLP trace-metrics attribute compliance gaps#12144
mabdinur wants to merge 12 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 contract exercised by system-tests#7363.

  • Always emits service.name and string-valued status.code; canonicalizes span.kind to SPAN_KIND_* and defaults it to SPAN_KIND_INTERNAL.
  • Emits datadog.process_tags as a resource array and captured peer tags as datadog.peer_tags.
  • Emits datadog.is_trace_root separately from datadog.span.top_level; both use native OTLP boolean values.
  • Emits configured additional metric tags as individual, unprefixed data-point attributes.
  • In OTel semantic mode, retains OTel semantic and unprefixed custom attributes while suppressing datadog.* and _datadog.* attributes.
  • Keeps aggregation extras as Map<String, Object>; this does not introduce an additional wrapper type.

Validation

Added focused JSON/protobuf serialization coverage. Unit tests, Spotless, forbidden-API checks, and SpotBugs pass locally.

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: 97.92%
Overall Coverage: 57.91% (-0.00%)

This comment will be updated automatically if new data arrives.
🔗 Commit SHA: 35657c0 | 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.90 s 14.68 s [+0.6%; +2.4%] (maybe worse)
startup:insecure-bank:tracing:Agent 13.61 s 13.74 s [-1.6%; -0.2%] (maybe better)
startup:petclinic:appsec:Agent 16.90 s 16.74 s [+0.0%; +1.9%] (maybe worse)
startup:petclinic:iast:Agent 16.93 s 16.88 s [-0.5%; +1.0%] (no difference)
startup:petclinic:profiling:Agent 16.64 s 16.80 s [-2.3%; +0.4%] (no difference)
startup:petclinic:sca:Agent 16.77 s 16.05 s [+0.1%; +8.9%] (maybe worse)
startup:petclinic:tracing:Agent 16.09 s 16.09 s [-0.9%; +0.9%] (no difference)

Commit: 35657c08 · 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

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.

1 participant