Repository navigation
Conversation
Codeowners resolved asResolved from the full PR diff against |
Dependency direction analysis
|
LLM ValidationLLM Validation Gate — python-tracer-agent✅ PASS
AnalysisChanged instruction file(s): No safety or blocking-case regressions across 10 case(s). Overall pairwise win-rate 49% [48%–51%], quality -0.3 — see the verdict above for whether that clears the noise band. Results
Cases
Per-dimension scores, token usage, latency, and estimated cost are in the CI job logs. |
❌ ErrorsYour PR has failed checks. Please review the issues below and take necessary action before merging. 🚦 98 Pipeline jobs failed
Useful? React with 👍 / 👎 This comment will be updated automatically if new data arrives.🔗 Commit SHA: 1aa4824 | Docs | View more details | Give us feedback! |
The compiled extensions (_native, _threads, _msgpack) are built and shipped by the ddtrace-native package. ddtrace.internal.native becomes a bridge to _ddtrace_native so the process holds a single copy of their state: _native is registered under its historic ddtrace.internal.native._native name, which keeps the pickle names working, and _threads and _msgpack swap themselves for the package modules through sys.modules. The _threads and _msgpack sources and stubs are deleted, since they ship in ddtrace-native. The msgpack headers stay because the trace encoders in _encoding.pyx still compile against them. The _native stub re-exports the package's, so there is one set of type definitions; its Span is a stand-in, hence three type: ignore where a real Span is expected. Depend on ddtrace-native with a range, so patch releases of the package are picked up without a change here. Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
The tracer's native extension is now built and shipped by ddtrace-native, so remove the src/native crate and the build wiring around it: setuptools-rust and its RustExtension/build_rust commands, the Rust feature selection and hashing, and the setuptools-rust build requirement. This commit leaves the profiler without its libdatadog library. The next commit builds the profiling FFI on its own. Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
The profiler keeps its own libdatadog library in dd-trace-py, now that the tracer's native extension comes from ddtrace-native, which does not include the profiling FFI. src/profiling_ffi is a profiling-only cdylib on the same libdatadog revision as the package's crate. setup.py builds it with cargo, generates the cbindgen headers, and stages it as _profiling_ffi<EXT_SUFFIX> next to libdd_wrapper, which links it through the new FindLibProfilingFfi.cmake with a $ORIGIN rpath. The SONAME (install name on macOS) is set at link time with `cargo rustc -- -C link-arg=-Wl,-soname,...`, so that dd_wrapper records the staged file name. The arguments go through rustc rather than RUSTFLAGS so they reach only this crate and not its dependencies. This avoids patchelf, which the standalone profiling builds do not install. `setup.py build_profiling_ffi` builds just the library and headers, for the standalone CMake builds. Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
Point the standalone profiling build, the clang-tidy and fuzz scripts, the native-import check, CI paths, CODEOWNERS and the docs at src/profiling_ffi instead of src/native, and drop the src/native globs from the suitespecs. Tests assert the invariant rather than the historic module spelling, since the extension now lives in the ddtrace-native package: the periodic thread type is named after its module, and the trace buffer finds its sibling packer in the package it was initialized under. A new test checks that the three bridges are the package modules, loaded once, and that no stale extension shadows a bridge. Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
f07137c to
1aa4824
Compare
Draft, for the profiling team. Targets
gnufede/package-split-prep.CI cannot be green until
ddtrace-nativeis published. This PR depends onddtrace-native>=0.1.0,<0.2, which does not exist on the index yet. Local runs used wheels built from the package's branch.What changes
src/native. The tracer's_native,_msgpackand_threadscome from theddtrace-nativepackage (_ddtrace_native).ddtrace/internal/native/becomes a bridge, so there is one copy of module state._nativeis registered under its historic nameddtrace.internal.native._native, which keeps state and pickle names._msgpackand_threadsswap themselves for the package modules throughsys.modules. Their sources and stubs are deleted; the msgpack headers stay because_encoding.pyxcompiles against them._native.pyire-exports the package stub.setuptools-rustleaves the build requirements, with the Rust feature selection,build_rustandPatchedDistribution.Option B: the profiler keeps its own FFI crate
src/profiling_ffiis a profiling-only cdylib re-exporting libdatadog'sddog_prof_*API, on the same libdatadog rev as the package's crate (v50.0.0; both pins must move together).setup.pybuilds it with cargo and generates the cbindgen headers (build_profiling_ffi, also usable on its own with--inplacefor the standalone builds). It is staged as_profiling_ffi<EXT_SUFFIX>next tolibdd_wrapper.libdd_wrapperlinks it through the newFindLibProfilingFfi.cmakewith an$ORIGINrpath (replacingFindLibNative.cmakeand the../nativepaths).cargo rustc -- -C link-arg=-Wl,-soname,_profiling_ffi<suffix>. No patchelf, which the standalone profiling builds do not install. Going throughrustcrather thanRUSTFLAGSkeeps the argument off the dependencies.native-import-check, CI paths, CODEOWNERS and the profiling docs now point atsrc/profiling_ffi.Please judge
dd_wrapperlinks_profiling_ffi, and the tracer's_native(fromddtrace-native) carries its own libdatadog. Before, one_nativeserved both, so the wheel held libdatadog once. Now there are two copies with separate global state (allocator hooks, runtime, crashtracker handlers). Crashtracker and profiling suites pass, but only CI and real workloads show interaction problems._profiling_ffi(profiling API only) plus the package's_native. Local fast builds are unstripped and not representative:_profiling_ffi50 MB, the package's_nativewheel 27 MB. Release pipeline numbers are needed.Verification (local, Docker, Python 3.13, ddtrace-native 0.1.0 wheels built from the package branch)
Installed
_ddtrace_nativeextensions checked byte-identical to the wheel.libdd_wrapperhasNEEDED _profiling_ffi...andRUNPATH $ORIGIN; the library's SONAME is its staged name.tests/internal/test_native_ext_bridges.py)native-import-check, suitespec-check: cleanNot covered: other Python versions, macOS, musl, Windows, release-quality wheels.
🤖 Generated with Claude Code