Skip to content

Export propagation tags in OTLP trace export - #12985

Draft
anna-git wants to merge 1 commit into
masterfrom
anna.yafi/otlp-export-propagation-tags
Draft

anna-git wants to merge 1 commit into
masterfrom
anna.yafi/otlp-export-propagation-tags

Conversation

@anna-git

@anna-git anna-git commented Oct 21, 2026 •

Copy link
Copy Markdown

What Does This Do

Exports the span propagation tags (_dd.p.dm, _dd.p.ksr, _dd.p.tid, ...) and baggage-as-tags items as string attributes in OTLP trace export (protobuf and JSON), mirroring the Datadog mappers:

  • OtlpTraceProto / OtlpTraceJson MetaWriters now write Metadata.getBaggage(), which was computed but never serialized. Span tags win on a key clash, so OTLP attribute keys stay unique.
  • Propagation tags are requested only for the local root span (ROOT_PROPAGATION_TAGS), like TraceMapperV0_4/V0_5; child spans don't carry _dd.p.* (no per-span _dd.p.tid).

Motivation

With DD_TRACE_OTEL_EXPORTER=otlp, remote and adaptive sampling rules are applied (priority, _dd.rule_psr are exported), but the sampling decision maker _dd.p.dm never was. The Agent then falls back to a default decision maker, so the backend doesn't count the traffic as rule/adaptive-sampled and adaptive sampling can't converge for the service.

This complements DataDog/datadog-agent#58471, which preserves _dd.p.dm from OTLP span attributes (or t.dm from a tracestate dd= member). The .NET equivalent is DataDog/dd-trace-dotnet#9498.

Additional Notes

  • Validated with a local DDOT collector and remote/adaptive sampling rules: before, traces reached intake with _dd.p.dm:-4; with this change the root span is expected to carry the rule's decision maker (-11 remote user rule / -12 remote adaptive rule), which the Agent keeps with [trace-agent] Preserve tracer sampling decision maker in OTLP receiver datadog-agent#58471. The end-to-end run with this exact build is still to do.
  • Unit tests: new propagationTagsAreWrittenOnTheLocalRootSpanOnly in OtlpTraceProtoTest and OtlpTraceJsonCollectorTest (fail before, pass after). :dd-trace-core:spotlessCheck couldn't run locally because the Eclipse p2 site used by the Groovy formatter was down; changed files were checked with google-java-format 1.36.1.
  • Follow-ups, not in this PR:
    • Locally started traces have no dd= tracestate member, so the OTLP trace_state doesn't carry t.dm.
    • Partial flushes: chunks without the local root span carry no _dd.p.*, while the Datadog mappers put them on the first span of each chunk.

Contributor Checklist

Jira ticket: N/A

🤖 Generated with Claude Code

The OTLP trace writers dropped the Metadata baggage map, which carries the
propagation tags (_dd.p.dm, _dd.p.ksr, _dd.p.tid...) and baggage items
injected as tags. Write it like the Datadog mappers do, with propagation
tags on the local root span only, so the sampling decision maker reaches
the Agent.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@anna-git anna-git added type: bug fix Bug fix comp: core Tracer core tag: ai generated Largely based on code generated by an AI or LLM labels Oct 21, 2026
@datadog-datadog-prod-us1

This comment has been minimized.

@dd-octo-sts

dd-octo-sts Bot commented Oct 21, 2026

Copy link
Copy Markdown
Contributor

🟡 Java Benchmark SLOs — Performance SLO warning (near threshold)

Suite Status
Startup 🟡 warning

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 13.99 s 13.89 s [-0.2%; +1.6%] (no difference)
startup:insecure-bank:tracing:Agent 12.92 s 12.92 s [-0.9%; +0.8%] (no difference)
startup:petclinic:appsec:Agent 17.74 s 17.56 s [+0.0%; +2.0%] (maybe worse)
startup:petclinic:iast:Agent 16.85 s 17.65 s [-8.8%; -0.2%] (maybe better)
startup:petclinic:profiling:Agent 17.27 s 17.44 s [-2.0%; +0.0%] (no difference)
startup:petclinic:sca:Agent 17.81 s 17.63 s [-0.1%; +2.1%] (no difference)
startup:petclinic:tracing:Agent 16.65 s 16.64 s [-1.0%; +1.2%] (no difference)

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

This branch has not been deployed

No deployments
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: bug fix Bug fix

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant