Skip to content

fix(tracer): wrap asyncio only when active trace context #13326

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 7 commits into from
May 5, 2025

Conversation

taegyunkim
Copy link
Contributor

@taegyunkim taegyunkim commented May 2, 2025

See linked issue #8907 and release note for details.

Checklist

  • PR author has checked that all the criteria below are met
  • The PR description includes an overview of the change
  • The PR description articulates the motivation for the change
  • The change includes tests OR the PR description describes a testing strategy
  • The PR description notes risks associated with the change, if any
  • Newly-added code is easy to change
  • The change follows the library release note guidelines
  • The change includes or references documentation updates if necessary
  • Backport labels are set (if applicable)

Reviewer Checklist

  • Reviewer has checked that all the criteria below are met
  • Title is accurate
  • All changes are related to the pull request's stated goal
  • Avoids breaking API changes
  • Testing strategy adequately addresses listed risks
  • Newly-added code is easy to change
  • Release note makes sense to a user of the library
  • If necessary, author has acknowledged and discussed the performance implications of this PR as reported in the benchmarks PR comment
  • Backport labels are set in a manner that is consistent with the release branch maintenance policy

Copy link
Contributor

github-actions bot commented May 2, 2025

CODEOWNERS have been resolved as:

releasenotes/notes/tracer-asyncio-create_task-wrap-3d171cb8429be8a7.yaml  @DataDog/apm-python
ddtrace/contrib/internal/asyncio/patch.py                               @DataDog/apm-core-python @DataDog/apm-idm-python
tests/contrib/suitespec.yml                                             @DataDog/apm-core-python @DataDog/apm-idm-python

@taegyunkim taegyunkim changed the title chore(tracer): remove asyncio patching as it was for Python<3.8 fix(tracer): remove asyncio patching as it was for Python<3.8 May 2, 2025
Copy link
Contributor

github-actions bot commented May 2, 2025

Bootstrap import analysis

Comparison of import times between this PR and base.

Summary

The average import time from this PR is: 230 ± 2 ms.

The average import time from base is: 233 ± 1 ms.

The import time difference between this PR and base is: -2.48 ± 0.07 ms.

Import time breakdown

The following import paths have shrunk:

ddtrace.auto 2.041 ms (0.89%)
ddtrace.bootstrap.sitecustomize 1.336 ms (0.58%)
ddtrace.bootstrap.preload 1.336 ms (0.58%)
ddtrace.internal.products 1.336 ms (0.58%)
ddtrace.internal.remoteconfig.client 0.631 ms (0.27%)
ddtrace 0.705 ms (0.31%)
ddtrace._logger 0.035 ms (0.02%)
logging 0.035 ms (0.02%)
traceback 0.035 ms (0.02%)
contextlib 0.035 ms (0.02%)

@pr-commenter
Copy link

pr-commenter bot commented May 2, 2025

Benchmarks

Benchmark execution time: 2025-05-03 02:50:08

Comparing candidate commit 3ec1f0c in PR branch taegyunkim/py37-asyncio-patch with baseline commit 40fe58d in branch main.

Found 0 performance improvements and 1 performance regressions! Performance is the same for 510 metrics, 9 unstable metrics.

scenario:iast_aspects-splitlines_aspect

  • 🟥 execution_time [+113.159ns; +140.278ns] or [+7.777%; +9.641%]

@taegyunkim taegyunkim changed the title fix(tracer): remove asyncio patching as it was for Python<3.8 fix(tracer): wrap asyncio only when active trace context May 3, 2025
@taegyunkim taegyunkim linked an issue May 3, 2025 that may be closed by this pull request
@taegyunkim taegyunkim marked this pull request as ready for review May 3, 2025 02:02
@taegyunkim taegyunkim requested review from a team as code owners May 3, 2025 02:02
@taegyunkim taegyunkim added the Tracing Distributed Tracing label May 3, 2025
@taegyunkim taegyunkim enabled auto-merge (squash) May 5, 2025 16:33
@taegyunkim taegyunkim merged commit aa52c00 into main May 5, 2025
622 of 624 checks passed
@taegyunkim taegyunkim deleted the taegyunkim/py37-asyncio-patch branch May 5, 2025 16:33
brettlangdon pushed a commit that referenced this pull request May 6, 2025
See linked issue #8907 and
release note for details.


## Checklist
- [x] PR author has checked that all the criteria below are met
- The PR description includes an overview of the change
- The PR description articulates the motivation for the change
- The change includes tests OR the PR description describes a testing
strategy
- The PR description notes risks associated with the change, if any
- Newly-added code is easy to change
- The change follows the [library release note
guidelines](https://ddtrace.readthedocs.io/en/stable/releasenotes.html)
- The change includes or references documentation updates if necessary
- Backport labels are set (if
[applicable](https://ddtrace.readthedocs.io/en/latest/contributing.html#backporting))

## Reviewer Checklist
- [x] Reviewer has checked that all the criteria below are met 
- Title is accurate
- All changes are related to the pull request's stated goal
- Avoids breaking
[API](https://ddtrace.readthedocs.io/en/stable/versioning.html#interfaces)
changes
- Testing strategy adequately addresses listed risks
- Newly-added code is easy to change
- Release note makes sense to a user of the library
- If necessary, author has acknowledged and discussed the performance
implications of this PR as reported in the benchmarks PR comment
- Backport labels are set in a manner that is consistent with the
[release branch maintenance
policy](https://ddtrace.readthedocs.io/en/latest/contributing.html#backporting)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Tracing Distributed Tracing
Projects
None yet
Development

Successfully merging this pull request may close these issues.

RuntimeWarnings in IPython when asyncio integration is active
3 participants