-
Notifications
You must be signed in to change notification settings - Fork 423
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
chore(profiling): improve native module loading [backport-2.10] (#10188)
Manual backport of #9719 to 2.10 Crashtracker was not backported to 2.10 and this PR is #9719 without crashtracker edits. The profiler bundles some native components which are not available on all platforms. The pattern we were using for detecting and handling this case was needlessly fiddly and incomplete. This patch refactors some aspects of this. ## Checklist - [x] The PR description includes an overview of the change - [x] The PR description articulates the motivation for the change - [x] The change includes tests OR the PR description describes a testing strategy - [x] The PR description notes risks associated with the change, if any - [x] Newly-added code is easy to change - [x] The change follows the [library release note guidelines](https://ddtrace.readthedocs.io/en/stable/releasenotes.html) - [x] The change includes or references documentation updates if necessary - [x] Backport labels are set (if [applicable](https://ddtrace.readthedocs.io/en/latest/contributing.html#backporting)) ## Reviewer Checklist - [x] Title is accurate - [x] All changes are related to the pull request's stated goal - [x] Avoids breaking [API](https://ddtrace.readthedocs.io/en/stable/versioning.html#interfaces) changes - [x] Testing strategy adequately addresses listed risks - [x] Newly-added code is easy to change - [x] Release note makes sense to a user of the library - [x] If necessary, author has acknowledged and discussed the performance implications of this PR as reported in the benchmarks PR comment - [x] 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) (cherry picked from commit 2057913) Co-authored-by: David Sanchez <[email protected]>
- Loading branch information
1 parent
4d99cf0
commit a77d2b8
Showing
5 changed files
with
142 additions
and
218 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,34 +1,13 @@ | ||
# See ../ddup/__init__.py for some discussion on the is_available attribute. | ||
# This component is also loaded in ddtrace/settings/profiling.py | ||
is_available = False | ||
|
||
|
||
# Decorator for not-implemented | ||
def not_implemented(func): | ||
def wrapper(*args, **kwargs): | ||
raise NotImplementedError("{} is not implemented on this platform".format(func.__name__)) | ||
|
||
|
||
@not_implemented | ||
def start(*args, **kwargs): | ||
pass | ||
|
||
|
||
@not_implemented | ||
def stop(*args, **kwargs): | ||
pass | ||
|
||
|
||
@not_implemented | ||
def set_interval(*args, **kwargs): | ||
pass | ||
failure_msg = "" | ||
|
||
|
||
try: | ||
from ._stack_v2 import * # noqa: F401, F403 | ||
from ._stack_v2 import * # noqa: F403, F401 | ||
|
||
is_available = True | ||
except Exception as e: | ||
from ddtrace.internal.logger import get_logger | ||
|
||
LOG = get_logger(__name__) | ||
|
||
LOG.debug("Failed to import _stack_v2: %s", e) | ||
except Exception as e: | ||
failure_msg = str(e) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.