Skip to content

Report OTLP export status in tracer startup log#12062

Open
bm1549 wants to merge 3 commits into
masterfrom
brian.marks/otlp-export-startup-log
Open

Report OTLP export status in tracer startup log#12062
bm1549 wants to merge 3 commits into
masterfrom
brian.marks/otlp-export-startup-log

Conversation

@bm1549

@bm1549 bm1549 commented Jul 24, 2026

Copy link
Copy Markdown
Contributor

What Does This Do

Adds three boolean fields to the DATADOG TRACER CONFIGURATION startup log emitted by dd-trace-core's StatusLogger:

Key Backed by Reports
otlp_traces_export_enabled Config.isOtlpTracesExportEnabled() whether the trace writer WriterFactory builds is an OtlpWriter, including when it is one of a MultiWriter's sub-writers
otlp_metrics_export_enabled Config.isOtlpMetricsExportEnabled() (isMetricsOtelEnabled() && isMetricsOtlpExporterEnabled()) || isOtelTracesSpanMetricsEnabled()
otlp_logs_export_enabled Config.isOtlpLogsExportEnabled() isLogsOtelEnabled() && isLogsOtlpExporterEnabled()

The three accessors live on Config rather than inline in StatusLogger.toJson, which forwards a Config getter for every one of its other fields.

StatusLoggerTest is new. Its 13 tests cover the default disabled case, the fully-enabled case, the case where the OTLP exporter is selected but the metrics and logs OTel signals stay disabled, both routes to metrics export, and seven writer-type values that pin which ones do and do not resolve to an OtlpWriter.

Motivation

Part of a cross-tracer effort to report OTLP export status in each tracer's startup log. The JSON keys are identical across the dd-trace-* libraries so the fields can be read the same way regardless of language.

Additional Notes

The traces field cannot read dd.trace.otel.exporter alone. dd.writer.type takes precedence over it, and WriterFactory resolves that value through an ordered dispatch that can produce an OtlpWriter nested inside a MultiWriter. isOtlpTracesExportEnabled mirrors that dispatch instead of comparing the raw setting, so the flag reports what the tracer actually built.

Metrics export has two independent triggers: the OTel metrics signal paired with the OTLP exporter, or dd.trace.otel.span.metrics.enabled, which routes span metrics over OTLP on its own.

Three things I'd like your take on:

  • The accessor names mirror the emitted JSON keys one-for-one, which reads as a word-order permutation of the existing isTraceOtlpExporterEnabled and friends. Naming them after the keys keeps the startup-log contract greppable, but it is a judgment call and I would take a different convention if you prefer one.
  • isOtlpTracesExportEnabled re-implements the MultiWriter:a,b grammar that MultiWriter parses. Extracting a shared parser both could use is the cleaner end state; I left it out because it would change trace-writer construction for the sake of a diagnostic flag. Happy to do it in a follow-up.
  • A writer type that splices the literal prefix inside itself, such as MultiWriter:MultiWriMultiWriter:ter:OtlpWriter, still under-reports, because MultiWriter re-parses at every nesting level while this accessor parses once. Matching it exactly needs either a fixpoint loop or the same unbounded recursion MultiWriter has, and no reachable configuration produces such a value, so I left the single pass in place.

This is a diagnostic logging change and does not alter tracer runtime behavior.

Contributor Checklist


Related PRs — cross-tracer OTLP startup-log effort

Report whether the tracer exports each telemetry signal over OTLP in the
"DATADOG TRACER CONFIGURATION" startup log via three boolean fields:
otlp_traces_export_enabled, otlp_metrics_export_enabled, and
otlp_logs_export_enabled. Metrics and logs require both the OTel signal to
be enabled and the OTLP exporter to be selected.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
@datadog-official

This comment has been minimized.

@dd-octo-sts

dd-octo-sts Bot commented Jul 24, 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.01 s 13.93 s [-0.1%; +1.2%] (no difference)
startup:insecure-bank:tracing:Agent 12.96 s 13.02 s [-1.2%; +0.2%] (no difference)
startup:petclinic:appsec:Agent 16.89 s 16.78 s [-0.6%; +2.0%] (no difference)
startup:petclinic:iast:Agent 16.88 s 16.49 s [-2.0%; +6.8%] (no difference)
startup:petclinic:profiling:Agent 16.69 s 16.74 s [-1.6%; +1.0%] (no difference)
startup:petclinic:sca:Agent 16.91 s 16.75 s [+0.0%; +2.0%] (maybe worse)
startup:petclinic:tracing:Agent 16.15 s 16.23 s [-1.4%; +0.4%] (no difference)

Commit: 6d1065b2 · 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.

@bm1549
bm1549 marked this pull request as ready for review July 24, 2026 21:38
@bm1549
bm1549 requested a review from a team as a code owner July 24, 2026 21:38
@bm1549
bm1549 requested a review from mcculls July 24, 2026 21:38

@datadog-official datadog-official 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.

Datadog Autotest: PASS

More details

The startup log fields match the runtime activation rules: traces follow OTLP exporter selection, while metrics and logs require both their OTel signal and OTLP exporter to be enabled. Alternate exporters, mixed signal states, and case variations are handled by the existing accessors; no diff-only behavioral regression was identified.

Was this helpful? React 👍 or 👎

Open Bits AI session

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

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

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

Comment thread dd-trace-core/src/main/java/datadog/trace/core/StatusLogger.java Outdated
Comment thread dd-trace-core/src/main/java/datadog/trace/core/StatusLogger.java Outdated
Report otlp_traces_export_enabled from the resolved writer type
(OtlpWriter) rather than the OTLP exporter selection, since an explicit
dd.writer.type override wins over dd.trace.otel.exporter=otlp in
WriterFactory. Also report otlp_metrics_export_enabled when client-side
span metrics are enabled, since those are exported over OTLP via
OtlpStatsMetricWriter independently of the OTel metrics signal.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>

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

Minor comments about style

Comment thread dd-trace-core/src/main/java/datadog/trace/core/StatusLogger.java Outdated
Comment thread dd-trace-core/src/test/java/datadog/trace/core/StatusLoggerTest.java Outdated
Comment thread dd-trace-core/src/test/java/datadog/trace/core/StatusLoggerTest.java Outdated
Move the three derived booleans out of StatusLogger.toJson and into Config
accessors: isOtlpTracesExportEnabled, isOtlpMetricsExportEnabled, and
isOtlpLogsExportEnabled. Every other field toJson emits forwards a Config
getter, so keeping the conjunctions inline made this method the only place in
the file that derives a value it writes.

Fix otlp_traces_export_enabled. It compared dd.writer.type to OtlpWriter for
equality, so MultiWriter:OtlpWriter,DDAgentWriter reported false even though
WriterFactory builds a real OtlpWriter for it. isOtlpTracesExportEnabled now
mirrors WriterFactory's dispatch: a writer type that does not start with
MultiWriter is compared to OtlpWriter directly, and one that does has every
literal MultiWriter: removed before the remainder is split on commas and each
sub-type compared. Removing every occurrence rather than a single leading
prefix matches what MultiWriter itself does, so a repeated prefix such as
MultiWriter:DDAgentWriter,MultiWriter:OtlpWriter resolves the same way in both
places.

Drop the two comment blocks in StatusLogger explaining writer precedence and
span-metrics routing, and the three in StatusLoggerTest. StatusLogger carries
no comments anywhere else, and the reasoning belongs in the commit message and
pull request, which both record it.

Expand StatusLoggerTest to 13 tests and assert with assertFalse and assertTrue
instead of assertEquals against boolean literals. The new cases pin the writer
type grammar: a MultiWriter list that includes OtlpWriter, one that excludes
it, a repeated MultiWriter prefix, a padded sub-type, a sub-type that only
prefixes OtlpWriter, a comma-separated list without the MultiWriter prefix, and
a TraceStructureWriter value that WriterFactory dispatches before it ever
reaches the MultiWriter branch.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

comp: core Tracer core tag: ai generated Largely based on code generated by an AI or LLM type: feature Enhancements and improvements

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants