Skip to content

chore(profiling-315): collectors and py3.15 CI matrix - #19270

Draft
vlad-scherbich wants to merge 4 commits into
vlad/ddtracepy-315-profiling-nativefrom
vlad/ddtracepy-315-profiling-collectors
Draft

chore(profiling-315): collectors and py3.15 CI matrix#19270
vlad-scherbich wants to merge 4 commits into
vlad/ddtracepy-315-profiling-nativefrom
vlad/ddtracepy-315-profiling-collectors

Conversation

@vlad-scherbich

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

Copy link
Copy Markdown
Contributor

prev: #19269 | next: #19272

Description

Delta vs #19269.

setup.py raises the profiling / crashtracker / memalloc / _threading build gates from < (3, 15) to < (3, 16), and sets PYO3_USE_ABI3_FORWARD_COMPATIBILITY=1 on 3.15. Collectors (asyncio, exception, stack, threading) stub with CollectorUnavailable if the Cython extension is missing. profiling_native_py315 is a separate allow_failure job. Riot opt-in: crashtracker native 3.15 and grpc 3.15. GitHub setup-python 3.15 for package-version generation. asyncio gather/_wait wrappers catch RuntimeError from current_task().

.riot/requirements/222bcd0.txt contains unresolved git conflict markers.

Does not add the sys.monitoring asyncio path (that's #19272).

Layer Meaning Which PR
Compiled setup.py builds profiling natives on 3.15 this PR
Armed collector stubs if extension missing; native CI allow_failure this PR
Observable

Testing

Risks

Additional Notes

.riot/requirements/222bcd0.txt in this diff is conflicted. No changelog/no-changelog label on this PR.

Contributes to #17817

@datadog-prod-us1-5

datadog-prod-us1-5 Bot commented Jul 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.

🚦 17 Pipeline jobs failed

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

View more details · View in GitLab

DataDog/apm-reliability/dd-trace-py | build linux serverless: [amd64, cp315-cp315, v126532274-233089d-musllinux_1_2_x86_64, 1] — 🔧 Needs a code fix, caused by this PR

View more details · View in GitLab

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

View all 17 failed jobs.

ℹ️ 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: 47ff18b | Docs | View more details | Give us feedback!

@vlad-scherbich
vlad-scherbich force-pushed the vlad/ddtracepy-315-profiling-native branch from 9a117a3 to 188e8e1 Compare August 21, 2026 04:53
@vlad-scherbich
vlad-scherbich force-pushed the vlad/ddtracepy-315-profiling-collectors branch from 7d3e825 to 9ef0d6d Compare August 21, 2026 04:53
@vlad-scherbich
vlad-scherbich force-pushed the vlad/ddtracepy-315-profiling-native branch from 188e8e1 to e6e1f72 Compare August 21, 2026 08:44
@vlad-scherbich
vlad-scherbich force-pushed the vlad/ddtracepy-315-profiling-collectors branch from 9ef0d6d to 6f9a44c Compare August 21, 2026 08:44
@cit-pr-commenter-54b7da

cit-pr-commenter-54b7da Bot commented Aug 21, 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.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.llmobs -> ddtrace.llmobs._evaluators -> ddtrace.llmobs._evaluators.format -> ddtrace.llmobs._experiment -> ddtrace.llmobs
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 21, 2026

Copy link
Copy Markdown

Codeowners resolved as

Resolved from the full PR diff against vlad/ddtracepy-315-profiling-native using the target branch CODEOWNERS file.
CODEOWNERS team requests not listed below are not required by the current file set.

.github/workflows/generate-package-versions.yml                         @DataDog/python-guild @DataDog/apm-core-python
.gitlab-ci.yml                                                          @DataDog/python-guild @DataDog/apm-core-python
.gitlab/templates/build-base-venvs.yml                                  @DataDog/python-guild @DataDog/apm-core-python
.riot/requirements/1c6cb02.txt                                          @DataDog/apm-python
.riot/requirements/222bcd0.txt                                          @DataDog/apm-python
.riot/requirements/95077af.txt                                          @DataDog/apm-python
.riot/requirements/e26245b.txt                                          @DataDog/apm-python
ddtrace/internal/monitoring.py                                          @DataDog/apm-core-python
ddtrace/profiling/_asyncio.py                                           @DataDog/profiling-python
ddtrace/profiling/collector/asyncio.py                                  @DataDog/profiling-python
ddtrace/profiling/collector/exception.py                                @DataDog/profiling-python
ddtrace/profiling/collector/stack.py                                    @DataDog/profiling-python
ddtrace/profiling/collector/threading.py                                @DataDog/profiling-python
riotfile.py                                                             @DataDog/apm-python
scripts/requirements_to_csv.py                                          @DataDog/python-guild
setup.py                                                                @DataDog/python-guild
tests/profiling/test_scheduler.py                                       @DataDog/profiling-python

@cit-pr-commenter-54b7da

cit-pr-commenter-54b7da Bot commented Aug 21, 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.base -×-> ddtrace.trace  (product:llmobs -> product:tracing, score=133)
ddtrace.internal.opentelemetry.context -×-> ddtrace.trace  (product:opentelemetry -> product:tracing, score=133)
ddtrace.llmobs._telemetry -×-> ddtrace.trace  (product:llmobs -> product:tracing, score=133)
ddtrace.llmobs._evaluators.runner -×-> 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

@vlad-scherbich
vlad-scherbich force-pushed the vlad/ddtracepy-315-profiling-collectors branch from 6f9a44c to ee28a3f Compare August 21, 2026 18:43
@vlad-scherbich
vlad-scherbich force-pushed the vlad/ddtracepy-315-profiling-native branch from e6e1f72 to 0fb56d5 Compare August 21, 2026 18:43
@vlad-scherbich vlad-scherbich changed the title chore(profiling): update Python profiling collectors for py3.15 chore(profiling): collectors and py3.15 CI matrix Aug 21, 2026
@pr-commenter

pr-commenter Bot commented Aug 21, 2026

Copy link
Copy Markdown

Benchmarks

Benchmark execution time: 2026-08-28 19:10:23

Comparing candidate commit 47ff18b in PR branch vlad/ddtracepy-315-profiling-collectors with baseline commit 23f857d in branch main.

📊 Benchmarking dashboard

Found 0 performance improvements and 7 performance regressions! Performance is the same for 579 metrics, 10 unstable metrics, 3 known flaky benchmarks, 15 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-tracecontext_headers

  • 🟥 execution_time [+2.407µs; +2.654µs] or [+7.576%; +8.354%]

scenario:httppropagationinject-ids_only

  • 🟥 execution_time [+2.608µs; +2.711µs] or [+15.850%; +16.474%]

scenario:iastaspects-add_aspect

  • 🟥 execution_time [+8.095µs; +10.603µs] or [+8.010%; +10.492%]

scenario:iastaspectsospath-ospathbasename_aspect

  • 🟥 execution_time [+133.819µs; +139.935µs] or [+32.003%; +33.466%]

scenario:iastaspectssplit-rsplit_aspect

  • 🟥 execution_time [+40.568µs; +45.977µs] or [+27.884%; +31.603%]

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

  • 🟥 execution_time [+613.307ns; +648.010ns] or [+22.581%; +23.858%]

scenario:tracer-small

  • 🟥 execution_time [+34.723µs; +37.276µs] or [+10.849%; +11.646%]

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 [-743.387ns; +721.276ns] or [-6.814%; +6.611%]

scenario:coreapiscenario-core_dispatch_1_listener

  • unstable execution_time [-32.904ns; +33.733ns] or [-5.396%; +5.532%]

scenario:coreapiscenario-core_dispatch_50_listeners

  • unstable execution_time [-1706.147ns; +1593.862ns] or [-9.976%; +9.320%]

scenario:coreapiscenario-core_dispatch_exception_listeners

  • unstable execution_time [-1045.329ns; +1457.484ns] or [-8.033%; +11.201%]

scenario:coreapiscenario-core_dispatch_listeners

  • unstable execution_time [-331.501ns; +320.510ns] or [-9.006%; +8.708%]

scenario:coreapiscenario-core_dispatch_no_args_listeners

  • unstable execution_time [-251.940ns; +261.982ns] or [-8.584%; +8.926%]

scenario:coreapiscenario-core_dispatch_with_results_1_listener

  • unstable execution_time [-65.604ns; +79.509ns] or [-5.608%; +6.797%]

scenario:coreapiscenario-core_dispatch_with_results_50_listeners

  • unstable execution_time [-3788.821ns; +4103.114ns] or [-9.315%; +10.088%]

scenario:coreapiscenario-core_dispatch_with_results_listeners

  • unstable execution_time [-837.607ns; +704.415ns] or [-10.305%; +8.666%]

scenario:packagesupdateimporteddependencies-import_many_stdlib_cached

  • unstable execution_time [-59792.163ns; +58127.315ns] or [-9.581%; +9.315%]

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

  • 🟥 execution_time [+64.960µs; +70.204µs] or [+26.265%; +28.386%]

scenario:iastaspects-translate_aspect

  • 🟥 execution_time [+95.004µs; +100.840µs] or [+22.109%; +23.467%]

scenario:span-start

  • 🟥 execution_time [+1.490ms; +1.758ms] or [+10.939%; +12.907%]

Known flaky benchmarks without significant changes:

  • scenario:errortrackingflasksqli-baseline
  • scenario:flasksimple-iast-get
  • scenario:iastaspects-casefold_aspect
  • 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_noaspect
  • scenario:iastaspects-upper_noaspect
  • scenario:packagespackageforrootmodulemapping-cache_off
  • scenario:packagespackageforrootmodulemapping-cache_on
  • scenario:sethttpmeta-all-enabled
  • scenario:telemetryaddmetric-record-100-metrics

@vlad-scherbich
vlad-scherbich force-pushed the vlad/ddtracepy-315-profiling-native branch from b2cdb77 to 2d20a3c Compare August 28, 2026 00:45
@vlad-scherbich
vlad-scherbich force-pushed the vlad/ddtracepy-315-profiling-collectors branch from ee28a3f to b7a93de Compare August 28, 2026 00:45
vlad-scherbich added a commit that referenced this pull request Aug 28, 2026
Drop 6-PR / 14-PR numbering. Live stack is #19267#19269#19270#19272#19273. Leave #17849 and official-support / riot off this chain.
@vlad-scherbich
vlad-scherbich force-pushed the vlad/ddtracepy-315-profiling-native branch from 2d20a3c to 29f2a6e Compare August 28, 2026 15:51
@vlad-scherbich
vlad-scherbich force-pushed the vlad/ddtracepy-315-profiling-collectors branch from b7a93de to c3ee47f Compare August 28, 2026 15:51
vlad-scherbich added a commit that referenced this pull request Aug 28, 2026
Drop 6-PR / 14-PR numbering. Live stack is #19267#19269#19270#19272#19273. Leave #17849 and official-support / riot off this chain.
@vlad-scherbich vlad-scherbich changed the title chore(profiling): collectors and py3.15 CI matrix chore(profiling-315): collectors and py3.15 CI matrix Aug 28, 2026
@vlad-scherbich
vlad-scherbich requested a lite review from Copilot August 28, 2026 16:11

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

Updates profiling collectors and CI/build wiring to better support Python 3.15, including making collector imports resilient when profiling Cython extensions are not present and extending the riot/CI matrices and lockfiles to exercise 3.15.

Changes:

  • Add ImportError fallbacks/stubs for profiling collectors that depend on Cython extensions (_lock, _task, _exception) so profiling can be imported and collectors can be gracefully skipped when extensions aren’t available.
  • Update setup.py gating and environment to allow building profiling/crashtracker natives on Python 3.15 (incl. PyO3 ABI3 forward-compat safety net).
  • Extend riot/lockfiles and CI configuration to include Python 3.15 coverage for relevant suites/jobs.

Reviewed changes

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

Show a summary per file
File Description
tests/profiling/test_scheduler.py Stabilizes scheduler logging test by patching upload and adds type hints.
setup.py Enables profiling-related native builds through 3.15 and sets PyO3 ABI3 forward-compat env var on 3.15+.
scripts/requirements_to_csv.py Improves typing (untyped toml) and normalizes CSV line endings.
riotfile.py Adds/selects 3.15 in specific venv definitions and updates a protobuf incompat comment.
ddtrace/profiling/collector/threading.py Adds ImportError fallback stubs when _lock extension isn’t available.
ddtrace/profiling/collector/asyncio.py Adds ImportError fallback stubs when _lock extension isn’t available.
ddtrace/profiling/collector/exception.py Adds ImportError fallback stub for _exception extension.
ddtrace/profiling/collector/stack.py Adds ImportError fallback stub for _task extension to keep StackCollector importable.
ddtrace/profiling/_asyncio.py Adjusts task-linking wrappers to avoid failures when called outside a running loop.
ddtrace/internal/monitoring.py Adds a guarded fallback when PY_UNWIND is rejected as a local monitoring event.
.riot/requirements/e26245b.txt Adds a newly generated Python 3.15 lockfile.
.riot/requirements/95077af.txt Adds a newly generated Python 3.15 lockfile.
.riot/requirements/222bcd0.txt Adds a newly generated lockfile (currently contains merge-conflict markers).
.riot/requirements/1c6cb02.txt Adds a newly generated Python 3.15 lockfile.
.gitlab/templates/build-base-venvs.yml Extends artifact paths for profiling-native test outputs.
.gitlab-ci.yml Adds an allow-failure profiling native job for Python 3.15 pending base-image support.
.github/workflows/generate-package-versions.yml Adds Python 3.15 to the workflow’s installed Python set.

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

Comment on lines +5 to +20
<<<<<<<< HEAD:.riot/requirements/222bcd0.txt
# pip-compile --allow-unsafe --no-annotate .riot/requirements/222bcd0.in
#
attrs==26.1.0
cloudpickle==3.1.2
coverage[toml]==7.14.3
execnet==2.1.2
gevent==26.5.0
greenlet==3.5.3
httpretty==1.1.4
========
# pip-compile --allow-unsafe --no-annotate .riot/requirements/1857594.in
#
attrs==26.1.0
coverage[toml]==7.13.5
>>>>>>>> 49c1ffeaab (ci(profiling): wire py3.15 into build matrix, riotfile, and CI):.riot/requirements/1857594.txt
Comment thread riotfile.py
],
),
# Python 3.14 - protobuf 4.22.0 is not compatible (TypeError: Metaclasses with custom tp_new)
# Python 3.14+ - protobuf 4.22.0 is not compatible (TypeError: Metaclasses with custom tp_new)
# Conflicts:
#	ddtrace/internal/monitoring.py
#	ddtrace/internal/wrapping/asyncs.py
Profiling-native py3.15 job, setup.py guards, and crashtracker 3.15 opt-in.
Rebased onto the #17849 split stack (PR 17624).

# Conflicts:
#	riotfile.py
#	setup.py
The collectors PR already claimed setup.py could build natives on 3.15, but
rust profiling, libdd_wrapper, and memalloc/ddup/stack were still skipped
below 3.15. Lift those bounds to match the Cython modules. Also stop
attributing current_task() RuntimeError to 3.15.
@vlad-scherbich
vlad-scherbich force-pushed the vlad/ddtracepy-315-profiling-native branch from 29f2a6e to 717a251 Compare August 28, 2026 18:38
@vlad-scherbich
vlad-scherbich force-pushed the vlad/ddtracepy-315-profiling-collectors branch from c3ee47f to 47ff18b Compare August 28, 2026 18:38
vlad-scherbich added a commit that referenced this pull request Aug 28, 2026
Drop 6-PR / 14-PR numbering. Live stack is #19267#19269#19270#19272#19273. Leave #17849 and official-support / riot off this chain.
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.

2 participants