Skip to content

feat(tracing): export OTLP trace metrics - #19672

Open
mabdinur wants to merge 6 commits into
mainfrom
codex/otlp-trace-metrics-export
Open

feat(tracing): export OTLP trace metrics#19672
mabdinur wants to merge 6 commits into
mainfrom
codex/otlp-trace-metrics-export

Conversation

@mabdinur

@mabdinur mabdinur commented Aug 13, 2026

Copy link
Copy Markdown
Contributor

Description

Wires ddtrace-py configuration into the libdatadog v41 OTLP trace-metrics exporter:

  • Passes supported DD_TAGS entries to the metrics resource as datadog.tracer_tags, excluding reserved service, environment, version, and runtime ID keys.
  • Adds DD_TRACE_STATS_ADDITIONAL_TAGS and forwards the selected span-tag keys to native stats aggregation.
  • Exposes both settings through the PyO3 builder and Python type stubs.
  • Adds writer and OTLP payload coverage plus a customer-facing feature release note.

This follows the contract introduced in system-tests#7363 and refined in system-tests#7466.

Testing

  • cargo check --locked --manifest-path src/native/Cargo.toml
  • scripts/lint checks
  • Coverage in tests/tracer/test_writer.py and tests/opentelemetry/test_otlp_trace.py

Risks

The new export path is disabled unless OTEL_TRACES_SPAN_METRICS_ENABLED=true.

Additional Notes

Stacked on #19580, which updates libdatadog to v41.0.0 and must merge first.

@cit-pr-commenter-54b7da

cit-pr-commenter-54b7da Bot commented Aug 13, 2026

Copy link
Copy Markdown

Circular import analysis

⚠️ Existing circular imports

There are 5 circular imports that already exist on the base branch and have not been changed by this PR.

ddtrace.contrib.internal.pytorch._distributed -> ddtrace.contrib.internal.pytorch._rank_root -> ddtrace.contrib.internal.pytorch._distributed
ddtrace.contrib.internal.django.patch -> ddtrace.contrib.internal.django.response -> ddtrace.contrib.internal.django.patch
ddtrace.errortracking._handled_exceptions.bytecode_injector -> ddtrace.errortracking._handled_exceptions.callbacks -> ddtrace.errortracking._handled_exceptions.collector -> ddtrace.errortracking._handled_exceptions.bytecode_reporting -> ddtrace.errortracking._handled_exceptions.bytecode_injector
ddtrace.llmobs -> ddtrace.llmobs._evaluators -> ddtrace.llmobs._evaluators.format -> ddtrace.llmobs._experiment -> ddtrace.llmobs
ddtrace.appsec._asm_request_context -> ddtrace.appsec._iast._iast_request_context_base -> ddtrace.appsec._iast._iast_env -> ddtrace.appsec._iast.reporter -> ddtrace.appsec._exploit_prevention.stack_traces -> ddtrace.appsec._asm_request_context

@cit-pr-commenter-54b7da

cit-pr-commenter-54b7da Bot commented Aug 13, 2026

Copy link
Copy Markdown

Dependency direction analysis

⚠️ Existing dependency direction violations

There are 255 dependency direction violations that already exist on the base branch and have not been changed by this PR.

Show existing violations (showing 5 of 255 highest severity)
ddtrace.internal.tracemethods -×-> ddtrace.trace  (internal-core -> product:tracing, score=134)
ddtrace.llmobs._integrations.crewai -×-> ddtrace.trace  (product:llmobs -> product:tracing, score=132)
ddtrace.internal.ci_visibility.api._base -×-> ddtrace.trace  (product:ci_visibility -> product:tracing, score=132)
ddtrace.debugging._signal.tracing -×-> ddtrace.trace  (product:debugging -> product:tracing, score=132)
ddtrace.llmobs._utils -×-> ddtrace.trace  (product:llmobs -> product:tracing, score=132)

To see all violations, download the layers-base.json and layers-pr.json artifacts from this CI job and run:

uv run --script scripts/import-analysis/layers.py compare layers-base.json layers-pr.json

@cit-pr-commenter-54b7da

cit-pr-commenter-54b7da Bot commented Aug 13, 2026

Copy link
Copy Markdown

Codeowners resolved as

Resolved from the full PR diff against main using the target branch CODEOWNERS file.
CODEOWNERS team requests not listed below are not required by the current file set.

ddtrace/internal/native/_native.pyi                                     @DataDog/apm-core-python
ddtrace/internal/settings/_config.py                                    @DataDog/python-guild @DataDog/apm-sdk-capabilities-python
ddtrace/internal/settings/_supported_configurations.py                  @DataDog/apm-python
ddtrace/internal/writer/writer.py                                       @DataDog/apm-core-python
releasenotes/notes/add-otlp-trace-metrics-83cad1e1cdcc65c7.yaml         @DataDog/apm-python
src/native/data_pipeline/mod.rs                                         @DataDog/apm-core-python
supported-configurations.json                                           @DataDog/apm-python
tests/integration/test_trace_stats.py                                   @DataDog/apm-core-python
tests/tracer/test_writer.py                                             @DataDog/apm-sdk-capabilities-python

@datadog-prod-us1-5

datadog-prod-us1-5 Bot commented Aug 13, 2026

Copy link
Copy Markdown
Contributor

Tests

🎉 All green!

🧪 All tests passed
❄️ No new flaky tests detected

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

@pr-commenter

pr-commenter Bot commented Aug 13, 2026

Copy link
Copy Markdown

Benchmarks

Benchmark execution time: 2026-08-13 20:10:35

Comparing candidate commit 65ae0d6 in PR branch codex/otlp-trace-metrics-export with baseline commit 41afee5 in branch main.

Found 0 performance improvements and 8 performance regressions! Performance is the same for 609 metrics, 10 unstable metrics.

scenario:httppropagationinject-ids_only

  • 🟥 execution_time [+2.843µs; +3.022µs] or [+13.645%; +14.502%]

scenario:iastaspects-capitalize_noaspect

  • 🟥 execution_time [+16.259µs; +20.664µs] or [+8.662%; +11.009%]

scenario:iastaspects-index_aspect

  • 🟥 execution_time [+9.484µs; +12.005µs] or [+7.700%; +9.747%]

scenario:iastaspects-stringio_aspect

  • 🟥 execution_time [+649.962µs; +678.155µs] or [+17.584%; +18.347%]

scenario:iastaspectsospath-ospathbasename_aspect

  • 🟥 execution_time [+94.855µs; +101.824µs] or [+23.609%; +25.344%]

scenario:span-start

  • 🟥 execution_time [+1.182ms; +1.366ms] or [+7.359%; +8.503%]

scenario:telemetryaddmetric-1-count-metric-1-times

  • 🟥 execution_time [+304.605ns; +349.553ns] or [+11.789%; +13.528%]

scenario:tracer-small

  • 🟥 execution_time [+30.213µs; +32.864µs] or [+8.663%; +9.423%]

Update system-test revisions and adapt OTel thread-context and metric resource tests for libdatadog v41.0.0.
@mabdinur
mabdinur force-pushed the codex/otlp-trace-metrics-libdatadog branch from cac4a78 to 65a8ed9 Compare August 13, 2026 14:24
@mabdinur
mabdinur force-pushed the codex/otlp-trace-metrics-export branch from dd0b539 to 3c376e3 Compare August 13, 2026 14:27
Comment thread releasenotes/notes/add-otlp-trace-metrics-83cad1e1cdcc65c7.yaml Outdated
@mabdinur
mabdinur force-pushed the codex/otlp-trace-metrics-export branch from 2450058 to 58ab7a9 Compare August 13, 2026 15:20
Comment thread releasenotes/notes/add-otlp-trace-metrics-83cad1e1cdcc65c7.yaml Outdated
gh-worker-dd-mergequeue-cf854d Bot pushed a commit that referenced this pull request Aug 13, 2026
## Description

Updates ddtrace-py native dependencies without adding OTLP trace-metrics behavior:

- Upgrades every libdatadog crate from v40.0.0 to v41.0.0 and regenerates `Cargo.lock`.
- Updates the GitHub and GitLab system-test revisions to `692e9462ef7296cf1224c0d2bd3a3623a1bfe590` using `scripts/update-system-tests-version.py`.
- Extends the Linux OTel thread-context test to cover trace flags added in libdatadog v41.0.0.
- Updates the OTLP metrics payload test for typed resource attributes emitted by v41.

## Testing

- `cargo check --locked --manifest-path src/native/Cargo.toml`
- `scripts/lint checks`

## Risks

This updates the shared native dependency used by tracing, profiling, telemetry, remote configuration, and crash tracking.

## Additional Notes

[#19672](#19672) is stacked on this PR and contains the OTLP trace-metrics feature and release note.

Co-authored-by: munir.abdinur <munir.abdinur@datadoghq.com>
Base automatically changed from codex/otlp-trace-metrics-libdatadog to main August 13, 2026 18:22
@mabdinur
mabdinur force-pushed the codex/otlp-trace-metrics-export branch from c7d789c to a9f635b Compare August 13, 2026 18:55
Comment thread tests/integration/test_trace_stats.py
Comment thread tests/integration/test_trace_stats.py
@mabdinur
mabdinur force-pushed the codex/otlp-trace-metrics-export branch from 21711a9 to 802e313 Compare August 13, 2026 19:29
@mabdinur
mabdinur marked this pull request as ready for review August 13, 2026 19:36
@mabdinur
mabdinur requested review from a team as code owners August 13, 2026 19:36
@mabdinur
mabdinur requested a review from juanjux August 13, 2026 19:36
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants