Repository navigation
refactor(logging): make ddtrace.internal.logger a package and normalize moved module names - #22122
Conversation
Dependency direction analysis
|
Codeowners resolved asResolved from the full PR diff against |
7270701 to
defaeb4
Compare
BenchmarksBenchmark execution time: 2026-11-26 15:24:22 Comparing candidate commit eddd479 in PR branch Found 0 performance improvements and 0 performance regressions! Performance is the same for 618 metrics, 10 unstable metrics, 1 flaky benchmarks without significant changes.
|
Code moved into packages gets module names such as _ddtrace_internal, _ddtrace_coverage and _ddtrace_native. get_logger now normalizes those names to the path they had inside ddtrace instead, e.g. _ddtrace_coverage.code -> ddtrace.internal.coverage.code, so moved code stays under the ddtrace logger: one root for handlers and levels, _DD_<PRODUCT>_LOG_LEVEL keeps working unchanged, and the tracer flare and debug logging need no change. The package table lives in logger.py, which moves to ddtrace-internal as-is, so it adds no import. An unlisted _ddtrace_<x> root maps to ddtrace.<x>. Modules that log through stdlib logging instead of get_logger use the public logger_name() to get the same name. Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
…p module The logger moves to ddtrace-internal, but the runtime setup of the ddtrace logger (handlers, levels, native backend) imports telemetry and stays in dd-trace-py for now. Keep them side by side: logger.py becomes logger/__init__.py and _logger.py becomes logger/setup.py, so the logger is a self-contained package that can later be bridged to ddtrace-internal while setup moves on its own schedule. Importing ddtrace.internal.logger does not import setup or telemetry; a test guards that. DD_LOG_FORMAT moves into tests/internal/test_settings.py, its only user. CODEOWNERS, the suitespecs and the import-layer top-level list follow the move. Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
…ernal port The logger package module moves to ddtrace-internal (DataDog/datadog-apm-python#77). Freeze it so it cannot drift while the port is in flight; the PR that replaces it with a bridge removes the entry. logger/setup.py moves later together with telemetry and stays unfrozen. Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
defaeb4 to
eddd479
Compare
🎉 All green!🧪 All tests passed 🔗 Commit SHA: eddd479 | Docs | View more details | Give us feedback! |
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.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: eddd4791a7
ℹ️ About Codex in GitHub
Codex has been enabled to automatically 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 👍.
When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback".
There was a problem hiding this comment.
More details
Existing ddtrace.* names retain their logger identities, while ddtrace* names map into the ddtrace hierarchy. Runtime import and logging behavior were not exercised during this static review.
🤖 Bits Code Review · Commit eddd479
Description
Part of replacing #22018 with smaller PRs on
main, one per module group. Addresses#22018 (comment): the runtime setup of the
ddtraceloggerlives next to the logger it configures (
ddtrace.internal.logger.setup) instead of in a siblinglogger_setupmodule.
Prepares the logger to be extracted to
ddtrace-internal(DataDog/datadog-apm-python#77 ports
ddtrace/internal/logger/__init__.pyfrom this PR):get_loggernormalizes_ddtrace_<pkg>module names to their formerddtrace.*path (and a publiclogger_name()does the same for stdlib-logging modules), so moved code stays under theddtracelogger.ddtrace/internal/logger.pybecomeslogger/__init__.pyandddtrace/_logger.pybecomeslogger/setup.py(importing the logger does not import setup or telemetry; a test guards it).
DD_LOG_FORMATmoves intotests/internal/test_settings.py, its only user. CODEOWNERS, suitespecs and the import-layer list follow.logger/__init__.pyis added tofrozen-paths.txt;setup.pymoves later with telemetry and stays unfrozen.Testing
tests/internal(py3.12), the telemetry suite,scripts/lint typing, suitespec checks, and a fresh-interpreterimport ddtrace. New tests cover normalization,logger_nameand per-product levels for_ddtrace_*names.Risks
None expected: in dd-trace-py no module uses a
_ddtrace_*name yet, so normalization is a no-op.Additional notes
No release note (
changelog/no-changelog): internal refactor. The two logger bug fixes found while porting are in their own PR, #22126, which should merge first; this PR's freeze hash is then updated.🤖 Generated with Claude Code