← Back to Pull requests

chore(internal): share the entry-point trust policy across the split packages #22195

Merged
gnufede merged 10 files (584 lines) on Dec 01, 2026 16:53 UTC
View on GitHub
gnufede gnufede commented on Nov 30, 2026 16:12 UTC
Author

Description

Split out of #22130, which now stacks on it; #22139 and #22140 stack on top.

The split packages (ddtrace-internal, ddtrace-native, ddtrace-coverage, ddtrace-testing, ...) declare entry points that ddtrace loads when it's imported. Every internal entry-point group needs the same answer to "which distribution and module may provide this", so this PR puts that answer in one place:

  • ddtrace/internal/utils/entry_points.py (new, stdlib-only, Python 3.9-safe):

  • - entry_points_with_distributions(group) pairs each entry point with the distribution that declares it.
    - FIRST_PARTY_DISTRIBUTIONS / FIRST_PARTY_MODULE_PREFIXES are the first-party allowlists. Names are PEP 503-normalized, and the prefixes end with a dot, so ddtrace_evil doesn't match ddtrace..
    - is_trusted_entry_point() checks both the distribution and the module path.
    - first_party_entry_points(group) warns about and skips everything else.
  • ddtrace/internal/entry_points.py: product plugins are checked against those allowlists. Before, only ddtrace / ddtrace-serverless under ddtrace. were accepted.
  • Customer impact

    None today. Product plugins from the first-party split packages are now accepted, but none of those packages ships yet. Third-party and lookalike plugins are still refused, as before.

    Testing

  • tests/internal/test_entry_points.py: the lookup on 3.9 and 3.10+, normalization, trusted and untrusted distribution/module pairs, lookalike prefixes, and malformed metadata.

  • tests/internal/test_products.py: a product from ddtrace-internal under _ddtrace_internal. now loads. The existing untrusted and lookalike tests (evil, ddtrace-evil) still pass.
  • Risks

    Low. This widens which distributions may provide product plugins, but only to first-party names. Of those names, only ddtrace-internal is registered on PyPI today. The allowlist prevents accidents; it isn't a defence against an attacker who can install packages.

    Additional Notes

    The policy's other users are the supported-configurations registry (#22130), the library identity (#22139) and the telemetry providers (#22140).

    Diff: 584 lines (+497 / -87) across 10 files Reviewer: juanjux Review duration: 1480m
    All Vouch review confidence checks passed
    Residual risk 0.08 = Change Risk (0.54) × (1 − Review Confidence (0.85)). Review depth and reviewer attention state are adequate.
    Model 1 · Change Risk (XGBoost)
    Score: 0.54 · 584 lines diff across 10 files
    0.54
    Model 2 · Review Depth (DistilBERT)
    Depth Score: 0.79 · 5 substantive comment(s)
    0.79
    Model 3 · Review Timing & Attention
    Session adequacy: 100% · Reviewer familiarity: 50%
    85%
    Bedrock Claude 3 · Risk Narration
    (disconnected)
    Groq
    Groq Risk Narration
    AWS Bedrock is currently disconnected. Generate high-confidence PR triage narration on-demand using Groq.
    Model 1 · Change Risk Attribution
    SHAP Weights
    Diff Size diff_size
    0.381
    Real PR Conversation Timeline
    27 items
    datadog-datadog-prod-us1[bot] datadog-datadog-prod-us1[bot] commented on Nov 30, 2026 16:18 UTC
    Bot

    <a target='_blank' href='https://app.datadoghq.com/ci/pipeline-executions?query=ci_level%3Ajob+%40git.commit.sha%3A0a88591280d26ab96bdceb80b1f348912e4e713d&referrer=pr-comment&start=1796137809000'><picture><source media="(prefers-color-scheme: dark)" srcset="https://static.datadoghq.com/static/images/pr_comments/software_delivery/badges_header/pipelines-ok.svg"/><img src="https://static.datadoghq.com/static/images/pr_comments/software_delivery/badges_header/pipelines-ok-light.svg" alt="Pipelines" align="center" /></picture></a> &nbsp;<a target='_blank' href='https://app.datadoghq.com/ci/test/runs?query=test_level%3Atest+%40git.commit.sha%3Aa15ac3770f1ff5e671324ec4d1333c8982cccaed&referrer=pr-comment&start=1796137809000'><picture><source media="(prefers-color-scheme: dark)" srcset="https://static.datadoghq.com/static/images/pr_comments/software_delivery/badges_header/tests-ok.svg"/><img src="https://static.datadoghq.com/static/images/pr_comments/software_delivery/badges_header/tests-ok-light.svg" alt="Tests" align="center" /></picture></a>

    <details><summary><b>🎉 All green!</b></summary>

    🧪 All tests passed
    ❄️ No new flaky tests detected
    </details>

    <sub>
    This comment will be updated automatically if new data arrives. <br />
    🔗 Commit SHA: 0a88591 | <a href="https://docs.datadoghq.com/integrations/guide/source-code-integration/#pr-comments">Docs</a> | <a href="https://app.datadoghq.com/ci/pull-request/Z2l0aHViLmNvbS9kYXRhZG9nL2RkLXRyYWNlLXB5LzIyMTk1?referrer=pr-comment">View more details</a> | Give us <a href="https://dd.enterprise.slack.com/archives/C07E3U2QRMM">feedback</a>!
    </sub>

    chatgpt-codex-connector[bot] chatgpt-codex-connector[bot] commented on Nov 30, 2026 16:40 UTC
    Bot

    <!-- codex-pull-request-review-summary -->
    <!-- codex-review-state:v1 {"code_review":{"commit_sha":"af32c987c9ab69f2019b043fdb29a8be58241660","has_any_findings":true,"has_unresolved_findings":true,"status":"completed"},"security_review":{"commit_sha":null,"has_any_findings":null,"has_unresolved_findings":null,"status":null}} -->

    <details>
    <summary><strong>Codex Review Summary</strong>: ✅ Completed</summary>

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

    | Review | Status | Commit | Review trigger |
    | --- | --- | --- | --- |
    | 📝 Code Review | ✅ Completed <relative-time datetime="2026-12-01T11:59:33.257663Z">2026-12-01T11:59:33.257663Z</relative-time> | af32c98 | New commits |

    <details> <summary>ℹ️ About Codex in GitHub</summary>
    <br/>

    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.

    </details>

    </details>

    pr-commenter[bot] pr-commenter[bot] commented on Nov 30, 2026 16:43 UTC
    Bot

    Benchmarks

    Benchmark execution time: 2026-12-01 16:11:30

    Comparing candidate commit 0a88591280d26ab96bdceb80b1f348912e4e713d in PR branch gnufede/package-split-entry-point-trust with baseline commit 498511e8e1f87b07f4925fa85abb7cb85619e171 in branch main.

    📊 Benchmarking dashboard

    Found 1 performance improvements and 0 performance regressions! Performance is the same for 620 metrics, 10 unstable metrics, 1 flaky benchmarks without significant changes.

    <details>
    <summary><h3>Explanation</h3></summary>

    This is an A/B test comparing a candidate commit's performance against that of a baseline commit. Performance changes are noted in the tables below as:

    🟩 = significantly better candidate vs. baseline
    🟥 = significantly worse candidate vs. baseline

    We compute a confidence interval (CI) over the relative difference of means between metrics from the candidate and baseline commits, considering the baseline as the reference.

    If the CI is entirely outside the configured SIGNIFICANT_IMPACT_THRESHOLD (or the deprecated UNCONFIDENCE_THRESHOLD), the change is considered significant.

    Feel free to reach out to #apm-benchmarking-platform on Slack if you have any questions.

    <details>
    <summary><h4>More details about the CI and significant changes</h4></summary>

    You can imagine this CI as a range of values that is likely to contain the true difference of means between the candidate and baseline commits.

    CIs of the difference of means are often centered around 0%, because often changes are not that big:

    ---------------------------------(------|---^--------)-------------------------------->
                                  -0.6%    0%  0.3%     +1.2%
                                     |          |        |
             lower bound of the CI --'          |        |
    sample mean (center of the CI) -------------'        |
             upper bound of the CI ----------------------'
    

    As described above, a change is considered significant if the CI is entirely outside the configured SIGNIFICANT_IMPACT_THRESHOLD (or the deprecated UNCONFIDENCE_THRESHOLD).

    For instance, for an execution time metric, this confidence interval indicates a significantly worse performance:

    ----------------------------------------|---------|---(---------^---------)---------->
                                           0%        1%  1.3%      2.2%      3.1%
                                                      |   |         |         |
           significant impact threshold --------------'   |         |         |
                          lower bound of CI --------------'         |         |
           sample mean (center of the CI) --------------------------'         |
                          upper bound of CI ----------------------------------'
    

    </details>

    </details>

    scenario:rand-rand64bits

  • 🟩 execution_time [-15.074ns; -11.903ns] or [-12.468%; -9.846%]
  • <details>
    <summary><h3>Unstable benchmarks</h3></summary>

    These benchmarks have a confidence interval too wide to call a change; treat them as noise rather than signal.

    scenario:coreapiscenario-context_with_data_listeners

  • unstable execution_time [-638.943ns; +833.992ns] or [-6.023%; +7.862%]
  • scenario:coreapiscenario-core_dispatch_1_listener

  • unstable execution_time [-42.429ns; +35.602ns] or [-6.612%; +5.548%]
  • scenario:coreapiscenario-core_dispatch_50_listeners

  • unstable execution_time [-1752.071ns; +2058.334ns] or [-8.858%; +10.406%]
  • scenario:coreapiscenario-core_dispatch_exception_listeners

  • unstable execution_time [-2225.106ns; +1470.885ns] or [-11.332%; +7.491%]
  • scenario:coreapiscenario-core_dispatch_listeners

  • unstable execution_time [-351.515ns; +406.584ns] or [-8.335%; +9.640%]
  • scenario:coreapiscenario-core_dispatch_no_args_listeners

  • unstable execution_time [-215.053ns; +239.372ns] or [-8.128%; +9.047%]
  • scenario:coreapiscenario-core_dispatch_with_results_1_listener

  • unstable execution_time [-79.305ns; +100.443ns] or [-5.839%; +7.396%]
  • scenario:coreapiscenario-core_dispatch_with_results_50_listeners

  • unstable execution_time [-5651.769ns; +3663.233ns] or [-11.465%; +7.431%]
  • scenario:coreapiscenario-core_dispatch_with_results_listeners

  • unstable execution_time [-1155.790ns; +761.166ns] or [-11.055%; +7.280%]
  • scenario:packagesupdateimporteddependencies-import_many_stdlib_cached

  • unstable execution_time [-60.212µs; +51.164µs] or [-10.268%; +8.725%]
  • </details>

    <details>
    <summary><h3>Known flaky benchmarks</h3></summary>

    These benchmarks are marked as flaky and will not trigger a failure. Modify FLAKY_BENCHMARKS_REGEX to control which benchmarks are marked as flaky.

    Known flaky benchmarks without significant changes:

  • scenario:packagespackageforrootmodulemapping-cache_off
  • </details>

    chatgpt-codex-connector[bot] chatgpt-codex-connector[bot] commented on code on Nov 30, 2026 16:44 UTC
    Code Review
    ddtrace/internal/entry_points.py:1
    @@ -52,8 +52,8 @@ def is_trusted(plugin: t.Any) -> bool:
             trusted_dist = True
         else:
             dist_name = dist.metadata["Name"]
    -        trusted_dist = dist_name is not None and dist_name.lower() in _TRUSTED_DISTRIBUTIONS
    -    trusted_module = any(module_path.startswith(p) for p in _TRUSTED_MODULE_PREFIXES)
    +        trusted_dist = dist_name is not None and distribution_name(dist) in FIRST_PARTY_DISTRIBUTIONS

    <sub><sub>!P1 Badge</sub></sub> Provide benchmark coverage for the startup-path change

    The supplied validation lists correctness tests but no startup benchmark results. This trust check runs for every discovered product during bootstrap, and the new helper call adds another metadata read and parse per check. Run the run-benchmarks skill and report a baseline comparison for startup/import latency, as required for startup-sensitive changes.

    AGENTS.md reference: AGENTS.md:L16-L18

    Useful? React with 👍 / 👎.

    <!-- codex-code-review-finding:v1 -->

    chatgpt-codex-connector[bot] chatgpt-codex-connector[bot] commented on code on Nov 30, 2026 16:44 UTC
    Code Review
    ddtrace/internal/utils/entry_points.py:1
    @@ -0,0 +1,137 @@
    +"""Find the entry points of a group, each with the distribution that declares it.
    +
    +Code moving to ddtrace-internal finds what dd-trace-py provides through entry points: the declaring distribution
    +names the provider without importing it. This module imports only the standard library, so it is usable from
    +modules that load before the logger, such as ``settings.env``.
    +
    +It also owns the trust policy for every internal entry-point group (the settings registry, the library identity,
    +the products, the telemetry providers): the allowlists below and :func:`first_party_entry_points` are the single
    +source of it.
    +"""
    +
    +import logging
    +import re
    +import sys
    +import typing as t
    +
    +
    +if t.TYPE_CHECKING:
    +    from importlib.metadata import Distribution
    +    from importlib.metadata import EntryPoint
    +
    +# Stdlib logging, like the other imports: this module loads before the ddtrace logger does.
    +log = logging.getLogger(__name__)
    +
    +# EntryPoint.dist was added in Python 3.10. Annotated as a plain bool so type checkers keep both paths.
    +_ENTRY_POINT_HAS_DIST: bool = sys.version_info >= (3, 10)
    +
    +# The distributions of the ddtrace product family, the only ones allowed to provide an internal entry-point
    +# group: loading an entry point runs the provider's module, and the internal groups are read while ddtrace itself
    +# imports, so an unrelated installed distribution must not run code merely because ddtrace starts. ddtrace and
    +# ddtrace-serverless publish the ddtrace package (setup.py PACKAGE_NAME); the others are the packages dd-trace-py
    +# is split into (the datadog-apm-python repository), existing ones and the planned ones, each shipping the import
    +# namespaces listed in FIRST_PARTY_MODULE_PREFIXES.
    +FIRST_PARTY_DISTRIBUTIONS = frozenset(
    +    {
    +        "ddtrace",
    +        "ddtrace-serverless",
    +        "ddtrace-internal",
    +        "ddtrace-internal-native",
    +        "ddtrace-native",
    +        "ddtrace-native-serverless",
    +        "ddtrace-telemetry",
    +        "ddtrace-coverage",
    +        "ddtrace-testing",
    +    }
    +)
    +
    +# The module namespaces the family ships, paired with the distribution names by the split's naming scheme: each
    +# package owns a `_ddtrace_<name>` namespace, and modules that keep their public path stay under `ddtrace.`
    +# (ddtrace-testing, for instance, ships `ddtrace.testing`). Every prefix ends with the package separator, so a
    +# lookalike module name (ddtracefoo, _ddtrace_testingevil) matches none of them.
    +FIRST_PARTY_MODULE_PREFIXES = frozenset(
    +    {
    +        "ddtrace.",
    +        "_ddtrace_internal.",
    +        "_ddtrace_internal_native.",
    +        "_ddtrace_native.",
    +        "_ddtrace_telemetry.",
    +        "_ddtrace_coverage.",
    +        "_ddtrace_testing.",
    +    }
    +)
    +
    +
    +def _normalize(name: str) -> str:
    +    return re.sub(r"[-_.]+", "-", name).lower()
    +
    +
    +def distribution_name(dist: "Distribution") -> str:
    +    """Return the normalized name of ``dist`` (PEP 503), e.g. ``ddtrace-testing``."""

    <sub><sub>!P1 Badge</sub></sub> Use plain prose in unrendered helper docstrings

    These helpers are not exposed through Sphinx, so formatting parameter names such as dist with reStructuredText double backticks violates the repository's explicit convention for unrendered docstrings. Remove that formatting here and in the corresponding helper docstrings at lines 75 and 80.

    AGENTS.md reference: AGENTS.md:L89-L90

    Useful? React with 👍 / 👎.

    <!-- codex-code-review-finding:v1 -->

    chatgpt-codex-connector[bot] chatgpt-codex-connector[bot] commented on code on Nov 30, 2026 16:44 UTC
    Code Review
    ddtrace/internal/entry_points.py:1
    @@ -52,8 +52,8 @@ def is_trusted(plugin: t.Any) -> bool:
             trusted_dist = True
         else:
             dist_name = dist.metadata["Name"]
    -        trusted_dist = dist_name is not None and dist_name.lower() in _TRUSTED_DISTRIBUTIONS
    -    trusted_module = any(module_path.startswith(p) for p in _TRUSTED_MODULE_PREFIXES)
    +        trusted_dist = dist_name is not None and distribution_name(dist) in FIRST_PARTY_DISTRIBUTIONS

    <sub><sub>!P2 Badge</sub></sub> Reuse the distribution name already read for trust checks

    On Python 3.10+, the preceding line already obtains dist.metadata["Name"], but distribution_name(dist) accesses dist.metadata again. The stdlib Distribution.metadata property is uncached and reads and parses the metadata file on each access, so this adds a redundant file read and email-metadata parse for every product checked during bootstrap. Normalize the name already fetched instead of retrieving the metadata twice.

    Useful? React with 👍 / 👎.

    <!-- codex-code-review-finding:v1 -->

    chatgpt-codex-connector[bot] chatgpt-codex-connector[bot] commented on Nov 30, 2026 16:44 UTC
    Reviewer

    <!-- codex-review-receipt:v1 -->

    💡 Codex Review

    Here are some automated review suggestions for this pull request.

    Reviewed commit: 15c25ceed5

    <details> <summary>ℹ️ About Codex in GitHub</summary>
    <br/>

    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".

    </details>

    datadog-datadog-prod-us1[bot] datadog-datadog-prod-us1[bot] commented on Nov 30, 2026 16:45 UTC
    Reviewer

    <img src="https://img.shields.io/badge/BITS%20CODE%20REVIEW-PASS-1a7f37?labelColor=632CA6&style=for-the-badge&logo=data:image/svg%2Bxml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHZpZXdCb3g9IjAgMCAxMjggMTI4Ij48cGF0aCBkPSJNNjMuNTUsNzQuMzJhNTUuMiw1NS4yLDAsMCwxLTEwLTguMzJjLS4zMS0uMjMtLjI2LTEuMjUtLjI2LTEuMjVBNTUuODEsNTUuODEsMCwwLDAsNjguOTQsNzMuMWExMi43NCwxMi43NCwwLDAsMCw5LjgxLS44MywyNSwyNSwwLDAsMCw3LjUzLTYuNjRsLjM0LjU5YTE0LjkzLDE0LjkzLDAsMCwxLTEuMjksMy4wNiw4LDgsMCwwLDAsMi4yNC44MWw2LS45M2ExOC4xMiwxOC4xMiwwLDAsMCwyLTE0LjMxYy0uOTMtMy01Ljc5LTkuMS02LjE0LTkuNDMtMS4yMi0xLjE3LjIxLTUuNy0yLjIxLTEwLjY1Qzg0LjY1LDI5LjU0LDc4LDI0LjA5LDc1LjA5LDIxLjcyYy44NS42Miw2LjEsMi43NCw4LjU1LDUuNjkuMj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FhMS44LDEuOCwwLDAsMC0uMzEtLjA3QzgwLjQ3LDM0LjU0LDgyLjQ0LDM0LjM0LDgzLjg1LDM1Wm0tNC42LDIxLjYzYy43Mi0uNTcsNC0xLjYyLDcuMDktMiwxLjYtLjE5LDMuODgtLjI5LDQuMzcsMCwxLC41MywxLDIuMTguMzEsMy43Mi0xLDIuMjItMi4zMyw0LjY3LTMuODgsNC44Ny0yLjUyLjM0LTQuOTEtMS03LjYzLTMuMDZBMi4yMywyLjIzLDAsMCwxLDc5LjI1LDU2LjYyWk01NS4zNCwzOS43NWM0LTIuNzMsOS4xNi0xLjY1LDguMy0uODMtMS42NSwxLjU2LjU0LDEuMS43OCw0YTUsNSwwLDAsMS0xLjEyLDRBMjUuNDksMjUuNDksMCwwLDAsNTguNyw0OGEyNiwyNiwwLDAsMC0yLjg1LDEuMTMsNy4zMiw3LjMyLDAsMCwxLS43My0uNTVBNS41Myw1LjUzLDAsMCwxLDU1LjM0LDM5Ljc1Wm02MC4xMSwyNy44Mi0zMi41MSw1LjlhMTYsMTYsMCwwLDEtMy43NSwzLjMzLDExLjc1LDExLjc1LDAsMCwxLTkuMjkuODUsMjAsMjAsMCwwLDEtMy43MS0xLjE5bC03Ljk1LDEuMSw0LjgzLDQwLjIsNTUuNy0xMFpNNjUuODgsMTEzLjkybC0uNDYtNC4zNyw5LjA5LTEzLjg4LDEwLjMzLDMsOC44OC0xNC44NCwxMC42NSw3LDguMS0xNywyLjg3LDMwLjkxWiIgZmlsbD0iI2ZmZiIvPjwvc3ZnPg%3D%3D" alt="Bits Code Review: PASS" height="36"/>

    <details>
    <summary>More details</summary>

    The shared trust helper checks normalized distribution names and dotted module prefixes, preserving rejection of lookalike namespaces while accepting the listed split packages. Static review identified no actionable defect.

    </details>
    Was this helpful? React 👍 or 👎

    <sub>Open Bits AI session</sub>

    <sub>🤖 Bits Code Review · Commit 15c25ce</sub>

    <!-- autotest-meta model=gpt-6.1-sol engine=codex reasoning_effort=high verdict=PASS ddrs_bucket=unknown session_id=31dedad6-5313-4b05-b2ca-f20b384f8eac -->

    <!-- datadog-code-review reviewer-id=bad90057-5c12-4101-ad47-d91c9dff0f90 -->
    <!-- datadog-autotest:v1:prod -->
    <!-- datadog-autotest-delivery:v1:prod:45a2d7ba50da5b2e1574807823f40b6c38c5458f27a7ee560a9d44ac5ea6b731:bundle -->

    cit-pr-commenter-54b7da[bot] cit-pr-commenter-54b7da[bot] commented on Dec 01, 2026 11:57 UTC
    Bot

    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.

    benchmarks/suitespec.yml                                                @DataDog/apm-core-python
    ddtrace/internal/entry_points.py                                        @DataDog/apm-core-python
    ddtrace/internal/integration_hooks.py                                   @DataDog/apm-core-python
    ddtrace/internal/products.py                                            @DataDog/apm-core-python
    ddtrace/internal/utils/entry_points.py                                  @DataDog/apm-core-python
    mypy.ini                                                                @DataDog/apm-python-guild @DataDog/apm-core-python
    tests/internal/test_entry_points.py                                     @DataDog/apm-core-python
    tests/internal/test_integration_hooks.py                                @DataDog/apm-core-python
    tests/internal/test_products.py                                         @DataDog/apm-core-python
    tests/profiling/test_product.py                                         @DataDog/profiling-python
    

    cit-pr-commenter-54b7da[bot] cit-pr-commenter-54b7da[bot] commented on Dec 01, 2026 11:57 UTC
    Bot

    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.

    <details><summary>Show existing violations (showing 5 of 22 highest severity)</summary>

    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)
    

    </details>

    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
    > 

    chatgpt-codex-connector[bot] chatgpt-codex-connector[bot] commented on code on Dec 01, 2026 11:59 UTC
    Code Review
    ddtrace/internal/products.py:1
    @@ -21,7 +21,8 @@
     log = get_logger(__name__)
     
     
    -def get_product_entry_points() -> list[t.Any]:
    +def get_product_entry_points() -> list[tuple[t.Any, t.Any]]:
    +    """Each ddtrace.products entry point, paired with the distribution that declares it."""
         return get_entry_points("ddtrace.products")

    <sub><sub>!P2 Badge</sub></sub> Update the profiling test to unpack entry-point pairs

    The new return shape breaks the unchanged consumer in tests/profiling/test_product.py:1093: test_loading_product_does_not_import_profiler still iterates these results as entry points and evaluates ep.name. Each result is now a tuple, so the test raises AttributeError: 'tuple' object has no attribute 'name' before checking profiler lazy-loading behavior. Update that consumer to unpack (ep, dist), as the other callers now do.

    Useful? React with 👍 / 👎.

    <!-- codex-code-review-finding:v1 -->

    chatgpt-codex-connector[bot] chatgpt-codex-connector[bot] commented on Dec 01, 2026 11:59 UTC
    Reviewer

    <!-- codex-review-receipt:v1 -->

    💡 Codex Review

    Here are some automated review suggestions for this pull request.

    Reviewed commit: af32c987c9

    <details> <summary>ℹ️ About Codex in GitHub</summary>
    <br/>

    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".

    </details>

    juanjux juanjux approved these changes on Dec 01, 2026 11:59 UTC
    Approved Reviewer

    Approved these changes.

    datadog-datadog-prod-us1[bot] datadog-datadog-prod-us1[bot] commented on code on Dec 01, 2026 12:01 UTC
    Code Review
    ddtrace/internal/products.py:1
    @@ -21,7 +21,8 @@
     log = get_logger(__name__)
     
     
    -def get_product_entry_points() -> list[t.Any]:
    +def get_product_entry_points() -> list[tuple[t.Any, t.Any]]:

    <!-- datadog-code-review reviewer-id=bad90057-5c12-4101-ad47-d91c9dff0f90 -->
    <!-- datadog-autotest-inline:v1:prod -->
    <!-- datadog-autotest-delivery:v1:prod:67c4ea4b6f138533ab03152dc29378cf73bbf57b9f0b722364a8315e2d85401b:inline-0 -->

    <sub><sub>!P1</sub></sub> Update the remaining profiler test for paired entry points

    <!-- autotest-finding-meta prod_data_type=none finding_id=b79d67f7-ef43-4a14-8a5e-97fb70a96fa4 prod_effect=static -->
    Returning (entry_point, distribution) tuples breaks tests/profiling/test_product.py::test_loading_product_does_not_import_profiler: its unchanged comprehension accesses ep.name on each tuple, raising AttributeError before checking profiler imports. Update that comprehension to unpack (ep, _) so the existing test can run.

    <!-- datadog-autotest-feedback-legend:v1 -->
    React: 👍 useful · 👎 wrong · 😕 unclear · 👀 right, but not acting on it
    <details><summary>What each reaction means</summary>

  • 👍 Useful: correct, and you're fixing it or will.

  • 👎 Wrong: the finding is incorrect, for example the bug can't happen or the code was misread.

  • 😕 Unclear: you can't tell what it means or why it matters.

  • 👀 Right, not acting: correct, but intended, out of scope for this PR, a known risk, or too minor.

  • </details>

    <sub>🤖 Bits Code Review</sub> <sub>· <a href="https://app.datadoghq.com/code/31dedad6-5313-4b05-b2ca-f20b384f8eac?referrer=autotest-pr-comment">Open Bits AI session</a></sub>

    datadog-datadog-prod-us1[bot] datadog-datadog-prod-us1[bot] commented on Dec 01, 2026 12:01 UTC
    Reviewer

    <img src="https://img.shields.io/badge/BITS%20CODE%20REVIEW-FAIL-CC0000?labelColor=632CA6&style=for-the-badge&logo=data:image/svg%2Bxml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHZpZXdCb3g9IjAgMCAxMjggMTI4Ij48cGF0aCBkPSJNNjMuNTUsNzQuMzJhNTUuMiw1NS4yLDAsMCwxLTEwLTguMzJjLS4zMS0uMjMtLjI2L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NTUuNy0xMFpNNjUuODgsMTEzLjkybC0uNDYtNC4zNyw5LjA5LTEzLjg4LDEwLjMzLDMsOC44OC0xNC44NCwxMC42NSw3LDguMS0xNywyLjg3LDMwLjkxWiIgZmlsbD0iI2ZmZiIvPjwvc3ZnPg%3D%3D" alt="Bits Code Review: FAIL" height="36"/>

    The PR centralizes entry-point trust policy and accepts ddtrace-internal providers.
    Earlier updates restricted the allowlists and handled missing distribution names safely.
    The latest commit enforces distribution checks on Python 3.9 by pairing entry points with distributions.
    One issue remains: an unchanged profiler test expects bare entry points and will raise AttributeError.
    Runtime tests and benchmarks were not run.

    <sub>Open Bits AI session</sub>

    <sub>🤖 Bits Code Review · Commit af32c98</sub>

    <!-- autotest-meta model=gpt-6.1-sol engine=codex reasoning_effort=high verdict=FAIL ddrs_bucket=unknown session_id=31dedad6-5313-4b05-b2ca-f20b384f8eac -->

    <!-- datadog-code-review reviewer-id=bad90057-5c12-4101-ad47-d91c9dff0f90 -->
    <!-- datadog-autotest:v1:prod -->
    <!-- datadog-autotest-delivery:v1:prod:67c4ea4b6f138533ab03152dc29378cf73bbf57b9f0b722364a8315e2d85401b:bundle -->

    datadog-datadog-prod-us1[bot] datadog-datadog-prod-us1[bot] commented on Dec 01, 2026 12:11 UTC
    Reviewer

    <img src="https://img.shields.io/badge/BITS%20CODE%20REVIEW-PASS-1a7f37?labelColor=632CA6&style=for-the-badge&logo=data:image/svg%2Bxml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHZpZXdCb3g9IjAgMCAxMjggMTI4Ij48cGF0aCBkPSJNNjMuNTUsNzQuMzJhNTUuMiw1NS4yLDAsMCwxLTEwLTguMzJjLS4zMS0uMjMtLjI2LTEuMjUtLjI2LTEuMjVBNTUuODEsNTUuODEsMCwwLDAsNjguOTQsNzMuMWExMi43NCwxMi43NCwwLDAsMCw5LjgxLS44MywyNSwyNSwwLDAsMCw3LjUzLTYuNjRsLjM0LjU5YTE0Lj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vPjwvc3ZnPg%3D%3D" alt="Bits Code Review: PASS" height="36"/>

    <details>
    <summary>More details</summary>

    Product and integration-hook loading preserve both distribution and module-namespace checks, including on Python 3.9 where entry points lack a dist attribute. The static reviewer identified no actionable introduced defects.

    </details>
    Was this helpful? React 👍 or 👎

    <sub>Open Bits AI session</sub>

    <sub>🤖 Bits Code Review · Commit d9eb26b</sub>

    <!-- autotest-meta model=gpt-6.1-sol engine=codex reasoning_effort=high verdict=PASS ddrs_bucket=unknown session_id=f99727ef-b190-4695-a757-4fa641baafef -->

    <!-- datadog-code-review reviewer-id=bad90057-5c12-4101-ad47-d91c9dff0f90 -->
    <!-- datadog-autotest:v1:prod -->
    <!-- datadog-autotest-delivery:v1:prod:27eda6910887b5a442185313c96e7652d63f698213180f07cc3bdb07252fbcc4:bundle -->

    brettlangdon brettlangdon commented on Dec 01, 2026 14:56 UTC
    Reviewer

    Should this be owned by ddtrace-internal package?

    taegyunkim taegyunkim approved these changes on Dec 01, 2026 14:57 UTC
    Approved Reviewer

    Approved these changes.

    gnufede gnufede commented on Dec 01, 2026 15:01 UTC
    Author

    Should this be owned by ddtrace-internal package?

    @brettlangdon yes, it should end up there, but not in this PR, moving it now would block the stack on a ddtrace-internal release and #22140 still edits these files

    danielsn danielsn approved these changes on Dec 01, 2026 15:07 UTC
    Approved Reviewer

    Approved these changes.

    brettlangdon brettlangdon commented on code on Dec 01, 2026 15:08 UTC
    Code Review
    ddtrace/internal/utils/entry_points.py:1
    @@ -0,0 +1,133 @@
    +"""Find the entry points of a group, each with the distribution that declares it, and decide which may load.
    +
    +Code moving to ddtrace-internal finds what dd-trace-py provides through entry points: the declaring distribution
    +names the provider without importing it. This module imports only the standard library, so modules that load before
    +the ddtrace logger, such as settings.env, can use it.
    +
    +It is the single source of the trust policy for ddtrace's internal entry-point groups: the allowlists below,
    +is_trusted_entry_point and first_party_entry_points.
    +"""
    +
    +import logging
    +import re
    +import sys
    +import typing as t
    +
    +
    +if t.TYPE_CHECKING:
    +    from importlib.metadata import Distribution
    +    from importlib.metadata import EntryPoint
    +
    +# Stdlib logging, like the other imports: this module loads before the ddtrace logger does.
    +log = logging.getLogger(__name__)
    +
    +# EntryPoint.dist was added in Python 3.10. Annotated as a plain bool so type checkers keep both paths.
    +_ENTRY_POINT_HAS_DIST: bool = sys.version_info >= (3, 10)
    +
    +# The distributions of the ddtrace product family, the only ones allowed to provide an internal entry-point
    +# group: loading an entry point runs the provider's module, and the internal groups are read while ddtrace itself
    +# imports, so an unrelated installed distribution must not run code merely because ddtrace starts. ddtrace and
    +# ddtrace-serverless publish the ddtrace package (setup.py PACKAGE_NAME); ddtrace-internal is the first package
    +# dd-trace-py is split into (the datadog-apm-python repository). Only names Datadog already publishes are listed: an
    +# unregistered name could be published by anyone. Each split package adds its name here, and its namespace to
    +# FIRST_PARTY_MODULE_PREFIXES, once its final name is registered (SDTEST-4101).
    +FIRST_PARTY_DISTRIBUTIONS = frozenset(
    +    {
    +        "ddtrace",
    +        "ddtrace-serverless",
    +        "ddtrace-internal",
    +    }
    +)
    +
    +# The module namespaces the family ships, paired with the distribution names by the split's naming scheme: each
    +# split package owns a _ddtrace_<name> namespace, and modules that keep their public path stay under ddtrace.
    +# Every prefix ends with the package separator, so a lookalike module name (ddtracefoo, _ddtrace_internalfoo)
    +# matches none of them.
    +FIRST_PARTY_MODULE_PREFIXES = frozenset(
    +    {
    +        "ddtrace.",
    +        "_ddtrace_internal.",

    Should we just look for _ddtrace?

    Seems... Wary, but we also have to keep updating this every time we publish a new package?

    TODO: add CI check that this list is up to date with modules/dists defined in datadog-apm-python?

    brettlangdon brettlangdon commented on code on Dec 01, 2026 15:10 UTC
    Code Review
    mypy.ini:1
    @@ -128,6 +128,12 @@ ignore_errors = true
     [mypy-tests.contrib.django.middleware]
     ignore_errors = true
     
    +# tests/profiling/test_product: pre-existing type errors (unreachable branches,
    +# profiling_config implicit reexport, unused "type: ignore" comments) on main
    +# tip, unrelated to the entry-point pairing change that staged this file.

    Comment referencing session not actual reason this is here?

    gnufede gnufede commented on code on Dec 01, 2026 15:12 UTC
    Code Review
    ddtrace/internal/utils/entry_points.py:1
    @@ -0,0 +1,133 @@
    +"""Find the entry points of a group, each with the distribution that declares it, and decide which may load.
    +
    +Code moving to ddtrace-internal finds what dd-trace-py provides through entry points: the declaring distribution
    +names the provider without importing it. This module imports only the standard library, so modules that load before
    +the ddtrace logger, such as settings.env, can use it.
    +
    +It is the single source of the trust policy for ddtrace's internal entry-point groups: the allowlists below,
    +is_trusted_entry_point and first_party_entry_points.
    +"""
    +
    +import logging
    +import re
    +import sys
    +import typing as t
    +
    +
    +if t.TYPE_CHECKING:
    +    from importlib.metadata import Distribution
    +    from importlib.metadata import EntryPoint
    +
    +# Stdlib logging, like the other imports: this module loads before the ddtrace logger does.
    +log = logging.getLogger(__name__)
    +
    +# EntryPoint.dist was added in Python 3.10. Annotated as a plain bool so type checkers keep both paths.
    +_ENTRY_POINT_HAS_DIST: bool = sys.version_info >= (3, 10)
    +
    +# The distributions of the ddtrace product family, the only ones allowed to provide an internal entry-point
    +# group: loading an entry point runs the provider's module, and the internal groups are read while ddtrace itself
    +# imports, so an unrelated installed distribution must not run code merely because ddtrace starts. ddtrace and
    +# ddtrace-serverless publish the ddtrace package (setup.py PACKAGE_NAME); ddtrace-internal is the first package
    +# dd-trace-py is split into (the datadog-apm-python repository). Only names Datadog already publishes are listed: an
    +# unregistered name could be published by anyone. Each split package adds its name here, and its namespace to
    +# FIRST_PARTY_MODULE_PREFIXES, once its final name is registered (SDTEST-4101).
    +FIRST_PARTY_DISTRIBUTIONS = frozenset(
    +    {
    +        "ddtrace",
    +        "ddtrace-serverless",
    +        "ddtrace-internal",
    +    }
    +)
    +
    +# The module namespaces the family ships, paired with the distribution names by the split's naming scheme: each
    +# split package owns a _ddtrace_<name> namespace, and modules that keep their public path stay under ddtrace.
    +# Every prefix ends with the package separator, so a lookalike module name (ddtracefoo, _ddtrace_internalfoo)
    +# matches none of them.
    +FIRST_PARTY_MODULE_PREFIXES = frozenset(
    +    {
    +        "ddtrace.",
    +        "_ddtrace_internal.",

    I would rather fail on the conservative side, than trusting anyone publishing a package starting by _ddtrace inadvertently.

    Yeah, I agree with the CI check 👍

    brettlangdon brettlangdon approved these changes on Dec 01, 2026 15:13 UTC
    Approved Reviewer

    Approved these changes.

    datadog-datadog-prod-us1[bot] datadog-datadog-prod-us1[bot] commented on Dec 01, 2026 15:48 UTC
    Reviewer

    <img src="https://img.shields.io/badge/BITS%20CODE%20REVIEW-PASS-1a7f37?labelColor=632CA6&style=for-the-badge&logo=data:image/svg%2Bxml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHZpZXdCb3g9IjAgMCAxMjggMTI4Ij48cGF0aCBkPSJNNjMuNTUsNzQuMzJhNTUuMiw1NS4yLDAsMCwxLTEwLTguMzJjLS4zMS0uMjMtLjI2LTEuMjUtLjI2LTEuMjVBNTUuODEsNTUuODEsMCwwLDAsNjguOTQsNzMuMWExMi43NCwxMi43NCwwLDAsMCw5LjgxLS44MywyNSwyNSwwLDAsMCw3LjUzLTYuNjRsLjM0LjU5YTE0LjkzLDE0LjkzLDAsMCwxLTEuMjksMy4wNiw4LDgsMCwwLDAsMi4yNC44MWw2LS45M2ExOC4xMiwxOC4xMiwwLDAsMCwyLTE0LjMxYy0uOTMtMy01Ljc5LTkuMS02LjE0LTkuNDMtMS4yMi0xLjE3LjIxLTUuNy0yLjIxLTEwLjY1Qzg0LjY1LDI5LjU0LDc4LDI0LjA5LDc1LjA5LDIxLjcyYy44NS42Miw2LjEsMi43NCw4LjU1LDUuNjkuMjMtLjMuMzItMS44OS41My0yLjI5LTIuMS0yLjc2LTIuMjYtNy42Ni0yLjI2LTlBMTQuODcsMTQuODcsMCwwLDAsODAuNjksMTFhOC4xNiw4LjE2LDAsMCwxLDIuNjUsNC41MywxOC41MSwxOC41MSwwLDAsMCwzLjgyLDguMzRjMy40Myw0LjI2LDYuNTIsNi40NSw4LjA4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4zMyw0LjY3LTMuODgsNC44Ny0yLjUyLjM0LTQuOTEtMS03LjYzLTMuMDZBMi4yMywyLjIzLDAsMCwxLDc5LjI1LDU2LjYyWk01NS4zNCwzOS43NWM0LTIuNzMsOS4xNi0xLjY1LDguMy0uODMtMS42NSwxLjU2LjU0LDEuMS43OCw0YTUsNSwwLDAsMS0xLjEyLDRBMjUuNDksMjUuNDksMCwwLDAsNTguNyw0OGEyNiwyNiwwLDAsMC0yLjg1LDEuMTMsNy4zMiw3LjMyLDAsMCwxLS43My0uNTVBNS41Myw1LjUzLDAsMCwxLDU1LjM0LDM5Ljc1Wm02MC4xMSwyNy44Mi0zMi41MSw1LjlhMTYsMTYsMCwwLDEtMy43NSwzLjMzLDExLjc1LDExLjc1LDAsMCwxLTkuMjkuODUsMjAsMjAsMCwwLDEtMy43MS0xLjE5bC03Ljk1LDEuMSw0LjgzLDQwLjIsNTUuNy0xMFpNNjUuODgsMTEzLjkybC0uNDYtNC4zNyw5LjA5LTEzLjg4LDEwLjMzLDMsOC44OC0xNC44NCwxMC42NSw3LDguMS0xNywyLjg3LDMwLjkxWiIgZmlsbD0iI2ZmZiIvPjwvc3ZnPg%3D%3D" alt="Bits Code Review: PASS" height="36"/>

    <details>
    <summary>More details</summary>

    The shared policy requires both an allowlisted distribution and a first-party module namespace for product plugins and integration hooks. The completed static review identified no actionable defect; runtime behavior was not exercised.

    </details>
    Was this helpful? React 👍 or 👎

    <sub>Open Bits AI session</sub>

    <sub>🤖 Bits Code Review · Commit 0a88591</sub>

    <!-- autotest-meta model=gpt-6.1-sol engine=codex reasoning_effort=high verdict=PASS ddrs_bucket=unknown session_id=f67ec342-f064-42d2-92e4-dad9945cca6f -->

    <!-- datadog-code-review reviewer-id=bad90057-5c12-4101-ad47-d91c9dff0f90 -->
    <!-- datadog-autotest:v1:prod -->
    <!-- datadog-autotest-delivery:v1:prod:0a8102a10ea5d566ee98e75b775ddc6e75469c48e49360847fcbfa6026198876:bundle -->

    gnufede gnufede commented on code on Dec 01, 2026 15:59 UTC
    Code Review
    mypy.ini:1
    @@ -128,6 +128,12 @@ ignore_errors = true
     [mypy-tests.contrib.django.middleware]
     ignore_errors = true
     
    +# tests/profiling/test_product: pre-existing type errors (unreachable branches,
    +# profiling_config implicit reexport, unused "type: ignore" comments) on main
    +# tip, unrelated to the entry-point pairing change that staged this file.
    Reviewers
    Assignees
    gnufede gnufede
    Labels
    risk: low confidence: 85.1% reviewed
    Vouch Risk Breakdown
    AI-powered review risk analysis
    Change Risk
    Change Risk · Model 1 (XGBoost)
    Predicted defect probability (0.00–1.00) based on diff churn, modified sensitive files, and author risk history.
    Score: 54.3% (MEDIUM) · Higher = larger blast radius
    54.3%
    Review Confidence
    Review Confidence · Models 2 & 3
    Scrutiny score (0.00–1.00) combining DistilBERT semantic review depth with reviewer familiarity and session dwell time.
    Score: 85.1% · Lower = rushed or shallow review
    85.1%
    Residual Risk
    Residual Risk · Core Equation
    Residual = Change × (1 − Confidence)
    Unmitigated risk surviving review. ≥ 0.65 triggers an automated re-queue to protect production.
    Score: 8.1% · Safe to merge
    8.1%