Skip to content

chore(py-315): logging version warning - #19267

Open
vlad-scherbich wants to merge 1 commit into
mainfrom
vlad/315-peripheral-compat
Open

chore(py-315): logging version warning#19267
vlad-scherbich wants to merge 1 commit into
mainfrom
vlad/315-peripheral-compat

Conversation

@vlad-scherbich

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

Copy link
Copy Markdown
Contributor

prev: #19903 | next: #19906

Description

Delta vs #19903.

logging.get_version() returns "" instead of reading the deprecated logging.__version__.

Also drops rST double-backticks in the patch() docstring.

Native profiling is not in this PR.

Testing

Risks

Additional Notes

changelog/no-changelog.

Contributes to #17817

@datadog-prod-us1-5

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

Copy link
Copy Markdown
Contributor

Pipelines  Tests

⚠️ Warnings

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

🚦 2 Pipeline jobs failed

DataDog/apm-reliability/dd-trace-py | system-tests parametric — 🔄 Retry may pass, looks flaky

View more details · View in GitLab

DataDog/apm-reliability/dd-trace-py | download_dependency_wheels: [3.15.0rc1, 3.15]

View more details · View in GitLab

ℹ️ Info

No other issues found (see more)

🧪 All tests passed
❄️ No new flaky tests detected

Useful? React with 👍 / 👎

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

vlad-scherbich added a commit that referenced this pull request Jul 24, 2026
Update pr-numbers, generate-pr-urls, MANUAL_EXISTING_PRS, and rebuild-stack
to reflect linear stack with peripheral/profiling before packaging (#19254).
Replacement PRs #19267#19275 supersede wrongly-merged #19255#19259.
@vlad-scherbich
vlad-scherbich changed the base branch from vlad/315-ci-autoregen-lockfiles to vlad/ci-fix-smoke-tests-py315 August 21, 2026 04:51
@vlad-scherbich
vlad-scherbich force-pushed the vlad/315-peripheral-compat branch from 32359ee to 9e90c28 Compare August 21, 2026 04:53
vlad-scherbich added a commit that referenced this pull request Aug 21, 2026
Update pr-numbers, generate-pr-urls, MANUAL_EXISTING_PRS, and rebuild-stack
to reflect linear stack with peripheral/profiling before packaging (#19254).
Replacement PRs #19267#19275 supersede wrongly-merged #19255#19259.
@pr-commenter

pr-commenter Bot commented Aug 21, 2026

Copy link
Copy Markdown

Benchmarks

Benchmark execution time: 2026-08-30 18:04:14

Comparing candidate commit cebad2e in PR branch vlad/315-peripheral-compat with baseline commit df11b57 in branch vlad/py315-pyo3-contextvar.

📊 Benchmarking dashboard

Found 0 performance improvements and 7 performance regressions! Performance is the same for 577 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-tracecontext_headers

  • 🟥 execution_time [+2.442µs; +2.657µs] or [+7.705%; +8.384%]

scenario:httppropagationinject-ids_only

  • 🟥 execution_time [+2.654µs; +2.796µs] or [+16.130%; +16.993%]

scenario:iastaspects-title_aspect

  • 🟥 execution_time [+75.099µs; +82.448µs] or [+27.987%; +30.726%]

scenario:iastaspectsospath-ospathbasename_aspect

  • 🟥 execution_time [+120.190µs; +127.356µs] or [+29.071%; +30.804%]

scenario:iastaspectssplit-rsplit_aspect

  • 🟥 execution_time [+24.895µs; +28.576µs] or [+17.580%; +20.179%]

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

  • 🟥 execution_time [+618.045ns; +662.330ns] or [+22.705%; +24.332%]

scenario:tracer-small

  • 🟥 execution_time [+33.586µs; +36.504µs] or [+10.177%; +11.061%]

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 [-706.592ns; +756.299ns] or [-6.485%; +6.942%]

scenario:coreapiscenario-core_dispatch_1_listener

  • unstable execution_time [-34.954ns; +30.932ns] or [-5.689%; +5.034%]

scenario:coreapiscenario-core_dispatch_50_listeners

  • unstable execution_time [-1663.669ns; +1617.431ns] or [-9.775%; +9.503%]

scenario:coreapiscenario-core_dispatch_exception_listeners

  • unstable execution_time [-986.556ns; +1543.681ns] or [-7.585%; +11.869%]

scenario:coreapiscenario-core_dispatch_listeners

  • unstable execution_time [-319.289ns; +332.858ns] or [-8.678%; +9.047%]

scenario:coreapiscenario-core_dispatch_no_args_listeners

  • unstable execution_time [-256.345ns; +256.805ns] or [-8.737%; +8.753%]

scenario:coreapiscenario-core_dispatch_with_results_1_listener

  • unstable execution_time [-54.271ns; +98.366ns] or [-4.606%; +8.349%]

scenario:coreapiscenario-core_dispatch_with_results_50_listeners

  • unstable execution_time [-3899.004ns; +3996.925ns] or [-9.611%; +9.852%]

scenario:coreapiscenario-core_dispatch_with_results_listeners

  • unstable execution_time [-689.395ns; +863.002ns] or [-8.537%; +10.687%]

scenario:packagesupdateimporteddependencies-import_many_stdlib_cached

  • unstable execution_time [-60.499µs; +57.575µs] or [-9.701%; +9.232%]

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 [+63.454µs; +71.171µs] or [+25.747%; +28.878%]

scenario:span-start

  • 🟥 execution_time [+1.262ms; +1.401ms] or [+9.065%; +10.064%]

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_aspect
  • 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

Base automatically changed from vlad/ci-fix-smoke-tests-py315 to main August 21, 2026 06:01
@vlad-scherbich
vlad-scherbich requested a lite review from Copilot August 21, 2026 07:52
@vlad-scherbich

Copy link
Copy Markdown
Contributor Author

@codex review

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 9e90c28497

ℹ️ About Codex in GitHub

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

Comment thread ddtrace/debugging/_function/store.py

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

This PR is part of the Python 3.15 compatibility/parity effort (#17809), focusing on making import-time behavior degrade gracefully (rather than crashing) for profiling, bytecode wrapping/injection dependents, logging, and AppSec-related instrumentation, with targeted tests and documentation updates.

Changes:

  • Make wrapping/bytecode-injection modules importable on Python 3.15+ while keeping runtime APIs (wrap(), inject_hook(), etc.) raising NotImplementedError when invoked.
  • Add profiling “availability” gating (is_available / failure_msg) so ddtrace.profiling.auto can warn and skip instead of crashing when native extensions are missing.
  • Add/adjust tests and docs for the new degradation behavior; suppress Python 3.15+ logging.__version__ deprecation warnings.

Reviewed changes

Copilot reviewed 16 out of 16 changed files in this pull request and generated 1 comment.

Show a summary per file
File Description
tests/smoke_test.py Restores environment safely and asserts product plugin loading doesn’t silently fail during WAF smoke test.
tests/profiling/test_profiler.py Adds subprocess test ensuring ddtrace.profiling.auto import degrades when profiling is unavailable.
tests/internal/test_py315_import_degrade.py New tests validating import-time degradation and expected NotImplementedError behavior on 3.15+.
docs/basic_usage.rst Documents profiling availability checks and auto-import warning/skip behavior.
ddtrace/profiling/bootstrap/sitecustomize.py Gates profiler startup on ddtrace.profiling.is_available, warning and returning when unavailable.
ddtrace/profiling/init.py Implements is_available / failure_msg pattern and provides a stub Profiler that raises on construction when unavailable.
ddtrace/internal/wrapping/generators.py Avoids import-time failure on 3.15+ and raises NotImplementedError at runtime for unsupported wrapping.
ddtrace/internal/wrapping/context.py Same degradation pattern for wrapping context on 3.15+.
ddtrace/internal/wrapping/asyncs.py Same degradation pattern for async wrapping on 3.15+.
ddtrace/internal/wrapping/init.py Adds runtime guards so wrap() / wrap_bytecode() raise NotImplementedError on 3.15+.
ddtrace/internal/module.py Adds _exec_lazy_init fallback to support @lazy module initialization without bytecode wrapping on 3.15+.
ddtrace/internal/compat.py Introduces centralized “next unsupported Python” constants/messages used by wrapping/injection code.
ddtrace/internal/bytecode_injection/init.py Avoids import-time failure on 3.15+ and raises NotImplementedError at runtime for injection APIs.
ddtrace/debugging/_function/store.py Adjusts restore logic, but currently introduces a missing API usage/import (see comments).
ddtrace/contrib/internal/logging/patch.py Suppresses Python 3.15+ DeprecationWarning when reading logging.__version__.
ddtrace/appsec/sca/_instrumenter.py Refactors first-instruction-line detection to handle 3.13+/3.15 differences consistently.
Suppressed comments (1)

ddtrace/debugging/_function/store.py:103

  • This Python 3.15+ branch calls eject_all_hooks(function), but bytecode_injection does not provide that API, so this will fail at runtime if reached. Additionally, hook injection is already disabled for Python >= 3.15 (both inject_hook and inject_hooks raise NotImplementedError), so this cleanup block should be unnecessary when restoring functions.
        if PY >= (3, 15):
            functions: list[FunctionType] = list(self._code_map)
            for function in functions:
                eject_all_hooks(function)


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

Comment thread ddtrace/debugging/_function/store.py Outdated
@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 main using the target branch CODEOWNERS file.
CODEOWNERS team requests not listed below are not required by the current file set.

ddtrace/contrib/internal/logging/patch.py                               @DataDog/apm-core-python @DataDog/apm-idm-python
tests/contrib/logging/test_get_version.py                               @DataDog/apm-core-python @DataDog/apm-idm-python
tests/contrib/logging/test_logging_patch.py                             @DataDog/apm-core-python @DataDog/apm-idm-python

@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

Dependency direction analysis

⚠️ Existing dependency direction violations

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

Show existing violations (showing 5 of 230 highest severity)
ddtrace.internal.tracemethods -×-> ddtrace.trace  (internal-core -> product:tracing, score=134)
ddtrace.llmobs._utils -×-> ddtrace.trace  (product:llmobs -> product:tracing, score=132)
ddtrace.appsec._listeners -×-> ddtrace.trace  (product:appsec -> product:tracing, score=132)
ddtrace.llmobs._integrations.openai -×-> ddtrace.trace  (product:llmobs -> product:tracing, score=132)
ddtrace.llmobs._integrations.anthropic -×-> ddtrace.trace  (product:llmobs -> product:tracing, score=132)

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/315-peripheral-compat branch from 29c8910 to 107d29b Compare August 21, 2026 08:42
vlad-scherbich added a commit that referenced this pull request Aug 21, 2026
Update pr-numbers, generate-pr-urls, MANUAL_EXISTING_PRS, and rebuild-stack
to reflect linear stack with peripheral/profiling before packaging (#19254).
Replacement PRs #19267#19275 supersede wrongly-merged #19255#19259.
@vlad-scherbich vlad-scherbich changed the title fix(py3.15): peripheral compat for profiling, logging, and appsec chore(py3.15): peripheral compat for profiling, logging, and appsec Aug 21, 2026
@vlad-scherbich vlad-scherbich added the changelog/no-changelog A changelog entry is not required for this PR. label Aug 21, 2026
@vlad-scherbich
vlad-scherbich requested a lite review from Copilot August 22, 2026 06:41

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

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

Comment thread ddtrace/internal/bytecode_injection/__init__.py Outdated
Comment thread ddtrace/appsec/sca/_instrumenter.py Outdated
vlad-scherbich added a commit that referenced this pull request Aug 24, 2026
Address Copilot review on PR #19267: eject_all_hooks is intentionally a
no-op compatibility stub (injection disabled on NEXT_PY_VERSION_INFO+),
and _first_instr_line docstring uses plain text consistent with the module.
@vlad-scherbich
vlad-scherbich marked this pull request as ready for review August 24, 2026 16:25
@vlad-scherbich
vlad-scherbich requested a review from a team as a code owner August 24, 2026 16:25
vlad-scherbich added a commit that referenced this pull request Aug 30, 2026
Address Copilot review on PR #19267: eject_all_hooks is intentionally a
no-op compatibility stub (injection disabled on NEXT_PY_VERSION_INFO+),
and _first_instr_line docstring uses plain text consistent with the module.
@vlad-scherbich
vlad-scherbich force-pushed the vlad/315-peripheral-compat branch from 6daa0b8 to cebad2e Compare August 30, 2026 17:38
vlad-scherbich added a commit that referenced this pull request Aug 30, 2026
Update pr-numbers, generate-pr-urls, MANUAL_EXISTING_PRS, and rebuild-stack
to reflect linear stack with peripheral/profiling before packaging (#19254).
Replacement PRs #19267#19275 supersede wrongly-merged #19255#19259.
vlad-scherbich added a commit that referenced this pull request Aug 30, 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 added a commit that referenced this pull request Aug 30, 2026
… the live chain

The analysis checklist and stack helpers still encoded a 14-PR official-support tip. Packaging is not done (requires-python stays <3.15), and the live chain is now #19861#19267#19272#19947#19273.
@vlad-scherbich
vlad-scherbich changed the base branch from vlad/py315-manylinux-wheels to vlad/py315-pyo3-contextvar August 30, 2026 17:39
vlad-scherbich added a commit that referenced this pull request Aug 30, 2026
Address Copilot review on PR #19267: eject_all_hooks is intentionally a
no-op compatibility stub (injection disabled on NEXT_PY_VERSION_INFO+),
and _first_instr_line docstring uses plain text consistent with the module.
@vlad-scherbich
vlad-scherbich force-pushed the vlad/315-peripheral-compat branch from cebad2e to 0ae49ac Compare August 30, 2026 18:13
vlad-scherbich added a commit that referenced this pull request Aug 30, 2026
Address Copilot review on PR #19267: eject_all_hooks is intentionally a
no-op compatibility stub (injection disabled on NEXT_PY_VERSION_INFO+),
and _first_instr_line docstring uses plain text consistent with the module.
@vlad-scherbich
vlad-scherbich force-pushed the vlad/315-peripheral-compat branch from 0ae49ac to 7570fd8 Compare August 30, 2026 18:20
vlad-scherbich added a commit that referenced this pull request Aug 30, 2026
Address Copilot review on PR #19267: eject_all_hooks is intentionally a
no-op compatibility stub (injection disabled on NEXT_PY_VERSION_INFO+),
and _first_instr_line docstring uses plain text consistent with the module.
@vlad-scherbich
vlad-scherbich force-pushed the vlad/315-peripheral-compat branch from 7570fd8 to 27a4eb7 Compare August 30, 2026 18:25
vlad-scherbich added a commit that referenced this pull request Aug 30, 2026
Update pr-numbers, generate-pr-urls, MANUAL_EXISTING_PRS, and rebuild-stack
to reflect linear stack with peripheral/profiling before packaging (#19254).
Replacement PRs #19267#19275 supersede wrongly-merged #19255#19259.
vlad-scherbich added a commit that referenced this pull request Aug 30, 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 added a commit that referenced this pull request Aug 30, 2026
… the live chain

The analysis checklist and stack helpers still encoded a 14-PR official-support tip. Packaging is not done (requires-python stays <3.15), and the live chain is now #19861#19267#19272#19947#19273.
@vlad-scherbich
vlad-scherbich requested a review from a team as a code owner August 31, 2026 18:30
vlad-scherbich added a commit that referenced this pull request Aug 31, 2026
Address Copilot review on PR #19267: eject_all_hooks is intentionally a
no-op compatibility stub (injection disabled on NEXT_PY_VERSION_INFO+),
and _first_instr_line docstring uses plain text consistent with the module.
@vlad-scherbich
vlad-scherbich force-pushed the vlad/315-peripheral-compat branch from 27a4eb7 to 96ef0a8 Compare August 31, 2026 18:40
vlad-scherbich added a commit that referenced this pull request Aug 31, 2026
Update pr-numbers, generate-pr-urls, MANUAL_EXISTING_PRS, and rebuild-stack
to reflect linear stack with peripheral/profiling before packaging (#19254).
Replacement PRs #19267#19275 supersede wrongly-merged #19255#19259.
Comment thread ddtrace/contrib/internal/logging/patch.py Outdated
Comment thread ddtrace/debugging/_function/store.py Outdated
Comment thread ddtrace/debugging/_function/store.py Outdated
Comment thread ddtrace/debugging/_function/store.py Outdated
Comment thread ddtrace/contrib/internal/logging/patch.py
@vlad-scherbich

Copy link
Copy Markdown
Contributor Author

/merge -f --reason "This code change doesn't affect flaky CI jobs."

@gh-worker-devflow-routing-ef8351

Copy link
Copy Markdown

View all feedbacks in Devflow UI.

2026-09-04 04:11:42 UTC ℹ️ Start processing command /merge -f --reason "This code change doesn't affect flaky CI jobs."
If you need support, contact us on Slack #devflow!


2026-09-04 04:11:42 UTCDevflow: /merge -f --reason "This code change doesn't affect flaky CI jobs."

Arguments errors:

If you need support, contact us on Slack #devflow with those details!

logging.__version__ is deprecated on 3.15+ with no replacement API.
Match stdlib integrations (unittest, subprocess, urllib) instead of
silencing the warning.
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.

5 participants