Skip to content

feat(py-315): enable lib-injection SSI for Python 3.15 (PROF-15812) - #19843

Draft
vlad-scherbich wants to merge 2 commits into
mainfrom
vlad/py315-lib-injection-ssi
Draft

feat(py-315): enable lib-injection SSI for Python 3.15 (PROF-15812)#19843
vlad-scherbich wants to merge 2 commits into
mainfrom
vlad/py315-lib-injection-ssi

Conversation

@vlad-scherbich

@vlad-scherbich vlad-scherbich commented Aug 24, 2026

Copy link
Copy Markdown
Contributor

Description

Part of the Python 3.15 integration parity effort (parent tracker: #17809).

Closes #17813

Bump lib-injection runtime allow-list and wheel download list for Python 3.15 SSI.
Does not change pyproject.toml requires-python — pip still blocks 3.15
install until the capstone packaging PR (#17815/#19254).

Mirrors #15966 (3.14 SSI enable).

Changes

  • sitecustomize.py: allow-list max (3, 15)(3, 16) (strict less-than)
  • dl_wheels.py: add "3.15" to supported_versions
  • Reno note
  • Pre-commit: skip mypy/bandit on lib-injection/ (untyped deployment scripts)

Test plan

  • lib_injection_tests GitLab job green
  • riot run -s lib_injection green

@cit-pr-commenter-54b7da

cit-pr-commenter-54b7da Bot commented Aug 24, 2026

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.

.gitlab/package.yml                                                     @DataDog/python-guild @DataDog/apm-core-python
hooks/pre-commit/05-run-bandit                                          @DataDog/python-guild
hooks/scripts/run-mypy.sh                                               @DataDog/python-guild
lib-injection/dl_wheels.py                                              @DataDog/apm-core-python
lib-injection/sources/sitecustomize.py                                  @DataDog/apm-core-python
releasenotes/notes/ssi-enable-3.15-331733de322fe48b.yaml                @DataDog/apm-python

@cit-pr-commenter-54b7da

cit-pr-commenter-54b7da Bot commented Aug 24, 2026

Copy link
Copy Markdown

Circular import analysis

⚠️ Existing circular imports

There are 3 circular imports that already exist on the base branch and have not been changed by this PR.

ddtrace.llmobs -> ddtrace.llmobs._evaluators -> ddtrace.llmobs._evaluators.format -> ddtrace.llmobs._experiment -> ddtrace.llmobs
ddtrace.errortracking._handled_exceptions.bytecode_injector -> ddtrace.errortracking._handled_exceptions.callbacks -> ddtrace.errortracking._handled_exceptions.collector -> ddtrace.errortracking._handled_exceptions.bytecode_reporting -> ddtrace.errortracking._handled_exceptions.bytecode_injector
ddtrace.appsec._asm_request_context -> ddtrace.appsec._iast._iast_request_context_base -> ddtrace.appsec._iast._iast_env -> ddtrace.appsec._iast.reporter -> ddtrace.appsec._exploit_prevention.stack_traces -> ddtrace.appsec._asm_request_context

@cit-pr-commenter-54b7da

cit-pr-commenter-54b7da Bot commented Aug 24, 2026

Copy link
Copy Markdown

Dependency direction analysis

⚠️ Existing dependency direction violations

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

Show existing violations (showing 5 of 249 highest severity)
ddtrace.internal.tracemethods -×-> ddtrace.trace  (internal-core -> product:tracing, score=135)
ddtrace.llmobs._integrations.base -×-> ddtrace.trace  (product:llmobs -> product:tracing, score=133)
ddtrace.internal.openfeature._span_enrichment -×-> ddtrace.trace  (product:openfeature -> product:tracing, score=133)
ddtrace.llmobs._integrations.vllm -×-> ddtrace.trace  (product:llmobs -> product:tracing, score=133)
ddtrace.internal.test_visibility.api -×-> ddtrace.trace  (product:ci_visibility -> product:tracing, score=133)

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

@vlad-scherbich vlad-scherbich changed the title chore(py-315): enable lib-injection SSI for Python 3.15 feat(py-315): enable lib-injection SSI for Python 3.15 Aug 24, 2026
@vlad-scherbich vlad-scherbich changed the title feat(py-315): enable lib-injection SSI for Python 3.15 feat(py-315): enable lib-injection SSI for Python 3.15 (PROF-15812) Aug 24, 2026
@vlad-scherbich
vlad-scherbich requested a lite review from Copilot August 24, 2026 21:19
@datadog-prod-us1-5

datadog-prod-us1-5 Bot commented Aug 24, 2026

Copy link
Copy Markdown
Contributor

Pipelines  Tests

Unblock PR with BitsAI

⚠️ Warnings

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

🚦 24 Pipeline jobs failed

DataDog/apm-reliability/dd-trace-py | build linux serverless: [arm64, cp315-cp315, v113741357-d2b8243-manylinux2014_aarch64, 1] — 🔧 Needs a code fix, caused by this PR

View more details · View in GitLab

DataDog/apm-reliability/dd-trace-py | build linux: [amd64, cp315-cp315, v113741238-d2b8243-manylinux2014_x86_64] — 🔧 Needs a code fix, caused by this PR

View more details · View in GitLab

DataDog/apm-reliability/dd-trace-py | contrib/kafka 3/4 — 🔧 Needs a code fix, caused by this PR

View more details · View in GitLab

View all 24 failed jobs.

ℹ️ Info

No other issues found (see more)

🧪 All tests passed
❄️ No new flaky tests detected

🔄 Datadog auto-retried 7 jobs - 7 passed on retry View in Datadog

Useful? React with 👍 / 👎

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

Copilot AI 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.

Pull request overview

Prepares lib-injection SSI tooling for Python 3.15 by updating runtime and wheel-version handling, release documentation, and lint exclusions.

Changes:

  • Extends the SSI runtime allow-list and wheel downloader choices.
  • Adds a Python 3.15 release note.
  • Excludes lib-injection scripts from mypy and Bandit checks.

Reviewed changes

Copilot reviewed 5 out of 5 changed files in this pull request and generated 2 comments.

Show a summary per file
File Reviewed changes and findings
releasenotes/notes/ssi-enable-3.15-331733de322fe48b.yaml Documents Python 3.15 SSI support.
lib-injection/sources/sitecustomize.py Extends the runtime upper bound. Critical (1 vote): Python 3.15 wrapping support remains unavailable, so SSI may report successful injection without tracing.
lib-injection/dl_wheels.py Adds Python 3.15 as a downloader option. Moderate (2 votes): The packaging job still enumerates versions only through 3.14, so 3.15 wheels are not downloaded.
hooks/scripts/run-mypy.sh Excludes lib-injection scripts from mypy.
hooks/pre-commit/05-run-bandit Excludes lib-injection scripts from Bandit.
Suppressed comments (2)

hooks/pre-commit/05-run-bandit:3

  • This also disables Bandit for every current and future Python file under lib-injection/, even though the stated untyped-script rationale applies to mypy rather than security scanning. These deployment/startup scripts execute subprocesses, so security regressions in them will no longer be caught by this hook; keep Bandit enabled and handle any narrowly identified false positives with targeted exclusions instead of removing the entire directory.
staged_files=$(git diff --staged --name-only HEAD --diff-filter=ACMR | grep -E '\.py$' | grep -v '^tests/' | grep -v '^lib-injection/' | tr '\n' ' ')

lib-injection/sources/sitecustomize.py:46

  • The new runtime boundary is not covered by tests/lib_injection: no test exercises runtime_version_is_supported, even though the production path aborts when the selected 3.15 site-packages directory is absent. Add assertions that 3.15 is accepted and 3.16 is rejected so the strict upper-bound behavior cannot silently regress.
        "max": Version(version=(3, 16), constraint=""),

💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.


# Supported Python versions lists all python versions that can install at least one version of the ddtrace library.
supported_versions = ["2.7", "3.6", "3.7", "3.8", "3.9", "3.10", "3.11", "3.12", "3.13", "3.14"]
supported_versions = ["2.7", "3.6", "3.7", "3.8", "3.9", "3.10", "3.11", "3.12", "3.13", "3.14", "3.15"]
"cpython": {
"min": Version(version=(3, 9), constraint=""),
"max": Version(version=(3, 15), constraint=""),
"max": Version(version=(3, 16), constraint=""),
@pr-commenter

pr-commenter Bot commented Aug 24, 2026

Copy link
Copy Markdown

Benchmarks

Benchmark execution time: 2026-08-24 22:16:14

Comparing candidate commit 3ecffe0 in PR branch vlad/py315-lib-injection-ssi with baseline commit 16de34b in branch main.

📊 Benchmarking dashboard

Found 0 performance improvements and 7 performance regressions! Performance is the same for 579 metrics, 10 unstable metrics, 2 known flaky benchmarks, 16 flaky benchmarks without significant changes.

Explanation

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.

More details about the CI and significant changes

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 ----------------------------------'

scenario:httppropagationextract-wsgi_valid_headers_all

  • 🟥 execution_time [+454.642ns; +513.463ns] or [+8.372%; +9.455%]

scenario:httppropagationinject-ids_only

  • 🟥 execution_time [+1.934µs; +2.138µs] or [+10.237%; +11.320%]

scenario:iastaspects-add_aspect

  • 🟥 execution_time [+12.105µs; +16.740µs] or [+11.867%; +16.410%]

scenario:iastaspectsospath-ospathbasename_aspect

  • 🟥 execution_time [+137.721µs; +142.272µs] or [+34.795%; +35.945%]

scenario:iastaspectssplit-rsplit_aspect

  • 🟥 execution_time [+17.860µs; +22.956µs] or [+12.392%; +15.928%]

scenario:telemetryaddmetric-1-count-metric-1-times

  • 🟥 execution_time [+398.260ns; +449.255ns] or [+14.560%; +16.425%]

scenario:tracer-small

  • 🟥 execution_time [+30.028µs; +31.916µs] or [+8.971%; +9.534%]

Unstable benchmarks

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 [-700.799ns; +785.106ns] or [-6.323%; +7.083%]

scenario:coreapiscenario-core_dispatch_1_listener

  • unstable execution_time [-33.702ns; +32.446ns] or [-5.492%; +5.288%]

scenario:coreapiscenario-core_dispatch_50_listeners

  • unstable execution_time [-1645.946ns; +1683.410ns] or [-9.631%; +9.850%]

scenario:coreapiscenario-core_dispatch_exception_listeners

  • unstable execution_time [-1118.613ns; +1364.899ns] or [-8.714%; +10.633%]

scenario:coreapiscenario-core_dispatch_listeners

  • unstable execution_time [-336.217ns; +322.479ns] or [-9.112%; +8.740%]

scenario:coreapiscenario-core_dispatch_no_args_listeners

  • unstable execution_time [-252.737ns; +254.627ns] or [-8.678%; +8.743%]

scenario:coreapiscenario-core_dispatch_with_results_1_listener

  • unstable execution_time [-71.386ns; +74.183ns] or [-6.341%; +6.589%]

scenario:coreapiscenario-core_dispatch_with_results_50_listeners

  • unstable execution_time [-3828.805ns; +4042.915ns] or [-9.426%; +9.953%]

scenario:coreapiscenario-core_dispatch_with_results_listeners

  • unstable execution_time [-867.175ns; +643.275ns] or [-10.695%; +7.933%]

scenario:packagesupdateimporteddependencies-import_many_stdlib_cached

  • unstable execution_time [-58.304µs; +60.535µs] or [-9.327%; +9.684%]

Known flaky benchmarks

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

scenario:iastaspects-upper_noaspect

  • 🟥 execution_time [+19.232µs; +23.470µs] or [+11.727%; +14.311%]

scenario:span-start

  • 🟥 execution_time [+1.428ms; +1.585ms] or [+9.499%; +10.538%]

Known flaky benchmarks without significant changes:

  • scenario:errortrackingflasksqli-baseline
  • scenario:flasksimple-iast-get
  • scenario:iastaspects-casefold_aspect
  • scenario:iastaspects-casefold_noaspect
  • scenario:iastaspects-index_aspect
  • scenario:iastaspects-ljust_noaspect
  • scenario:iastaspects-lower_aspect
  • scenario:iastaspects-replace_aspect
  • scenario:iastaspects-swapcase_aspect
  • scenario:iastaspects-title_noaspect
  • scenario:iastaspects-translate_aspect
  • scenario:iastaspects-translate_noaspect
  • scenario:packagespackageforrootmodulemapping-cache_off
  • scenario:packagespackageforrootmodulemapping-cache_on
  • scenario:sethttpmeta-all-enabled
  • scenario:telemetryaddmetric-record-100-metrics

Bump sitecustomize runtime allow-list max to 3.16 (strict less-than) and
add 3.15 to dl_wheels supported_versions. Does not change pyproject.toml
requires-python — PyPI still blocks pip install on 3.15 until the
capstone packaging PR lands.

Skip mypy/bandit pre-commit on lib-injection/ (untyped deployment scripts,
outside ddtrace/).

Closes #17813
Wire download_dependency_wheels for PYTHON_VERSION=3.15 using the
3.15.0rc1 mirror image tag (GA python:3.15.0 not published yet). Mark
the matrix leg allow_failure until cp315 build linux wheels are stable.

Completes the packaging path Copilot flagged: sitecustomize allow-list +
dl_wheels CLI + CI artifact population.
@vlad-scherbich
vlad-scherbich force-pushed the vlad/py315-lib-injection-ssi branch from 3ecffe0 to 1232aa7 Compare August 25, 2026 15:57
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[3.15] Lib-injection max-Python bump in lib-injection/sources/requirements.csv (analogue of #12283)

2 participants