Repository navigation
Conversation
A child setting (e.g. _DD_INTERNAL_COVERAGE_LOG_LEVEL) processed before its parent created the parent node without a level, and the parent's level was never applied. Lookup also returned the level of the last node visited instead of the nearest configured ancestor, so a parent setting was lost for loggers below an intermediate node with no setting of its own. Always assign the level to the terminal node and track the nearest configured level while descending. Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
…ions Exception and stack text was appended to the message while the record still held its %-style args, so a "%s" in an exception message made record formatting fail and the log was lost. Build the message with getMessage() and clear the args first. Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
Codeowners resolved asResolved from the full PR diff against |
Dependency direction analysis
|
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
Static evidence supports order-independent parent/child log levels and preservation of percent signs in exception text. Runtime behavior was not exercised.
🤖 Bits Code Review · Commit 06da6c7
BenchmarksBenchmark execution time: 2026-11-26 15:25:30 Comparing candidate commit 06da6c7 in PR branch Found 0 performance improvements and 0 performance regressions! Performance is the same for 601 metrics, 10 unstable metrics, 1 flaky benchmarks without significant changes.
|
…ze moved module names (#22122) ## Description Part of replacing #22018 with smaller PRs on `main`, one per module group. Addresses #22018 (comment): the runtime setup of the `ddtrace` logger lives next to the logger it configures (`ddtrace.internal.logger.setup`) instead of in a sibling `logger_setup` module. Prepares the logger to be extracted to `ddtrace-internal` (DataDog/datadog-apm-python#77 ports `ddtrace/internal/logger/__init__.py` from this PR): - `get_logger` normalizes `_ddtrace_<pkg>` module names to their former `ddtrace.*` path (and a public `logger_name()` does the same for stdlib-logging modules), so moved code stays under the `ddtrace` logger. - `ddtrace/internal/logger.py` becomes `logger/__init__.py` and `ddtrace/_logger.py` becomes `logger/setup.py` (importing the logger does not import setup or telemetry; a test guards it). `DD_LOG_FORMAT` moves into `tests/internal/test_settings.py`, its only user. CODEOWNERS, suitespecs and the import-layer list follow. - `logger/__init__.py` is added to `frozen-paths.txt`; `setup.py` moves later with telemetry and stays unfrozen. ## Testing `tests/internal` (py3.12), the telemetry suite, `scripts/lint typing`, suitespec checks, and a fresh-interpreter `import ddtrace`. New tests cover normalization, `logger_name` and 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](https://claude.com/claude-code) Co-authored-by: federico.mon <federico.mon@datadoghq.com>
Description
Two bugs in
ddtrace.internal.loggerfound while preparing its extraction toddtrace-internal. They're split out of #22122, the logger refactor, so they can be reviewed and backported on their own._DD_<PRODUCT>_LOG_LEVELsetting was lost when a more specific one (e.g._DD_INTERNAL_COVERAGE_LOG_LEVELbefore_DD_INTERNAL_LOG_LEVEL) was processed first, because the parent node already existed without a level. An intermediate node created only to reach a deeper setting also masked an ancestor's level on lookup.%in the exception text broke the record's formatting.Testing
New tests in
tests/internal/test_logger.py: parent and child settings in either order, an intermediate node with no level, and a%in the exception message.Risks
Low. Only
_DD_*_LOG_LEVELusers who hit the first bug see different levels, and product log records keep the same text when they format correctly today.Additional Notes
Release notes included for both fixes. Should merge before #22122, whose freeze hash for
ddtrace/internal/loggeris then updated.🤖 Generated with Claude Code