Skip to content

feat(tracer): add DD_TRACE_OTEL_SEMANTICS_ENABLED for OTLP export - #4889

Merged
gh-worker-dd-mergequeue-cf854d[bot] merged 2 commits into
mainfrom
maximo/otel-trace-compatibility
Jul 10, 2026
Merged

gh-worker-dd-mergequeue-cf854d[bot] merged 2 commits into
mainfrom
maximo/otel-trace-compatibility

Conversation

@link04

@link04 link04 commented Jun 12, 2026 •

Copy link
Copy Markdown
Contributor

What does this PR do?

Adds an opt-in DD_TRACE_OTEL_SEMANTICS_ENABLED that aligns OTLP-exported spans (and the OTel bridge) with the pure OpenTelemetry SDK by suppressing Datadog-specific attributes and stopping DD-convention remaps. Mirrors dd-trace-py #18495 and libdatadog #2091.

Behavior when DD_TRACE_OTEL_SEMANTICS_ENABLED=true

  • Omit operation.name, resource.name, span.type (DD-only span attributes)
  • Omit error.message/type/stack/handling_stack from the span (they live on the exception span event for Error Tracking)
  • Omit span.kind (already carried by the first-class OTLP SpanKind field)
  • Keep http.response.status_code under its OTel key instead of remapping to the legacy http.status_code string tag
  • The OTel bridge no longer interprets Datadog reserved tags (operation.name, analytics.event, http.response.status_code) in SetAttributes — they pass through as provided
  • SetName updates the Datadog resource (which the OTLP exporter emits as the span name) instead of the DD-only operation name

Default (flag off) behavior is unchanged.

Why SetName is gated here (moved from #4887)

Changing SetName to update the resource is the correct OTel-aligned behavior, but doing it unconditionally is a breaking change: it shifts both the operation name and resource name, which changes users' RED metrics. Per team discussion (matching the dd-trace-js decision), this belongs behind the semantics flag rather than as a default change in a minor release. This supersedes #4887.

Performance

The flag is read once per export batch in otlpTraceWriter.add() and resolved once at provider creation for the bridge (cached on the oteltracer), then threaded as a parameter / read as a field — no per-span/per-attribute global config lookup.

Testing

TestConvertSpanAttributesOtelSemantics, TestRemapStatusCodeOtelSemantics, TestToReservedAttributesOtelSemantics, and TestSpanSetNameUpdatesResourceOtelSemantics (flag on) plus the existing TestSpanSetName (flag off, legacy operation-name behavior). Full ddtrace/tracer, ddtrace/opentelemetry, and internal/config suites pass.

🤖 Generated with Claude Code

@datadog-prod-us1-5

datadog-prod-us1-5 Bot commented Jun 12, 2026 •

Copy link
Copy Markdown

Tests

🎉 All green!

🧪 All tests passed
❄️ No new flaky tests detected

🎯 Code Coverage (details)
• Patch Coverage: 83.33%
• Overall Coverage: 62.76% (+11.38%)

This comment will be updated automatically if new data arrives.
🔗 Commit SHA: 1033fca | Docs | Datadog PR Page | Give us feedback!

@codecov

codecov Bot commented Jun 12, 2026 •

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 64.28571% with 10 lines in your changes missing coverage. Please review.
✅ Project coverage is 63.67%. Comparing base (08a41d6) to head (b23cf4e).
⚠️ Report is 3 commits behind head on main.

Files with missing lines Patch % Lines
ddtrace/tracer/span_to_otlp.go 53.84% 3 Missing and 3 partials ⚠️
internal/config/config.go 20.00% 4 Missing ⚠️
Additional details and impacted files
Files with missing lines Coverage Δ
ddtrace/opentelemetry/span.go 90.05% <100.00%> (-2.65%) ⬇️
ddtrace/opentelemetry/tracer.go 94.50% <ø> (ø)
ddtrace/opentelemetry/tracer_provider.go 100.00% <100.00%> (ø)
ddtrace/tracer/otlp_writer.go 96.42% <100.00%> (-1.17%) ⬇️
internal/config/config.go 59.70% <20.00%> (-4.78%) ⬇️
ddtrace/tracer/span_to_otlp.go 88.28% <53.84%> (-4.38%) ⬇️

... and 287 files with indirect coverage changes

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@pr-commenter

pr-commenter Bot commented Jun 12, 2026 •

Copy link
Copy Markdown

Benchmarks

Benchmark execution time: 2026-07-10 21:47:23

Comparing candidate commit 1033fca in PR branch maximo/otel-trace-compatibility with baseline commit 2553130 in branch main.

Found 1 performance improvements and 0 performance regressions! Performance is the same for 320 metrics, 2 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:BenchmarkOTLPTraceWriterConcurrent/concurrency_4

  • 🟩 execution_time [-503.679ns; -350.721ns] or [-3.271%; -2.278%]

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

Comment thread ddtrace/opentelemetry/span.go Outdated
Comment thread ddtrace/opentelemetry/span.go
@link04
link04 force-pushed the maximo/otel-trace-compatibility branch 4 times, most recently from b23cf4e to 6dda781 Compare June 16, 2026 15:02
@link04
link04 marked this pull request as ready for review June 16, 2026 15:08
@link04
link04 requested review from a team as code owners June 16, 2026 15:08

@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: 6dda781634

ℹ️ 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 ddtrace/opentelemetry/span.go

@darccio darccio left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM. I left some comments but they are not blocking.

Comment thread ddtrace/tracer/span_to_otlp_test.go
Comment thread ddtrace/opentelemetry/span.go Outdated
Comment thread internal/config/config.go Outdated
@link04
link04 force-pushed the maximo/otel-trace-compatibility branch from 62ed88e to 74fa425 Compare June 26, 2026 16:56
Opt-in mode that aligns OTLP-exported spans with the pure OpenTelemetry SDK by
suppressing Datadog-specific attributes and stopping DD-convention remaps.
Mirrors dd-trace-py #18495 and libdatadog #2091.

When DD_TRACE_OTEL_SEMANTICS_ENABLED=true:
- omit operation.name, resource.name, span.type (DD-only span attributes)
- omit error.message/type/stack/handling_stack from the span (they live on the
  exception span event for Error Tracking)
- omit span.kind (already carried by the first-class OTLP SpanKind field)
- keep http.response.status_code under its OTel key instead of remapping to the
  legacy http.status_code string tag
- the OTel bridge no longer interprets Datadog reserved tags (operation.name,
  analytics.event, http.response.status_code) in SetAttributes
- SetName updates the Datadog resource (the OTLP span name) instead of the DD-only
  operation name; gated here because changing it by default shifts RED metrics

Registers the key in supported_configurations so env.Get resolves it.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
@link04
link04 force-pushed the maximo/otel-trace-compatibility branch from 74fa425 to c57edb1 Compare July 1, 2026 20:46
@github-actions

github-actions Bot commented Jul 1, 2026 •

Copy link
Copy Markdown
Contributor

Config Audit

PACKAGE: contrib/confluentinc/confluent-kafka-go/kafkatrace
  STATUS      CONFIG                            CALL_SITES
  UNMIGRATED  DD_TRACE_KAFKA_ANALYTICS_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
  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_ENDPOINT       4
  UNMIGRATED  OTEL_EXPORTER_OTLP_HEADERS        2
  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_PROTOCOL       2
  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_METRICS_EXPORTER                              1
  UNMIGRATED  DD_HOSTNAME                                        1
  UNMIGRATED  OTEL_EXPORTER_OTLP_ENDPOINT                        2
  UNMIGRATED  OTEL_EXPORTER_OTLP_HEADERS                         1
  UNMIGRATED  OTEL_EXPORTER_OTLP_METRICS_ENDPOINT                2
  UNMIGRATED  OTEL_EXPORTER_OTLP_METRICS_HEADERS                 1
  UNMIGRATED  OTEL_EXPORTER_OTLP_METRICS_PROTOCOL                2
  UNMIGRATED  OTEL_EXPORTER_OTLP_METRICS_TEMPORALITY_PREFERENCE  1
  UNMIGRATED  OTEL_EXPORTER_OTLP_PROTOCOL                        2
  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_API_KEY                                1
  UNMIGRATED  DD_APM_TRACING_ENABLED                    1
  UNMIGRATED  DD_LLMOBS_AGENTLESS_ENABLED               1
  UNMIGRATED  DD_LLMOBS_ENABLED                         1
  UNMIGRATED  DD_LLMOBS_ML_APP                          1
  UNMIGRATED  DD_LLMOBS_PROJECT_NAME                    1
  UNMIGRATED  DD_TRACE_128_BIT_TRACEID_LOGGING_ENABLED  1
  UNMIGRATED  DD_TRACE_DEBUG_SEELOG_WORKAROUND          1
  UNMIGRATED  DD_TRACE_PROPAGATION_BEHAVIOR_EXTRACT     1
  UNMIGRATED  DD_TRACE_PROPAGATION_EXTRACT_FIRST        1
  UNMIGRATED  DD_TRACE_PROPAGATION_STYLE_EXTRACT        1
  UNMIGRATED  DD_TRACE_PROPAGATION_STYLE_INJECT         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_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_ENABLED                                     1
  UNMIGRATED  DD_APPSEC_RASP_ENABLED                                1
  UNMIGRATED  DD_APPSEC_RULES                                       1
  UNMIGRATED  DD_APPSEC_SCA_ENABLED                                 1
  UNMIGRATED  DD_APPSEC_TRACE_RATE_LIMIT                            1
  UNMIGRATED  DD_APPSEC_WAF_TIMEOUT                                 1

PACKAGE: internal/appsec/listener/httpsec
  STATUS      CONFIG                     CALL_SITES
  UNMIGRATED  DD_TRACE_CLIENT_IP_HEADER  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_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  1
  UNMIGRATED  DD_TEST_MANAGEMENT_ENABLED                                       1

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

PACKAGE: internal/civisibility/utils/telemetry
  STATUS      CONFIG                                         CALL_SITES
  UNMIGRATED  DD_CIVISIBILITY_AUTO_INSTRUMENTATION_PROVIDER  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/stacktrace
  STATUS      CONFIG                           CALL_SITES
  UNMIGRATED  DD_APPSEC_MAX_STACK_TRACE_DEPTH  1
  UNMIGRATED  DD_APPSEC_STACK_TRACE_ENABLED    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_EXPERIMENTAL_FLAGGING_PROVIDER_ENABLED                  1
  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

@genesor genesor left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM, a small NIT about the style.

Comment thread internal/config/config.go Outdated
Comment thread internal/config/config.go Outdated
…tter

Rename OtelSemanticsEnabled/SetOtelSemanticsEnabled to the OTel initialism per
Go style, and update the call sites in the OTLP writer and OTel bridge so the
package compiles.

Co-authored-by: Benjamin De Bernardi <debernardi.benjamin@gmail.com>
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
@link04
link04 force-pushed the maximo/otel-trace-compatibility branch from 0b6b15a to 1033fca Compare July 10, 2026 21:17
@gh-worker-devflow-routing-ef8351

gh-worker-devflow-routing-ef8351 Bot commented Jul 10, 2026 •

Copy link
Copy Markdown

View all feedbacks in Devflow UI.

2026-07-10 21:38:23 UTC ℹ️ Start processing command devflow:merge


2026-07-10 21:38:31 UTC ℹ️ MergeQueue: waiting for PR to be ready

This pull request is not mergeable according to GitHub. Common reasons include pending required checks, missing approvals, or merge conflicts — but it could also be blocked by other repository rules or settings.
It will be added to the queue as soon as checks pass and/or get approvals. View in MergeQueue UI.
Note: if you pushed new commits since the last approval, you may need additional approval.
You can remove it from the waiting list with /remove command.


2026-07-10 21:48:08 UTC ℹ️ MergeQueue: merge request added to the queue

The expected merge time in main is approximately 20m (p90).


2026-07-10 22:06:32 UTC ℹ️ MergeQueue: This merge request was merged

@gh-worker-dd-mergequeue-cf854d
gh-worker-dd-mergequeue-cf854d Bot merged commit 9ffdd0f into main Jul 10, 2026
221 checks passed
@gh-worker-dd-mergequeue-cf854d
gh-worker-dd-mergequeue-cf854d Bot deleted the maximo/otel-trace-compatibility branch July 10, 2026 22:06
link04 added a commit that referenced this pull request Jul 13, 2026
The main merge brought in #4889's 3-arg convertSpan(*Span, string, bool); update
the TestOTLPExportModeSpanEvents call site (otelSemantics=false) so the tracer
test package compiles.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
link04 added a commit that referenced this pull request Aug 19, 2026
- Document that the semantics branch applies to every export format: an
  APM/MessagePack-exported error span keeps error=1 and error.message but drops
  error.handling_stack, matching dd-trace-dotnet under the same flag.
- Correct error.stack to error.handling_stack in the tests and comments.
  error.stack is only set for errors implementing xerrors.Formatter,
  fmt.Formatter, or *errortrace.TracerError, so it was never emitted on this
  path and the old assertion could not fail. Assert on the ext.* constants.
- Explain in ddOnlyMetaKeys why #4889 suppressed error.type and how it differs
  from RecordError's exception event.
- Add TestSpanEndErrorTypeOtelSemanticsOTLPRoundTrip, which drives a bridge span
  through the real OTLP writer and asserts on the decoded protobuf, so End() and
  the OTLP conversion are verified as a composed whole.
gh-worker-dd-mergequeue-cf854d Bot pushed a commit that referenced this pull request Aug 24, 2026
### What does this PR do?

Under `DD_TRACE_OTEL_SEMANTICS_ENABLED`, preserves the OpenTelemetry `error.type` attribute end-to-end instead of clobbering it and dropping it.

- **Bridge (`ddtrace/opentelemetry/span.go`)**: on an error-status span, the OTel semantics path now marks the span errored via `SetTag(ext.Error, true)` instead of `tracer.WithError(errors.New(description))`. `WithError` runs after instrumentation attributes are flushed and overwrote `error.type` with the reflect type of the status wrapper (`"*errors.errorString"`), and also injected `error.handling_stack`. The non-semantics path is unchanged.
- **OTLP converter (`ddtrace/tracer/span_to_otlp.go`)**: removes `error.type` from `ddOnlyMetaKeys`, so it is no longer suppressed from OTLP output under semantics.

Net effect under semantics: an instrumentation-set `error.type` (e.g. `"*net.OpError"` from otelhttp client spans) survives to OTLP; when none is set, `error.type` is simply absent (the error state is carried by the OTLP span status) rather than a meaningless `"*errors.errorString"`.

Both halves are required. Removing only the `ddOnlyMetaKeys` entry would export `"*errors.errorString"`, because the bridge overwrote the instrumentation value before export.

### Motivation

`error.type` is a Stable attribute in the OpenTelemetry semantic conventions (https://opentelemetry.io/docs/specs/semconv/registry/attributes/error/). Under OTel semantics we should emit the instrumentation-provided value, not a Datadog-internal reflect-type string, and we must not drop it. Follow-up to #4889.

### Cross-SDK validation

Verified against a real application through the FTF OTLP scorecard (`dd-otel-sdk`, Go app instrumented with `otelhttp`), comparing the dd-trace-go bridge with the pure OpenTelemetry SDK, both exporting OTLP, on a request that fails its outbound call:

| | `error.type` on the failing client span |
|---|---|
| dd-trace-go `main` | absent entirely |
| this branch | `*net.OpError` |
| pure OpenTelemetry SDK | `*net.OpError` |

The scorecard reports `error.type` as preserved, `{"score": 1.0, "exact": 1, "mismatch": 0}`. Note the official `semconv.ErrorType` helper derives the value by reflection as well, so passing our value through converges with the reference SDK rather than diverging from it.

### Behavior under APM export (intended)

The bridge change applies regardless of export format. Under semantics, an error span exported to the Datadog Agent (MessagePack, not OTLP) carries `error=1` and `error.message`, but no longer `error.handling_stack`, and carries `error.type` only if instrumentation set one. Previously it always received `error.type="*errors.errorString"` plus a handling stack.

This is intended, and it is the shape the other tracers already ship: dd-trace-dotnet does the same under the same flag (`OtlpHelpers.cs`, `AgentConvertSpan`: `span.Error = true` plus `SetTag(Tags.ErrorMsg, ...)` when OTel semantics is enabled, otherwise the legacy `Status2Error` flattening). dd-trace-js/py/java/rb never injected a reflect-type `error.type` from OTel status at all. `error.message` is still set unconditionally because it feeds the OTLP status message.

Note: `error.stack` is not affected. It is only set for errors implementing `xerrors.Formatter`, `fmt.Formatter`, or `*errortrace.TracerError`, and the bridge passed `*errors.errorString`, which implements none of them.

### Testing

- `ddtrace/tracer/span_to_otlp_test.go`: `TestConvertSpanAttributesOtelSemantics` asserts `error.type` passes through (with a realistic `"*net.OpError"` value) while `error.message`/`error.stack`/`error.handling_stack`/`span.kind` remain suppressed.
- `ddtrace/opentelemetry/span_test.go`: `TestSpanEndErrorTypeOtelSemantics` covers the bridge `End()` branch under semantics, both with an instrumentation-set `error.type` (it survives, no `error.handling_stack` injected) and without one (no reflect-type value injected). `TestSpanEnd` gains one assertion pinning the non-semantics `WithError` path.
- `ddtrace/opentelemetry/span_test.go`: `TestSpanEndErrorTypeOtelSemanticsOTLPRoundTrip` drives a bridge span through the real OTLP writer to a local listener and asserts on the decoded protobuf (error status, `error.type` preserved, DD-only tags absent), so the bridge and the converter are verified as a composed whole. Confirmed to fail if either half of the fix is reverted.
- All of the above pass under `go test -race`.

### Reviewer's Checklist

- [x] Changed code has unit tests for its functionality.
- [ ] [System-Tests](https://github.com/DataDog/system-tests/) covering this feature have been added.
- [ ] If this interacts with the agent in a new way, a system test has been added.


Co-authored-by: maximo.bautista <maximo.bautista@datadoghq.com>
darccio added a commit that referenced this pull request Aug 26, 2026
…g resource naming

One of this branch's own dependency-bump commits pulled
go.opentelemetry.io/contrib/instrumentation/net/http/otelhttp up to
v0.69.0 across 7 separate go.mod files (as an MVS side effect, not a
deliberate choice). v0.69.0 changed otelhttp's default span-name
formatter to conform to OpenTelemetry's HTTP semantic conventions
(upstream #8871): the default span name became '{method} {route}' or
just '{method}' instead of the caller-supplied operation name.

Since ddtrace/opentelemetry.tracer.go maps the OTel span name directly
onto the Datadog resource (tracer.ResourceName(spanName)), this
silently changed resource naming for every OTel-bridge HTTP server
span, breaking TestHttpDistributedTrace ('testOperation' expected,
'GET' actual).

main handles this exact transition via a dedicated
DD_TRACE_OTEL_SEMANTICS_ENABLED toggle (#4889) that this branch never
picked up. Backporting that whole feature is a real product decision;
in the meantime, downgrading otelhttp to v0.68.0 (its own default
formatter unconditionally preserves the operation name, matching what
this repo shipped before) is the minimal fix that restores the
pre-existing, still-shipping behavior. v0.69.0's changes are all
semconv-compliance and cleanup per upstream's changelog — no security
fix is being reverted.

Full ddtrace/... suite green, go vet clean, govulncheck shows no new
findings.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants