Skip to content

chore: include the running CPython version in the unsupported error (PROF-14439) - #19911

Open
vlad-scherbich wants to merge 9 commits into
mainfrom
vlad/py315-unsupported-msg
Open

chore: include the running CPython version in the unsupported error (PROF-14439)#19911
vlad-scherbich wants to merge 9 commits into
mainfrom
vlad/py315-unsupported-msg

Conversation

@vlad-scherbich

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

Copy link
Copy Markdown
Contributor

Description

NEXT_PY_UNSUPPORTED_MSG now interpolates sys.version_info[:2], so wrapping and bytecode-injection raises become This version of CPython is not supported yet: 3.15 (or whatever is running). 3.15 remains unsupported; requires-python is unchanged.

Testing

tests/internal/test_py315_import_degrade.py pins the new wording on the constant. It does not assert wrap() or inject_hook raises: monitoring inject_hook already works, and wrap raise is not this PR.

Risks

None.

Additional Notes

Internal error string only. changelog/no-changelog. Base: #19880. Wrap lift is #19910 (on main) / #19928 on this stack.

@vlad-scherbich vlad-scherbich added the changelog/no-changelog A changelog entry is not required for this PR. label Aug 28, 2026
@cit-pr-commenter-54b7da

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

Copy link
Copy Markdown

Codeowners resolved as

Resolved from the full PR diff against vlad/no-cp315-to-pypi using the target branch CODEOWNERS file.
CODEOWNERS team requests not listed below are not required by the current file set.

.gitlab/scripts/prune-unsupported-wheels.sh                             @DataDog/python-guild @DataDog/apm-core-python
ddtrace/internal/compat.py                                              @DataDog/python-guild @DataDog/apm-core-python
tests/internal/test_py315_import_degrade.py                             @DataDog/apm-core-python

@cit-pr-commenter-54b7da

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 28, 2026

Copy link
Copy Markdown

Dependency direction analysis

⚠️ Existing dependency direction violations

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

Show existing violations (showing 5 of 240 highest severity)
ddtrace.internal.tracemethods -×-> ddtrace.trace  (internal-core -> product:tracing, score=135)
ddtrace.llmobs._integrations.claude_agent_sdk -×-> ddtrace.trace  (product:llmobs -> product:tracing, score=133)
ddtrace.debugging._exception.replay -×-> ddtrace.trace  (product:debugging -> product:tracing, score=133)
ddtrace.llmobs._integrations.litellm -×-> ddtrace.trace  (product:llmobs -> product:tracing, score=133)
ddtrace.llmobs._integrations.vertexai -×-> ddtrace.trace  (product:llmobs -> 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

@datadog-datadog-prod-us1

datadog-datadog-prod-us1 Bot commented Aug 28, 2026

Copy link
Copy Markdown
Contributor

Tests

🎉 All green!

🧪 All tests passed
❄️ No new flaky tests detected

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

@pr-commenter

pr-commenter Bot commented Aug 28, 2026

Copy link
Copy Markdown

Benchmarks

Benchmark execution time: 2026-08-30 03:20:20

Comparing candidate commit 0082495 in PR branch vlad/py315-unsupported-msg with baseline commit 1a43844 in branch vlad/no-cp315-to-pypi.

📊 Benchmarking dashboard

Found 0 performance improvements and 8 performance regressions! Performance is the same for 578 metrics, 10 unstable metrics, 18 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:httppropagationinject-ids_only

  • 🟥 execution_time [+2.505µs; +2.666µs] or [+14.847%; +15.799%]

scenario:iastaspects-add_aspect

  • 🟥 execution_time [+10.427µs; +13.268µs] or [+10.632%; +13.529%]

scenario:iastaspects-repr_aspect

  • 🟥 execution_time [+75.412µs; +82.640µs] or [+21.201%; +23.233%]

scenario:iastaspects-upper_aspect

  • 🟥 execution_time [+57.625µs; +66.133µs] or [+23.655%; +27.147%]

scenario:iastaspectsospath-ospathbasename_aspect

  • 🟥 execution_time [+139.212µs; +148.086µs] or [+35.923%; +38.213%]

scenario:iastaspectssplit-rsplit_aspect

  • 🟥 execution_time [+38.408µs; +43.624µs] or [+26.455%; +30.048%]

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

  • 🟥 execution_time [+636.936ns; +671.706ns] or [+23.396%; +24.673%]

scenario:tracer-small

  • 🟥 execution_time [+29.367µs; +31.853µs] or [+8.761%; +9.503%]

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 [-693.022ns; +770.761ns] or [-6.342%; +7.054%]

scenario:coreapiscenario-core_dispatch_1_listener

  • unstable execution_time [-38.231ns; +28.188ns] or [-6.224%; +4.589%]

scenario:coreapiscenario-core_dispatch_50_listeners

  • unstable execution_time [-1395.044ns; +1873.153ns] or [-8.323%; +11.175%]

scenario:coreapiscenario-core_dispatch_exception_listeners

  • unstable execution_time [-946.465ns; +1537.948ns] or [-7.382%; +11.996%]

scenario:coreapiscenario-core_dispatch_listeners

  • unstable execution_time [-270.803ns; +375.197ns] or [-7.488%; +10.374%]

scenario:coreapiscenario-core_dispatch_no_args_listeners

  • unstable execution_time [-194.542ns; +310.743ns] or [-6.767%; +10.809%]

scenario:coreapiscenario-core_dispatch_with_results_1_listener

  • unstable execution_time [-67.878ns; +80.638ns] or [-5.796%; +6.886%]

scenario:coreapiscenario-core_dispatch_with_results_50_listeners

  • unstable execution_time [-4155.193ns; +3751.151ns] or [-10.206%; +9.214%]

scenario:coreapiscenario-core_dispatch_with_results_listeners

  • unstable execution_time [-893.004ns; +644.527ns] or [-10.958%; +7.909%]

scenario:packagesupdateimporteddependencies-import_many_stdlib_cached

  • unstable execution_time [-44.310µs; +38.509µs] or [-7.092%; +6.164%]

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.

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:iastaspects-upper_noaspect
  • scenario:packagespackageforrootmodulemapping-cache_off
  • scenario:packagespackageforrootmodulemapping-cache_on
  • scenario:sethttpmeta-all-enabled
  • scenario:span-start
  • scenario:telemetryaddmetric-record-100-metrics

@vlad-scherbich
vlad-scherbich force-pushed the vlad/py315-unsupported-msg branch 2 times, most recently from 0f7f01c to 38c0fae Compare August 28, 2026 14:57
@vlad-scherbich
vlad-scherbich changed the base branch from main to vlad/no-cp315-to-pypi August 28, 2026 14:58
@vlad-scherbich
vlad-scherbich marked this pull request as ready for review August 28, 2026 16:10
@vlad-scherbich
vlad-scherbich requested review from a team as code owners August 28, 2026 16:10
@vlad-scherbich
vlad-scherbich requested review from brettlangdon and removed request for a team August 28, 2026 16:10
The release_pypi job uploaded every artifact matching pywheels/ddtrace-*,
which includes the cp315 wheels that "build linux" produces for internal S3
and the private prerelease index. Nothing prevented a Python 3.15 artifact
from reaching PyPI other than the Requires-Python bound baked into the wheel
metadata, which is a property of the artifact rather than a release guard.

Filter cp315 out of the upload list and refuse to upload at all if the
resulting list is empty, so a broken filter fails the job instead of
silently uploading everything or nothing. twine check --strict still runs
over the whole of pywheels/, so cp315 artifacts remain validated. The S3
and adms prerelease paths are unchanged: those are the intended consumers.
…is uploaded

The comment used DEV(py-315), a marker form this repo has never used; main has
three TODO(py-315) anchors and only a bare "# DEV:" convention.

Build the upload list before "twine check" so both steps see the same
distributions. --strict promotes warnings to errors, so checking the unfiltered
directory let a malformed cp315 wheel from an allow_failure build fail a release
whose supported wheels were all fine. release_pypi_prod depends on "ddtrace
package", which carries no serverless artifacts, so the narrowed check loses no
coverage beyond cp315.
release_pypi_prod is gated on .is_release, so a PR pipeline never runs its
shell and the filter added in the previous commit had no coverage. Pull the
script block out of .gitlab/release.yml and run it against fixture directories
with aws and uvx stubbed on PATH, so the assertions cannot drift from the
shipped YAML.

Pins three invariants: cp315 wheels are withheld while 3.15 is unsupported
and everything else including the sdist still uploads; twine check and twine
upload receive the same list, so a malformed wheel from the allow_failure
cp315 build cannot fail a release it is not part of; and an empty list is a
hard error rather than a silent no-op.
Test docstrings are never Sphinx-rendered, and AGENTS.md (L43-50) treats rST
inline markup in them as editor noise. Replace the double-backtick literals in
tests/internal/test_release_pypi_filter.py with plain text.
PR #19880 filtered cp315 out of the PyPI upload only, on the stated premise that
the other destination was "internal S3 and the private prerelease index". That is
wrong: s3://dd-trace-py-builds is anonymously readable and listable and is
registered in DataDog/cloud-inventory as a "Public bucket to host dev builds of
dd-trace-py from GitLab to share with customers". The pipeline republished cp315
wheels to main/ on 2026-08-27, so the leak was live, not historical.

Three mechanisms publish a ddtrace wheel outside the pipeline: twine to PyPI,
aws s3 cp to that bucket, and adms to pypi-private-prereleases. All three now call
.gitlab/scripts/prune-unsupported-wheels.sh first, which holds the withheld ABI
tags in one place. Putting it inside upload-wheels-to-s3.sh covers every S3 caller
and every index suffix, including "upload serverless", which no filter reached
before.

The PyPI-side shell in release.yml reverts to the pre-filter form plus one prune
call, per review feedback: with cp315 gone from the "ddtrace package" artifact,
twine check no longer needs a hand-built file list.

tests/internal/test_unsupported_wheel_pruning.py replaces the PyPI-specific test.
It pins the prune behaviour and asserts that every file under .gitlab/ running a
publish command also calls the prune script, so a new upload path cannot silently
reintroduce cp315.
@vlad-scherbich
vlad-scherbich force-pushed the vlad/py315-unsupported-msg branch from 38c0fae to 4216070 Compare August 28, 2026 18:31
@vlad-scherbich vlad-scherbich changed the title chore: include the running CPython version in the unsupported error chore: include the running CPython version in the unsupported error (PROF-14439) Aug 28, 2026
Monitoring inject_hook already works. The wrap raise tests are skipif
below NEXT and would demand a raise after wrap lift; they do not pin
this PR error-string change.
#19861 only makes cp315 optional in the package validator. Un-prune after
IMAGE_TAG can build a correct wheel, and only once 3.15 is supported.

(cherry picked from commit 703428b)
@vlad-scherbich

Copy link
Copy Markdown
Contributor Author

Superseded by 69baea3

import ddtrace.internal.wrapping.generators # noqa: F401


@pytest.mark.skipif(PYTHON_VERSION_INFO < NEXT_PY_VERSION_INFO, reason=f"{NEXT_PY_VERSION} wrap() degrade")

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

@vlad-scherbich to figure out / revert removal of these tests

Base automatically changed from vlad/no-cp315-to-pypi to main September 1, 2026 17:48
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.

2 participants