Skip to content

Require explicit opt-in for OTLP APM RED metrics computation - #13261

Merged
gh-worker-dd-mergequeue-cf854d[bot] merged 5 commits into
masterfrom
codex/otlp-trace-stats-explicit-opt-in
Nov 16, 2026
Merged

gh-worker-dd-mergequeue-cf854d[bot] merged 5 commits into
masterfrom
codex/otlp-trace-stats-explicit-opt-in

Conversation

@mabdinur

@mabdinur mabdinur commented Nov 5, 2026 •

Copy link
Copy Markdown
Contributor

What Does This Do

Require explicit opt-in for SDK-computed APM RED metrics when exporting traces over OTLP. By default, the OpenTelemetry Collector or Datadog intake computes these metrics.

Native stats remain enabled when traces go to a Datadog Agent writer, including writer overrides and mixed Agent/OTLP writers. The aggregator and Agent request header use the same decision, so the Agent is told that stats are computed only when the SDK actually computes them.

Motivation

Align Java with the shared OTLP metrics contract in DataDog/system-tests#8237 and avoid duplicate SDK computation by default.

Additional Notes

Upgrade / release note: Implicit SDK span-metrics enablement shipped in 1.64.0. OTLP users who relied on that default will stop receiving SDK-computed span metrics after upgrading with this change. Configure APM RED metrics computation in the Collector or Datadog intake; SDK computation now requires explicit opt-in.

Validation: 5,837 internal API tests and 89 selected core tests passed, including 16 writer/aggregator/header combinations. Five of those regression cases failed before the fix. Full Spotless formatting, changed-module formatting checks, and a fresh agent/API build passed. All 18 focused shared system tests passed against merged revision 339de2815c638ce0faa98e02570301ad82e2473b, covering opt-in/defaults, native/OTLP mutual exclusion and client-computed-stats headers (--runxfail to exercise the pending Java activation).

Related: DataDog/dd-trace-py#21389 (merged), DataDog/dd-trace-go#5773 (merged), DataDog/dd-trace-js#11105, DataDog/dd-trace-dotnet#9628.

Contributor Checklist

  • Title and labels follow repository conventions.
  • No source files were added, moved or deleted.
  • No public configuration flag is introduced; the opt-in remains internal.
  • Jira ticket: not supplied.

@datadog-datadog-prod-us1-2

datadog-datadog-prod-us1-2 Bot commented Nov 5, 2026 •

Copy link
Copy Markdown
Contributor

🎯 Code Coverage (details)
• Patch Coverage: 17.65%
• Overall Coverage: 59.75% (-0.02%)

This comment will be updated automatically if new data arrives.
🔗 Commit SHA: 0bc8e48 | Docs | Give us feedback!

@dd-octo-sts

dd-octo-sts Bot commented Nov 5, 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.03 s 14.00 s [-0.5%; +1.0%] (no difference)
startup:insecure-bank:tracing:Agent 13.01 s 12.92 s [-0.1%; +1.4%] (no difference)
startup:petclinic:appsec:Agent 17.73 s 17.54 s [+0.0%; +2.1%] (maybe worse)
startup:petclinic:iast:Agent 17.40 s 17.58 s [-1.9%; -0.1%] (maybe better)
startup:petclinic:profiling:Agent 17.42 s 17.17 s [+0.3%; +2.6%] (maybe worse)
startup:petclinic:sca:Agent 17.76 s 17.50 s [+0.8%; +2.2%] (maybe worse)
startup:petclinic:tracing:Agent 16.30 s 16.36 s [-6.3%; +5.6%] (unstable)

Commit: 0bc8e48d · 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.

@mabdinur
mabdinur marked this pull request as ready for review November 6, 2026 19:09
@mabdinur
mabdinur requested review from a team as code owners November 6, 2026 19:09
@mabdinur
mabdinur requested review from AlexeyKuznetsov-DD and removed request for a team November 6, 2026 19:09
@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Nov 6, 2026 •

Copy link
Copy Markdown

Codex Review Summary

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review ✅ Completed 2026-11-06T19:11:42.898996Z 4aa0480 Draft marked ready
🔒 Security Review ✅ Completed 2026-11-06T19:12:29.839709Z 4aa0480 Draft marked ready
ℹ️ 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" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

@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: 4aa04808b9

ℹ️ 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-datadog-prod-us1-2 datadog-datadog-prod-us1-2 Bot 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.

Bits Code Review: FAIL

An explicit DDAgentWriter override can lose APM RED metrics: the new guard disables local aggregation while native trace requests still tell the Agent that stats were computed.

Open Bits AI session

🤖 Bits Code Review · Commit 4aa0480

@dougqh dougqh 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.

The bots' point about isTraceOtlpExporterEnabled() vs the effective writer is real, and I think it goes a bit further. DDAgentApi sets Datadog-Client-Computed-Stats from config.isTracerMetricsEnabled() independently of the aggregator factory. So with trace.otel.exporter=otlp but traces still going to the agent (writer.type=DDAgentWriter, or a MultiWriter shipping to both agent and OTLP during a migration), we'd install the no-op aggregator while telling the agent stats were computed client-side, and those traces would get no stats at all. isOtlpTracesExportEnabled() alone wouldn't cover the MultiWriter case either.

Could we derive a single "native stats active" predicate (tracer metrics on and traces reach a DD agent writer) and use it in both the factory and the DDAgentApi header, so they can't disagree?

Also, since the old tri-state default shipped in 1.64.0, the release note should spell out that OTLP users relying on it will stop getting SDK-computed span metrics on upgrade.

@mabdinur

mabdinur commented Nov 11, 2026 •

Copy link
Copy Markdown
Contributor Author

Addressed comment in 3239dc1: the aggregator and Agent header now share a native-stats predicate based on the configured writers, including overrides and mixed Agent/OTLP writers.

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

Bits Code Review: PASS

More details

The PR makes SDK-computed OTLP APM RED metrics opt-in, delegating computation to the Collector or intake by default. The earlier native-writer override defect is fixed: aggregation and Agent headers now share writer-aware eligibility, including mixed writers, and no findings remain open.

Was this helpful? React 👍 or 👎

Open Bits AI session

🤖 Bits Code Review · Commit 3239dc1

@mabdinur
mabdinur requested review from 0intro, dougqh and mhlidd and removed request for 0intro November 11, 2026 19:15

@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 looks good.

nit: Can we also update DDAgentFeaturesDiscovery and DDAgentWriter where isTracerMetricsEnabled() is still invoked?

@mabdinur
mabdinur requested a review from mhlidd November 16, 2026 14:43

@dougqh dougqh 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.

Thanks, this addresses my earlier comments. isNativeTracerMetricsEnabled() is now the single check behind both the aggregator choice and the Datadog-Client-Computed-Stats header, and statsAggregatorMatchesAgentHeader covers the writer-override and mixed MultiWriter cases. The upgrade note is in the description too.

Non-blocking nit: Config.isAgentWriterType copies WriterFactory's fallback for unrecognized writer types (unknown means DDAgentWriter). The table test would catch drift, but a comment pointing at WriterFactory would help the next person who adds a writer type.

One GitLab smoke shard (test_smoke: [21, 5/8]) is red. I didn't dig into it, so it's worth a retry before merging.

@mabdinur

Copy link
Copy Markdown
Contributor Author

A comment pointing at WriterFactory would help; the smoke shard is worth a retry before merging.

Confirmed: isAgentWriterType already points to WriterFactory’s fallback; smoke retry 2258303249 passed, and all checks are now green.

@mabdinur

Copy link
Copy Markdown
Contributor Author

/merge

@gh-worker-devflow-routing-ef8351

gh-worker-devflow-routing-ef8351 Bot commented Nov 16, 2026 •

Copy link
Copy Markdown

View all feedbacks in Devflow UI.

2026-11-16 21:08:12 UTC ℹ️ Start processing command /merge


2026-11-16 21:08:16 UTC ℹ️ MergeQueue: pull request added to the queue

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


2026-11-16 22:10:10 UTC ℹ️ MergeQueue: This merge request was merged

@gh-worker-dd-mergequeue-cf854d
gh-worker-dd-mergequeue-cf854d Bot merged commit 48c3597 into master Nov 16, 2026
685 checks passed
@gh-worker-dd-mergequeue-cf854d
gh-worker-dd-mergequeue-cf854d Bot deleted the codex/otlp-trace-stats-explicit-opt-in branch November 16, 2026 22:10
@github-actions github-actions Bot added this to the 1.70.0 milestone Nov 16, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

comp: config Configuration 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.

3 participants