Properly parent lazily loaded module imports.#446
Conversation
aa30bd6 to
a60841b
Compare
a60841b to
9ccbed9
Compare
| _cold_start = False | ||
| _proactive_initialization = False | ||
| _lambda_container_initialized = True | ||
| from ddtrace import tracer as _tracer |
There was a problem hiding this comment.
Didn't know that you could just assign a value by doing an as wow
| def reset_node_stacks(): | ||
| global root_nodes | ||
| root_nodes = [] | ||
| global import_stack | ||
| import_stack = [] | ||
| root_nodes.clear() |
There was a problem hiding this comment.
why are we removing the globals?
There was a problem hiding this comment.
Good question. Replacing the lists with new ones was causing my test to fail because somewhere we're holding onto an old reference to these objects. The correct solution is to just remove all the stuff from inside the list.
There was a problem hiding this comment.
Yet, this would create an O(n) complexity instead of O(1) of reassigning right? Although I guess we'd have the remaining O(n) space in the wild while reassigning. I tried researching which was the best solution for this, but theres like 5 ways of doing it. So I'll take this one.
There was a problem hiding this comment.
This method does not do an allocation where as the previous did.
duncanista
left a comment
There was a problem hiding this comment.
LGTM overall, left some questions.
What does this PR do?
Properly parent
aws.lambda.importspans for packages that are imported during function execution. Currently app spans are children of the cold start span, which is incorrect.Motivation
Testing Guidelines
Additional Notes
Types of Changes
Check all that apply