DEBUG-3182 Rework DI loading #4233
Closed
+125
−97
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
What does this PR do?
This PR separates the part of DI that is required for code tracker (which is the code tracker itself and the DI.current_component group of methods, plus exception classes) to be self-contained. Currently in master loading
datadog/di/init
would bring indatadog/di
as well which is too much (for example, that would cause DI to attempt to load ActiveRecord contrib, which is definitely not the right time for it).Motivation:
Ensuring DI code tracker is loaded early without causing the rest of dd-trace-rb to be loaded early.
Change log entry
Yes: Improved early loading mechanism of dynamic instrumentation (
datadog/di/init
).Additional Notes:
While this PR changes the behavior of
datadog/di/init
, this behavior has not yet been documented anywhere and should not be used by customers.How to test the change?
Integration tests specifically for
datadog/di/init
will be added in a follow-up PR. The existing unit tests verify that basic DI functionality continues to operate correctly.