pass tracer to datadog wrapper#1
Open
midu-git wants to merge 1 commit into
Open
Conversation
c581f52 to
0548d77
Compare
536ff2f to
be651a7
Compare
loading tracer, in particular in bundler scenarios.
be651a7 to
576fc85
Compare
This file contains hidden or 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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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?
The tracer is passed explicitly to
datadogwrapper. This reduces the dynamic resolution ofdd-traceto a single place, and resolves the following issue:Assume that you use the libraries
dd-traceanddatadog-lambda-jsas npm modules without the layer. Moreover, assume you use a bundler likeesbuild. In this situation, when initializing the trace as followsand bundling this code with
esbuildsaythe trace initialized will not be the same as the one this library loads, resulting in using a noop tracer for calls within this library. Up to my knowledge, there is no possibility to resolve this issue otherwise.
For the layer case, this change will not have an impact. However, the
datadogwrapper has now a mandatory additional attribute. Thus, this change is potentially a breaking change.To minimize the impact, loading and initializing the tracer has been split into two different functions, the latter one being exported to the user. Thus the user is able to initialize the tracer exactly the same way this library would do it.
Motivation
Testing Guidelines
Additional Notes
Types of Changes
Check all that apply