-
Notifications
You must be signed in to change notification settings - Fork 412
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
fix(lib-injection): do not import user installed ddtrace #11317
Conversation
|
96e3fc1
to
d5246d0
Compare
But once we have the spec we could potentially get hold of the |
Yes, but is it worth the overhead to do that? 🤷🏻 not sure it gets us anything else of value, especially since this is only a debug log, at least origin gives us some hints as to what is up / where the user has it installed. |
BenchmarksBenchmark execution time: 2024-11-08 00:08:41 Comparing candidate commit 5d7dbfe in PR branch Found 0 performance improvements and 0 performance regressions! Performance is the same for 388 metrics, 2 unstable metrics. |
Wouldn't we need unit or regression tests to validate this change? |
Yes, but I have no idea where this regression test should go. I didn't see any lib-injection tests in this repo, so probably needs to be a system test change? I can take a quick look into that today, I would like a regression test. |
/merge |
Devflow running:
|
/merge |
Devflow running:
|
(cherry picked from commit 71a7a6c)
One of the checks we do when auto-injecting into a process is to see if the user already has
ddtrace
installed. If we do, then we will not inject into it.However, the way we check if the user has
ddtrace
installed is weimport ddtrace
. This may have an unintended consequence of importingddtrace
into a process which otherwise wouldn't normally.The impact of importing
ddtrace
should be fairly low, since we won't instrument anything, but it is better to avoid the import overhead if the user wasn't going to import it anyways.Instead we move to using
importlib.util.find_spec
to search for the module on thesys.meta_path
. The downside to doing this is we won't know the installedddtrace
version.Checklist
Reviewer Checklist