Skip to content

feat(ddtrace/tracer): add OTLP adoption markers to trace payloads - #5436

Open
mhlidd wants to merge 5 commits into
mainfrom
matthew.li/otlp-adoption-markers
Open

mhlidd wants to merge 5 commits into
mainfrom
matthew.li/otlp-adoption-markers

Conversation

@mhlidd

@mhlidd mhlidd commented Sep 24, 2026 •

Copy link
Copy Markdown
Contributor

What does this PR do?

Adds two wire markers that let the backend attribute ingested spans to the SDK's export path and semantic conventions:

  • _dd.sdk.otlp_export:
    • Native export (v0.4 and v1): "false" goes into the meta of the first span of each chunk. It's set in setTraceTagsLocked under the trace lock, the same place _dd.tags.process is set, and skipped when the tracer exports over OTLP (otlpExportMode).
    • v1: "false" also goes into the payload-level attributes map (field 10), next to _dd.tags.process, on the first push into a payload.
    • OTLP: "true" is a resource attribute.
  • datadog.sdk.semantics, an OTLP resource attribute: "otel" when OTelSemanticsEnabled() is true (DD_TRACE_OTEL_SEMANTICS_ENABLED), "datadog" otherwise.

Both resource attributes are built in buildBaseResourceAttrs, so every OTLP resource carries them: the trace resource and the client-side stats metrics resource. This also lets future OTLP metrics and logs support pick them up.

Motivation

Today, "how many customers run Datadog SDKs emitting OTLP" is answered by dd.trace.intake.ingested_spans, tagged with sdk_name/span_source. Those tags are inferred at ingest time rather than declared by the tracer. The datadogreceiver hardcodes telemetry.sdk.name:Datadog on native payloads it converts, so a native payload that only passed through a Collector looks the same as one a Datadog SDK exported over OTLP. And span_source records which endpoint the payload reached, not the tracer's export mode.

Declaring both modes on the wire lets the backend resolve them into explicit tags and measure adoption directly. Related changes: DataDog/dd-trace-java#12516, DataDog/dd-trace-dotnet#9310 and DataDog/dd-trace-js#10482.

Coordinated change: this PR emits the markers. The Agent (DataDog/datadog-agent#56749) hoists _dd.sdk.otlp_export into the outgoing payload, logs-backend propagates it into chunk tags, and dd-go resolves it into the datadog.sdk.otlp_export metric tag. The wire marker and the metric tag are named differently on purpose.

Notes for reviewers:

  • Chunk scope, set before hand-off: an earlier revision wrote the marker in payloadV04.push, which mutated spans on the writer goroutine after they had been handed off. The race detector flagged it in TestTracerReportsHostname. The marker is now set before hand-off, under the trace lock, on the first span of each chunk. That matches the RFC's wording and how process tags are handled here; dd-trace-java writes it once per payload.
  • v1 carries it twice, on purpose: under v1 the marker is both a payload attribute and first-span meta. The agent reads the payload attribute first, falls back to first-span meta, never strips span meta, and both always say "false". This avoids gating on the effective protocol, which can change at runtime.
  • Why OTLP is still skipped: without that check, the first span of each chunk would carry "false" while the OTLP resource says "true". The agent's OTLP receiver deliberately doesn't hoist, and OTLP-origin spans keep the value in span meta, so the contradictory value would reach intake. The check reuses the existing otlpExportMode field. CI Visibility and the log/stdout (Lambda) writers are native Datadog export and get "false".
  • No span-attribute filter: matching dd-trace-java, a user tag with either key is not stripped from OTLP span attributes.
  • Map order: the v1 payload attributes map now holds two keys and is encoded in map iteration order. So TestPayloadV1PreGrowWireIntegrity compares the size-hinted and reference payloads decoded (plus byte length) instead of byte-for-byte.
  • Tests:
    • TestOTLPExportMarkerOnChunks: partial flush makes two chunks; the marker is on each chunk's first span under v0.4 and v1, and absent under OTLP.
    • The v1 payload-attribute test and the OTLP resource and semantics tests are kept; the stats metrics resource tests pass the new semantics argument.
    • Results: gofmt and go vet are clean. The affected ddtrace/tracer tests pass with -race. TestAutoDetectStatsd fails locally, as it did on main in an earlier local run (it looks sensitive to a local agent). scripts/checklocks.sh wasn't run locally because the tool isn't installed here; CI covers it.

Reviewer's Checklist

  • Changed code has unit tests for its functionality at or near 100% coverage.
  • System-Tests covering this feature have been added and enabled with the va.b.c-dev version tag.
  • There is a benchmark for any new code, or changes to existing code.
  • If this interacts with the agent in a new way, a system test has been added.
  • New code is free of linting errors. You can check this by running make lint locally.
  • New code doesn't break existing tests. You can check this by running make test locally.
  • Add an appropriate team label so this PR gets put in the right place for the release notes.
  • All generated files are up to date. You can check this by running make generate locally.
  • Non-trivial go.mod changes, e.g. adding new modules, are reviewed by @DataDog/dd-trace-go-guild. Make sure all nested modules are up to date by running make fix-modules locally.

🤖 Generated with Claude Code

Declare the export mode and semantics mode on the wire so the backend can
measure OTLP adoption instead of inferring it at ingest time. Native payloads
carry _dd.sdk.otlp_export=false once per payload (first span meta for v0.4,
payload attributes for v1); OTLP exports carry _dd.sdk.otlp_export=true and
datadog.sdk.semantics as resource attributes.

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
@mhlidd mhlidd added the AI Generated Largely based on code generated by an AI or LLM. This label is the same across all dd-trace-* repos label Sep 24, 2026
@github-actions

Copy link
Copy Markdown
Contributor

Config Audit

PACKAGE: contrib/cloud.google.com/go/pubsubtrace
  STATUS      CONFIG                                            CALL_SITES
  UNMIGRATED  DD_GOOGLE_CLOUD_PUBSUB_PROPAGATION_AS_SPAN_LINKS  1

PACKAGE: contrib/confluentinc/confluent-kafka-go/kafkatrace
  STATUS      CONFIG                            CALL_SITES
  UNMIGRATED  DD_TRACE_KAFKA_ANALYTICS_ENABLED  1

PACKAGE: crashtracker
  STATUS      CONFIG                    CALL_SITES
  STILL_READ  DD_API_KEY                1
  STILL_READ  DD_SITE                   1
  STILL_READ  DD_TAGS                   1
  UNMIGRATED  DD_CRASHTRACKING_ENABLED  1

PACKAGE: ddtrace/opentelemetry/log
  STATUS      CONFIG                            CALL_SITES
  STILL_READ  DD_AGENT_HOST                     2
  STILL_READ  DD_ENV                            1
  STILL_READ  DD_SERVICE                        1
  STILL_READ  DD_TAGS                           1
  STILL_READ  DD_TRACE_AGENT_URL                2
  STILL_READ  DD_TRACE_REPORT_HOSTNAME          1
  STILL_READ  DD_VERSION                        1
  STILL_READ  OTEL_EXPORTER_OTLP_ENDPOINT       4
  STILL_READ  OTEL_EXPORTER_OTLP_HEADERS        2
  STILL_READ  OTEL_EXPORTER_OTLP_PROTOCOL       2
  UNMIGRATED  DD_HOSTNAME                       1
  UNMIGRATED  OTEL_BLRP_EXPORT_TIMEOUT          1
  UNMIGRATED  OTEL_BLRP_MAX_EXPORT_BATCH_SIZE   1
  UNMIGRATED  OTEL_BLRP_MAX_QUEUE_SIZE          1
  UNMIGRATED  OTEL_BLRP_SCHEDULE_DELAY          1
  UNMIGRATED  OTEL_EXPORTER_OTLP_LOGS_ENDPOINT  4
  UNMIGRATED  OTEL_EXPORTER_OTLP_LOGS_HEADERS   2
  UNMIGRATED  OTEL_EXPORTER_OTLP_LOGS_PROTOCOL  2
  UNMIGRATED  OTEL_EXPORTER_OTLP_LOGS_TIMEOUT   1
  UNMIGRATED  OTEL_EXPORTER_OTLP_TIMEOUT        1
  UNMIGRATED  OTEL_RESOURCE_ATTRIBUTES          1

PACKAGE: ddtrace/opentelemetry/metric
  STATUS      CONFIG                                             CALL_SITES
  STILL_READ  DD_AGENT_HOST                                      2
  STILL_READ  DD_ENV                                             1
  STILL_READ  DD_METRICS_OTEL_ENABLED                            1
  STILL_READ  DD_SERVICE                                         1
  STILL_READ  DD_TAGS                                            1
  STILL_READ  DD_TRACE_AGENT_URL                                 2
  STILL_READ  DD_TRACE_REPORT_HOSTNAME                           1
  STILL_READ  DD_VERSION                                         1
  STILL_READ  OTEL_EXPORTER_OTLP_ENDPOINT                        2
  STILL_READ  OTEL_EXPORTER_OTLP_HEADERS                         1
  STILL_READ  OTEL_EXPORTER_OTLP_METRICS_ENDPOINT                2
  STILL_READ  OTEL_EXPORTER_OTLP_METRICS_HEADERS                 1
  STILL_READ  OTEL_EXPORTER_OTLP_METRICS_PROTOCOL                2
  STILL_READ  OTEL_EXPORTER_OTLP_PROTOCOL                        2
  STILL_READ  OTEL_METRICS_EXPORTER                              1
  UNMIGRATED  DD_HOSTNAME                                        1
  UNMIGRATED  OTEL_EXPORTER_OTLP_METRICS_TEMPORALITY_PREFERENCE  1
  UNMIGRATED  OTEL_EXPORTER_OTLP_TIMEOUT                         1
  UNMIGRATED  OTEL_RESOURCE_ATTRIBUTES                           1
  UNMIGRATED  OTEL_SERVICE_NAME                                  1

PACKAGE: ddtrace/tracer
  STATUS      CONFIG                                    CALL_SITES
  STILL_READ  DD_TRACE_PROPAGATION_BEHAVIOR_EXTRACT     1
  STILL_READ  DD_TRACE_PROPAGATION_EXTRACT_FIRST        1
  STILL_READ  DD_TRACE_PROPAGATION_STYLE_EXTRACT        1
  STILL_READ  DD_TRACE_PROPAGATION_STYLE_INJECT         1
  UNMIGRATED  DD_APM_TRACING_ENABLED                    1
  UNMIGRATED  DD_TRACE_128_BIT_TRACEID_LOGGING_ENABLED  1
  UNMIGRATED  DD_TRACE_DEBUG_SEELOG_WORKAROUND          1
  UNMIGRATED  OTEL_TRACES_SAMPLER_ARG                   1

PACKAGE: instrumentation
  STATUS      CONFIG                                       CALL_SITES
  STILL_READ  DD_DATA_STREAMS_ENABLED                      1
  UNMIGRATED  DD_API_SECURITY_ENDPOINT_COLLECTION_ENABLED  1

PACKAGE: instrumentation/graphql
  STATUS      CONFIG                             CALL_SITES
  UNMIGRATED  DD_TRACE_GRAPHQL_ERROR_EXTENSIONS  1

PACKAGE: instrumentation/httptrace
  STATUS      CONFIG                                                 CALL_SITES
  UNMIGRATED  DD_GOOGLE_CLOUD_PUBSUB_PROPAGATION_AS_SPAN_LINKS       1
  UNMIGRATED  DD_TRACE_BAGGAGE_TAG_KEYS                              1
  UNMIGRATED  DD_TRACE_CLIENT_IP_ENABLED                             1
  UNMIGRATED  DD_TRACE_HTTP_SERVER_ERROR_STATUSES                    1
  UNMIGRATED  DD_TRACE_HTTP_URL_QUERY_STRING_ALLOWLIST               1
  UNMIGRATED  DD_TRACE_HTTP_URL_QUERY_STRING_ALLOWLIST_CLIENT        1
  UNMIGRATED  DD_TRACE_HTTP_URL_QUERY_STRING_ALLOWLIST_SERVER        1
  UNMIGRATED  DD_TRACE_HTTP_URL_QUERY_STRING_DISABLED                1
  UNMIGRATED  DD_TRACE_INFERRED_PROXY_SERVICES_ENABLED               1
  UNMIGRATED  DD_TRACE_OBFUSCATION_QUERY_STRING_REGEXP               2
  UNMIGRATED  DD_TRACE_RESOURCE_RENAMING_ALWAYS_SIMPLIFIED_ENDPOINT  1
  UNMIGRATED  DD_TRACE_RESOURCE_RENAMING_ENABLED                     1

PACKAGE: instrumentation/internal/namingschema
  STATUS      CONFIG                                             CALL_SITES
  STILL_READ  DD_SERVICE                                         1
  STILL_READ  DD_TRACE_SPAN_ATTRIBUTE_SCHEMA                     1
  UNMIGRATED  DD_TRACE_REMOVE_INTEGRATION_SERVICE_NAMES_ENABLED  1

PACKAGE: internal
  STATUS      CONFIG                         CALL_SITES
  STILL_READ  DD_AGENT_HOST                  1
  STILL_READ  DD_TAGS                        1
  STILL_READ  DD_TRACE_AGENT_PORT            1
  STILL_READ  DD_TRACE_AGENT_URL             1
  UNMIGRATED  DD_EXTERNAL_ENV                1
  UNMIGRATED  DD_GIT_COMMIT_SHA              1
  UNMIGRATED  DD_GIT_REPOSITORY_URL          1
  UNMIGRATED  DD_TRACE_GIT_METADATA_ENABLED  1

PACKAGE: internal/appsec
  STATUS      CONFIG           CALL_SITES
  UNMIGRATED  DD_APPSEC_RULES  1

PACKAGE: internal/appsec/config
  STATUS      CONFIG                                                CALL_SITES
  UNMIGRATED  DD_API_SECURITY_DOWNSTREAM_BODY_ANALYSIS_SAMPLE_RATE  1
  UNMIGRATED  DD_API_SECURITY_ENABLED                               1
  UNMIGRATED  DD_API_SECURITY_MAX_DOWNSTREAM_REQUEST_BODY_ANALYSIS  1
  UNMIGRATED  DD_API_SECURITY_PROXY_SAMPLE_RATE                     1
  UNMIGRATED  DD_API_SECURITY_REQUEST_SAMPLE_RATE                   1
  UNMIGRATED  DD_API_SECURITY_SAMPLE_DELAY                          1
  UNMIGRATED  DD_APM_TRACING_ENABLED                                1
  UNMIGRATED  DD_APPSEC_AGENTIC_ONBOARDING                          1
  UNMIGRATED  DD_APPSEC_ENABLED                                     2
  UNMIGRATED  DD_APPSEC_MAX_STACK_TRACE_DEPTH                       1
  UNMIGRATED  DD_APPSEC_RASP_ENABLED                                1
  UNMIGRATED  DD_APPSEC_RULES                                       1
  UNMIGRATED  DD_APPSEC_SCA_ENABLED                                 1
  UNMIGRATED  DD_APPSEC_STACK_TRACE_ENABLED                         1
  UNMIGRATED  DD_APPSEC_TRACE_RATE_LIMIT                            1
  UNMIGRATED  DD_APPSEC_WAF_TIMEOUT                                 1

PACKAGE: internal/bazel
  STATUS      CONFIG                                  CALL_SITES
  UNMIGRATED  DD_TEST_OPTIMIZATION_MANIFEST_FILE      1
  UNMIGRATED  DD_TEST_OPTIMIZATION_PAYLOADS_IN_FILES  1

PACKAGE: internal/civisibility/envconfig
  STATUS      CONFIG                   CALL_SITES
  STILL_READ  DD_CIVISIBILITY_ENABLED  1

PACKAGE: internal/civisibility/integrations
  STATUS      CONFIG                                               CALL_SITES
  STILL_READ  DD_SERVICE                                           1
  STILL_READ  DD_TRACE_DEBUG                                       1
  UNMIGRATED  DD_CIVISIBILITY_CODE_COVERAGE_REPORT_UPLOAD_ENABLED  1
  UNMIGRATED  DD_CIVISIBILITY_EARLY_FLAKE_DETECTION_ENABLED        1
  UNMIGRATED  DD_CIVISIBILITY_EARLY_FLAKE_DETECTION_MAX_RETRIES    1
  UNMIGRATED  DD_CIVISIBILITY_FLAKY_RETRY_COUNT                    1
  UNMIGRATED  DD_CIVISIBILITY_FLAKY_RETRY_ENABLED                  1
  UNMIGRATED  DD_CIVISIBILITY_GIT_UPLOAD_ENABLED                   1
  UNMIGRATED  DD_CIVISIBILITY_IMPACTED_TESTS_DETECTION_ENABLED     1
  UNMIGRATED  DD_CIVISIBILITY_SUBTEST_FEATURES_ENABLED             1
  UNMIGRATED  DD_CIVISIBILITY_TOTAL_FLAKY_RETRY_COUNT              1
  UNMIGRATED  DD_TEST_MANAGEMENT_ATTEMPT_TO_FIX_RETRIES            1
  UNMIGRATED  DD_TEST_MANAGEMENT_ENABLED                           1

PACKAGE: internal/civisibility/integrations/gotesting
  STATUS      CONFIG                                                           CALL_SITES
  UNMIGRATED  DD_CIVISIBILITY_INTERNAL_PARALLEL_EARLY_FLAKE_DETECTION_ENABLED  2
  UNMIGRATED  DD_CIVISIBILITY_RETRY_EXECUTION_MODE                             1
  UNMIGRATED  DD_CIVISIBILITY_RETRY_PROCESS_MAX_CONCURRENCY                    1
  UNMIGRATED  DD_CIVISIBILITY_RETRY_PROCESS_TIMEOUT                            1
  UNMIGRATED  DD_TEST_MANAGEMENT_ENABLED                                       2

PACKAGE: internal/civisibility/integrations/logs
  STATUS      CONFIG                        CALL_SITES
  UNMIGRATED  DD_CIVISIBILITY_LOGS_ENABLED  1

PACKAGE: internal/civisibility/utils
  STATUS      CONFIG                              CALL_SITES
  STILL_READ  DD_SERVICE                          1
  UNMIGRATED  DD_ACTION_EXECUTION_ID              1
  UNMIGRATED  DD_PIPELINE_EXECUTION_ID            1
  UNMIGRATED  DD_TEST_OPTIMIZATION_ENV_DATA_FILE  1
  UNMIGRATED  DD_TEST_SESSION_NAME                1

PACKAGE: internal/civisibility/utils/net
  STATUS      CONFIG                             CALL_SITES
  STILL_READ  DD_API_KEY                         1
  STILL_READ  DD_CIVISIBILITY_AGENTLESS_ENABLED  1
  STILL_READ  DD_CIVISIBILITY_AGENTLESS_URL      1
  STILL_READ  DD_ENV                             1
  STILL_READ  DD_SERVICE                         1
  STILL_READ  DD_SITE                            1
  STILL_READ  DD_TAGS                            1
  STILL_READ  DD_VERSION                         1
  UNMIGRATED  DD_CODE_COVERAGE_FLAGS             1

PACKAGE: internal/civisibility/utils/telemetry
  STATUS      CONFIG                                         CALL_SITES
  UNMIGRATED  DD_CIVISIBILITY_AUTO_INSTRUMENTATION_PROVIDER  1

PACKAGE: internal/clientip
  STATUS      CONFIG                     CALL_SITES
  UNMIGRATED  DD_TRACE_CLIENT_IP_HEADER  1

PACKAGE: internal/globalconfig
  STATUS      CONFIG                           CALL_SITES
  UNMIGRATED  DD_INSTRUMENTATION_INSTALL_ID    1
  UNMIGRATED  DD_INSTRUMENTATION_INSTALL_TIME  1
  UNMIGRATED  DD_INSTRUMENTATION_INSTALL_TYPE  1

PACKAGE: internal/hostname
  STATUS      CONFIG       CALL_SITES
  UNMIGRATED  DD_HOSTNAME  1

PACKAGE: internal/namingschema
  STATUS      CONFIG                                             CALL_SITES
  STILL_READ  DD_SERVICE                                         1
  STILL_READ  DD_TRACE_SPAN_ATTRIBUTE_SCHEMA                     1
  UNMIGRATED  DD_TRACE_REMOVE_INTEGRATION_SERVICE_NAMES_ENABLED  1

PACKAGE: internal/processtags
  STATUS      CONFIG                                          CALL_SITES
  UNMIGRATED  DD_EXPERIMENTAL_PROPAGATE_PROCESS_TAGS_ENABLED  1

PACKAGE: internal/remoteconfig
  STATUS      CONFIG                                  CALL_SITES
  STILL_READ  DD_ENV                                  1
  UNMIGRATED  DD_RC_TUF_ROOT                          1
  UNMIGRATED  DD_REMOTE_CONFIGURATION_ENABLED         1
  UNMIGRATED  DD_REMOTE_CONFIG_POLL_INTERVAL_SECONDS  1

PACKAGE: internal/telemetry
  STATUS      CONFIG                                             CALL_SITES
  STILL_READ  DD_API_KEY                                         1
  STILL_READ  DD_SITE                                            1
  UNMIGRATED  DD_API_SECURITY_ENDPOINT_COLLECTION_MESSAGE_LIMIT  1
  UNMIGRATED  DD_INSTRUMENTATION_TELEMETRY_ENABLED               1
  UNMIGRATED  DD_TELEMETRY_DEBUG                                 1
  UNMIGRATED  DD_TELEMETRY_DEPENDENCY_COLLECTION_ENABLED         1
  UNMIGRATED  DD_TELEMETRY_EXTENDED_HEARTBEAT_INTERVAL           1
  UNMIGRATED  DD_TELEMETRY_HEARTBEAT_INTERVAL                    1
  UNMIGRATED  DD_TELEMETRY_LOG_COLLECTION_ENABLED                1
  UNMIGRATED  DD_TELEMETRY_METRICS_ENABLED                       1

PACKAGE: openfeature
  STATUS      CONFIG                                                     CALL_SITES
  STILL_READ  DD_ENV                                                     2
  STILL_READ  DD_SERVICE                                                 2
  STILL_READ  DD_VERSION                                                 2
  UNMIGRATED  DD_EXPERIMENTAL_FLAGGING_PROVIDER_SPAN_ENRICHMENT_ENABLED  1
  UNMIGRATED  DD_FLAGGING_EVALUATION_COUNTS_ENABLED                      1

PACKAGE: profiler
  STATUS      CONFIG                                    CALL_SITES
  STILL_READ  DD_API_KEY                                1
  STILL_READ  DD_ENV                                    1
  STILL_READ  DD_SERVICE                                1
  STILL_READ  DD_SITE                                   1
  STILL_READ  DD_TAGS                                   1
  STILL_READ  DD_TRACE_STARTUP_LOGS                     1
  STILL_READ  DD_VERSION                                1
  UNMIGRATED  DD_PROFILING_AGENTLESS                    1
  UNMIGRATED  DD_PROFILING_DEBUG_COMPRESSION_SETTINGS   1
  UNMIGRATED  DD_PROFILING_DELTA                        1
  UNMIGRATED  DD_PROFILING_ENABLED                      3
  UNMIGRATED  DD_PROFILING_ENDPOINT_COUNT_ENABLED       1
  UNMIGRATED  DD_PROFILING_EXECUTION_TRACE_ENABLED      1
  UNMIGRATED  DD_PROFILING_EXECUTION_TRACE_LIMIT_BYTES  1
  UNMIGRATED  DD_PROFILING_EXECUTION_TRACE_PERIOD       1
  UNMIGRATED  DD_PROFILING_FLUSH_ON_EXIT                1
  UNMIGRATED  DD_PROFILING_OUTPUT_DIR                   1
  UNMIGRATED  DD_PROFILING_UPLOAD_TIMEOUT               1
  UNMIGRATED  DD_PROFILING_URL                          1

@datadog-official

datadog-official Bot commented Sep 24, 2026 •

Copy link
Copy Markdown
Contributor

Tests

✅ All CI checks and tests passed.

🎉 All green!

🧪 All tests passed
❄️ No new flaky tests detected

🎯 Code Coverage (details)
• Patch Coverage: 100.00%
• Overall Coverage: 70.81% (-0.39%)

This comment will be updated automatically if new data arrives.
🔗 Commit SHA: 45224d7 | Docs | View more details | Give us feedback!

mhlidd and others added 2 commits September 24, 2026 15:24
Writing the marker on the writer goroutine mutated spans after they were
handed off, which the race detector flagged. Set it under the trace lock in
setTraceTagsLocked, like process tags, only when the agent writer is
currently sending v0.4. The v1 payload attribute and OTLP resource
attributes are unchanged.

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

Drop the agentExport field: native "false" applies to every non-OTLP
export, so the existing otlpExportMode flag plus the effective protocol is
enough. Move the marker keys next to the OTLP resource code. Compare the
pre-grow v1 payloads decoded, since payload attributes now hold two keys and
map iteration order makes the raw bytes nondeterministic.

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
mhlidd and others added 2 commits September 24, 2026 15:51
Build the OTLP adoption resource attributes in buildBaseResourceAttrs so
trace and metrics resources share them. Set the native marker on the first
span of every chunk regardless of v0.4/v1, since the agent prefers the v1
payload attribute and the values agree, and skip it only for OTLP export.
Drop the OTLP span-attribute filter, matching dd-trace-java.

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
…an.go

datadog.sdk.semantics is only written in buildBaseResourceAttrs, so inline
it like the other resource attribute keys. _dd.sdk.otlp_export is also used
for span meta and the v1 payload attribute, so keep it with the other
internal span keys.

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

Copilot AI 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.

Copilot review overview

🟡 Changes recommended

The CI Visibility wrapper path can omit the native marker, and metrics-resource marker coverage remains incomplete.

Get a fresh assessment by requesting another Copilot review.

Review effort: Lite
Findings: 1 Medium severity

Open (1)
What changed in this PR

Adds OTLP export and semantic-convention markers to trace and metrics payloads.

Changes:

  • Adds OTLP resource attributes for export mode and semantics.
  • Adds native v0.4/v1 chunk and payload markers.
  • Updates marker, resource, and payload integrity tests.

The CI Visibility no-op tracer path may omit the native marker. Metrics-resource tests also need coverage for enabled OTel semantics and both markers.

File Summary
ddtrace/​tracer/​stats_to_otlp_metrics.go Propagates markers to metrics resources.
ddtrace/​tracer/​stats_to_otlp_metrics_test.go Updates metrics resource tests.
ddtrace/​tracer/​spancontext.go Sets native markers on chunk-leading spans.
ddtrace/​tracer/​spancontext_test.go Tests marker behavior across chunks and protocols.
ddtrace/​tracer/​span.go Defines the marker key.
ddtrace/​tracer/​span_to_otlp.go Adds OTLP resource attributes.
ddtrace/​tracer/​span_to_otlp_test.go Tests trace resource markers.
ddtrace/​tracer/​payload_v1.go Adds the v1 payload marker.
ddtrace/​tracer/​payload_test.go Tests v1 marker encoding.
ddtrace/​tracer/​payload_pregrow_validation_test.go Adjusts payload integrity validation.

💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

Comment thread ddtrace/tracer/spancontext.go
@mhlidd
mhlidd marked this pull request as ready for review September 24, 2026 20:28
@mhlidd
mhlidd requested review from a team as code owners September 24, 2026 20:28
@pr-commenter

pr-commenter Bot commented Sep 24, 2026

Copy link
Copy Markdown

Benchmarks

Benchmark execution time: 2026-09-24 20:42:44

Comparing candidate commit 45224d7 in PR branch matthew.li/otlp-adoption-markers with baseline commit 796554b in branch main.

📊 Benchmarking dashboard

Found 0 performance improvements and 6 performance regressions! Performance is the same for 328 metrics, 1 unstable metrics, 1 flaky benchmarks without significant changes.

Explanation

This is an A/B test comparing a candidate commit's performance against that of a baseline commit. Performance changes are noted in the tables below as:

  • 🟩 = significantly better candidate vs. baseline
  • 🟥 = significantly worse candidate vs. baseline

We compute a confidence interval (CI) over the relative difference of means between metrics from the candidate and baseline commits, considering the baseline as the reference.

If the CI is entirely outside the configured SIGNIFICANT_IMPACT_THRESHOLD (or the deprecated UNCONFIDENCE_THRESHOLD), the change is considered significant.

Feel free to reach out to #apm-benchmarking-platform on Slack if you have any questions.

More details about the CI and significant changes

You can imagine this CI as a range of values that is likely to contain the true difference of means between the candidate and baseline commits.

CIs of the difference of means are often centered around 0%, because often changes are not that big:

---------------------------------(------|---^--------)-------------------------------->
                              -0.6%    0%  0.3%     +1.2%
                                 |          |        |
         lower bound of the CI --'          |        |
sample mean (center of the CI) -------------'        |
         upper bound of the CI ----------------------'

As described above, a change is considered significant if the CI is entirely outside the configured SIGNIFICANT_IMPACT_THRESHOLD (or the deprecated UNCONFIDENCE_THRESHOLD).

For instance, for an execution time metric, this confidence interval indicates a significantly worse performance:

----------------------------------------|---------|---(---------^---------)---------->
                                       0%        1%  1.3%      2.2%      3.1%
                                                  |   |         |         |
       significant impact threshold --------------'   |         |         |
                      lower bound of CI --------------'         |         |
       sample mean (center of the CI) --------------------------'         |
                      upper bound of CI ----------------------------------'

scenario:BenchmarkPayloadVersions/detailed_1spans/v1.0

  • 🟥 execution_time [+87.408ns; +113.592ns] or [+7.737%; +10.055%]

scenario:BenchmarkPayloadVersions/metastruct_1spans/v1.0

  • 🟥 execution_time [+129.642ns; +170.958ns] or [+3.121%; +4.116%]

scenario:BenchmarkPayloadVersions/simple_1000spans/v1.0

  • 🟥 allocated_mem [+1 bytes; +1 bytes] or [+3.030%; +3.030%]

scenario:BenchmarkPayloadVersions/simple_10spans/v1.0

  • 🟥 execution_time [+116.835ns; +126.765ns] or [+5.511%; +5.979%]

scenario:BenchmarkPayloadVersions/simple_1spans/v1.0

  • 🟥 execution_time [+79.259ns; +84.541ns] or [+10.272%; +10.956%]

scenario:BenchmarkPayloadVersions/spankind_1spans/v1.0

  • 🟥 execution_time [+53.786ns; +58.134ns] or [+6.422%; +6.941%]

Unstable benchmarks

These benchmarks have a confidence interval too wide to call a change; treat them as noise rather than signal.

scenario:BenchmarkContextWithSpan/detach-no-snapshot

  • unstable execution_time [-1.195ns; +1.741ns] or [-4.118%; +6.001%]

Known flaky benchmarks

These benchmarks are marked as flaky and will not trigger a failure. Modify FLAKY_BENCHMARKS_REGEX to control which benchmarks are marked as flaky.

Known flaky benchmarks without significant changes:

  • scenario:BenchmarkOTLPTraceWriterFlush

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

Labels

AI Generated Largely based on code generated by an AI or LLM. This label is the same across all dd-trace-* repos

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants