Skip to content
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

chore: hide chained loader methods from tracebacks #11911

Open
wants to merge 2 commits into
base: main
Choose a base branch
from

Conversation

P403n1x87
Copy link
Contributor

@P403n1x87 P403n1x87 commented Jan 13, 2025

The tracebacks arising from import errors include many intermediate frames generated by the import hook machinery that we implement in our module watchdog solution to intercept module imports. Before reraising any import errors, we try to modify the traceback to remove our shim methods to reduce the noise generated in logs.

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

The tracebacks arising from import errors include many intermediate
frames generated by the import hook machinery that we implement in our
module watchdog solution to intercept module imports. Before reraising
any import errors, we try to modify the traceback to remove our shim
methods to reduce the noise generated in logs.
@P403n1x87 P403n1x87 added the changelog/no-changelog A changelog entry is not required for this PR. label Jan 13, 2025
Copy link
Contributor

github-actions bot commented Jan 13, 2025

CODEOWNERS have been resolved as:

tests/submod/import_test.py                                             @DataDog/apm-core-python
ddtrace/internal/module.py                                              @DataDog/debugger-python @DataDog/apm-core-python
tests/internal/test_module.py                                           @DataDog/debugger-python @DataDog/apm-core-python

@P403n1x87 P403n1x87 requested a review from mabdinur January 13, 2025 14:52
@datadog-dd-trace-py-rkomorn
Copy link

datadog-dd-trace-py-rkomorn bot commented Jan 13, 2025

Datadog Report

Branch report: chore/hide-chained-loader-frames-from-tb
Commit report: def4836
Test service: dd-trace-py

✅ 0 Failed, 87 Passed, 1468 Skipped, 4m 2.54s Total duration (36m 23.82s time saved)

@pr-commenter
Copy link

pr-commenter bot commented Jan 13, 2025

Benchmarks

Benchmark execution time: 2025-01-22 12:40:53

Comparing candidate commit def4836 in PR branch chore/hide-chained-loader-frames-from-tb with baseline commit 30e3b76 in branch main.

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

scenario:iast_aspects-ospathsplit_aspect

  • 🟥 execution_time [+462.022ns; +528.613ns] or [+12.025%; +13.758%]

Copy link
Contributor

@mabdinur mabdinur left a comment

Choose a reason for hiding this comment

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

This is great! Can we also add a release note and a unittest?

@P403n1x87 P403n1x87 marked this pull request as ready for review January 22, 2025 12:00
@P403n1x87 P403n1x87 requested review from a team as code owners January 22, 2025 12:00
@P403n1x87 P403n1x87 enabled auto-merge (squash) January 22, 2025 12:02
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