Repository navigation
Conversation
_threads is compiled code with no Python ddtrace imports, so it ships in ddtrace-native, whose package ddtrace.internal.native becomes. Moving it there now makes the dd-trace-py layout match the split. The module named itself ddtrace.internal._threads in two places. Both now come from the name it is imported under: the module-state lookup uses the module's __name__, and the PeriodicThread type name is built from it when the module first runs. That needs no compile-time setting, so there is no string macro to quote through MSVC flags, and the same source works as _ddtrace_native._threads. PeriodicThread.__module__ follows the module; nothing pickles these threads. ddtrace.internal._threads stays as an alias of the new module for now: the serverless tests still import it from the old path, and a follow-up reviewed by their owners moves those imports and removes the alias. The new tests load the binary under a bare name in an interpreter that never imports ddtrace, as the ddtrace-native package will. The commit hooks check every touched file, so this also drops an unused import from _threading.pyx and reorders one assert in test_periodic.py that mypy reported as unreachable. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Codeowners resolved asResolved from the full PR diff against |
Dependency direction analysis
|
BenchmarksBenchmark execution time: 2026-11-26 17:52:03 Comparing candidate commit d9f72f5 in PR branch Found 0 performance improvements and 0 performance regressions! Performance is the same for 612 metrics, 10 unstable metrics, 1 flaky benchmarks without significant changes.
|
Codex Review Summary: ✅ CompletedThis comment shows the latest Codex review activity on this pull request.
ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings. |
There was a problem hiding this comment.
More details
The completed static review found no actionable defect in native initialization, compatibility imports, or build registration. Runtime loading and thread behavior remain unverified by execution.
🤖 Bits Code Review · Commit d9f72f5
Part of replacing #22018 with smaller PRs on
main. Addresses#22018 (comment).
What
ddtrace/internal/_threads.cpp/_threads.pyitoddtrace/internal/native/, the package thatbecomes
ddtrace-native._threadsis compiled code with no Python ddtrace imports.ddtrace.internal._threadsin two places. Both now come from the name it is importedunder: the module-state lookup uses the module's
__name__, and thePeriodicThreadtype name is built fromit when the module first runs. No compile-time macro, and the same source works as
_ddtrace_native._threads.PeriodicThread.__module__follows the module; nothing pickles these threads.threads.py,periodic.py, the trace processor, profiling's_threading.pyx, tests,docs) use the new path.
ddtrace/internal/_threads.pystays as a temporary alias of the new module, so the serverless testtests/contrib/aws_lambda/test_runtime_id.pyis not touched here. A follow-up reviewed by its owners movesthat import and removes the alias.
Tests
tests/internal/test_threads.py: the binary loads under a bare name in an interpreter that never importsddtrace, as
ddtrace-nativewill.tests/internal/test_periodic.py: one assert reordered (mypy reported it unreachable once the file was touched).🤖 Generated with Claude Code