Skip to content

chore(package-split): freeze utils cache, paths and obfuscation - #21967

Closed
gnufede wants to merge 2 commits into
mainfrom
gnufede/freeze-internal-utils
Closed

gnufede wants to merge 2 commits into
mainfrom
gnufede/freeze-internal-utils

Conversation

@gnufede

@gnufede gnufede commented Nov 20, 2026 •

Copy link
Copy Markdown
Member

Superseded by #22019, which freezes every wave-1 file in a single PR, stacked on #22018.

Description

This freezes three shared utility modules before they move to the ddtrace-internal package (DataDog/datadog-apm-python#77), as part of the package split:

  • ddtrace/internal/utils/cache.py
  • ddtrace/internal/utils/paths.py
  • ddtrace/internal/utils/obfuscation.py

The freeze keeps the dd-trace-py copies identical to the ported revision (8918a5a385) until dd-trace-py bridges to the released package. It follows the same flow as ddtrace/internal/codeowners.py.

ddtrace/internal/utils/inspection.py is deliberately not frozen. Only resolved_code_origin and its cached helper move, and freezing the whole file would block unrelated changes.

Next steps, after the ddtrace-internal release that ships these modules:

  1. A separate PR removing these entries, with the files unchanged.
  2. The bridge PR re-exporting from _ddtrace_internal.

Testing

Only frozen-paths.txt changes. The hashes are the sha256 of the files at origin/main (8918a5a385). The freeze check validates them on this PR.

Risks

While frozen, any PR that edits these three files fails the freeze check until the move completes.

Additional Notes

None.

These modules are being ported to ddtrace-internal (_ddtrace_internal.utils)
from this revision; freezing them keeps the port identical until the bridge
lands. inspection.py is deliberately not frozen: only resolved_code_origin
moves, and freezing the whole file would block unrelated changes.

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
@cit-pr-commenter-54b7da

Copy link
Copy Markdown

Dependency direction analysis

⚠️ Existing dependency direction violations

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

Show existing violations (showing 5 of 22 highest severity)
ddtrace.internal.tracemethods -×-> ddtrace.trace  (internal-core -> product:tracing, score=103)
ddtrace.llmobs._integrations.bedrock_agents -×-> ddtrace.trace  (product:llmobs -> product:tracing, score=101)
ddtrace.llmobs._integrations.base -×-> ddtrace.trace  (product:llmobs -> product:tracing, score=101)
ddtrace.internal.span_bus -×-> ddtrace._trace.span  (internal-core -> product:tracing, score=35)
ddtrace.llmobs._llmobs -×-> ddtrace._trace.span  (product:llmobs -> product:tracing, score=33)

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

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.

frozen-paths.txt                                                        @DataDog/apm-core-python

@datadog-datadog-prod-us1

datadog-datadog-prod-us1 Bot commented Nov 20, 2026 •

Copy link
Copy Markdown
Contributor

Pipelines  Tests

❌ Errors

Your PR has failed checks. Please review the issues below and take necessary action before merging.

🚦 1 Pipeline job failed

DataDog/apm-reliability/dd-trace-py | package-oci: [linux, arm64]

View more details · View in GitLab

ℹ️ Info

No other issues found (see more)

🧪 All tests passed
❄️ No new flaky tests detected

Useful? React with 👍 / 👎

This comment will be updated automatically if new data arrives.
🔗 Commit SHA: b6b999c | Docs | View more details | Give us feedback!

@gnufede gnufede added the changelog/no-changelog A changelog entry is not required for this PR. label Nov 20, 2026
gh-worker-dd-mergequeue-cf854d Bot pushed a commit that referenced this pull request Nov 22, 2026
## Description

`ddtrace/internal/utils/time.py` created a module-level logger (`log = get_logger(__name__)`) that nothing uses. Removing it makes the module stdlib-only. That lets it move to the `ddtrace-internal` package alongside the other shared utilities (DataDog/datadog-apm-python#77, freeze in #21967), as part of the package split. Both coverage and test optimization use `StopWatch` and `Time`.

## Testing

- `rg` confirms the module never uses `log`, and nothing imports `log` from it.
- The repo's commit hooks (ruff, mypy) pass.
- No behavior change, so no new tests.

## Risks

None. It removes an unused name.

## Additional Notes

None.


Co-authored-by: federico.mon <federico.mon@datadoghq.com>
@gnufede
gnufede marked this pull request as ready for review November 23, 2026 11:02
@gnufede
gnufede requested a review from a team as a code owner November 23, 2026 11:02
@gnufede
gnufede requested review from brettlangdon and removed request for a team November 23, 2026 11:02
@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Nov 23, 2026 •

Copy link
Copy Markdown
Codex Review Summary: ✅ Completed

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review ✅ Completed 2026-11-23T11:02:58.254895Z b6b999c Draft marked ready
ℹ️ About Codex in GitHub

Your team has set up Codex to 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" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

@datadog-datadog-prod-us1 datadog-datadog-prod-us1 Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Bits Code Review: PASS

More details

The three freeze entries match the reviewed files’ SHA-256 hashes and follow the existing freeze-check format. The completed specialist review reported no actionable findings.

Was this helpful? React 👍 or 👎

Open Bits AI session

🤖 Bits Code Review · Commit b6b999c

@gnufede gnufede closed this Nov 23, 2026
gnufede added a commit that referenced this pull request Nov 24, 2026
## Description

**Stacked on #22018** (base `gnufede/package-split-prep`). This freezes
every file of the package split's first wave, so nothing can drift
between the port and the bridge. It replaces #21967, #21973 and #21990.

33 files are frozen, with hashes of their content after #22018:

- **Moving whole to `ddtrace-internal`**
(DataDog/datadog-apm-python#77): `utils/cache.py`, `utils/paths.py`,
`utils/obfuscation.py`, `utils/time.py`, `compat.py`, `assembly.py`,
`logger.py`, `settings/__init__.py`, `settings/env.py`, `module.py`,
`bytecode_injection/core.py`.
- **Partially moving, frozen whole** so the ported symbols stay
identical:
- `utils/__init__.py` (`get_argument_value`, `set_argument_value`,
`ArgumentError`);
  - `utils/formats.py` (`asbool`);
  - `utils/inspection.py` (`resolved_code_origin`);
  - `bytecode_injection/__init__.py` (`HookType`, `INJECTION_ASSEMBLY`).
- **Moving to `ddtrace-coverage`** (DataDog/datadog-apm-python#82): all
18 files under `ddtrace/internal/coverage/`.

`src/native` is not frozen here. The native switch is a separate step
that waits on the profiling team's agreement on the profiling FFI
approach.

The bridge PR, landing after `ddtrace-internal` 0.4.0 and
`ddtrace-coverage` 0.1.0 are released, replaces these modules with
re-exports and removes these entries in the same PR.

## Testing

Only `frozen-paths.txt` changes. All 33 hashes were checked against the
committed file contents (the same comparison `freeze-check.yml` makes).

## Risks

- **Edits are blocked** to these files until the bridge lands. Open PRs
that touch them must merge first or rebase afterwards. Earlier we saw
`module.py` (#21428, #21448), `coverage/instrumented_mode.py` and
`coverage/util.py` (#21405), and older prototype drafts.
- **Hash timing.** Hashes are taken from #22018's content. If #22018
changes before merging, they need regenerating.

## Additional Notes

None.

---------

Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

changelog/no-changelog A changelog entry is not required for this PR.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant