-
Notifications
You must be signed in to change notification settings - Fork 833
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(instrumentation): do not export Node.js types for Browser users #4378
Closed
pichlermarc
wants to merge
4
commits into
open-telemetry:main
from
dynatrace-oss-contrib:fix/instrumentation-node-types
Closed
Changes from all commits
Commits
Show all changes
4 commits
Select commit
Hold shift + click to select a range
b2da7f1
fix(instrumentation): do not export Node.js types for Browser users
pichlermarc d0d2c07
fix(changelog): add changelog entry
pichlermarc 83ab4db
fix(instrumentation): undo import change to test file
pichlermarc acd8fd8
Merge branch 'main' into fix/instrumentation-node-types
pichlermarc File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
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 |
---|---|---|
|
@@ -14,3 +14,5 @@ | |
* limitations under the License. | ||
*/ | ||
export { InstrumentationBase } from './instrumentation'; | ||
export { InstrumentationNodeModuleFile } from './instrumentationNodeModuleFile'; | ||
export { InstrumentationNodeModuleDefinition } from './instrumentationNodeModuleDefinition'; | ||
Comment on lines
+17
to
+18
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. The platform folder should not have any exports for 1 platform but not another. All exports should be used exactly identically. The same code that uses the |
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
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
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.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is not the way the platform-specific exports work and will cause things to break
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Edit: some background info first: the problem is that we use
path.normalize
inInstrumentationNodeModuleDefinition
, which does not exist in the browser.@dyladan I see. We actually rely on this (different exports for different platforms) quite a bit in other packages in this repo (exporter packages, mostly), so we should likely also get on top of this there. It is also (in spirit) the way we had it before it was before we merged #4336.
From what I can tell there are only three other ways for us to fix this then:
normalize
implementationWDYT?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Before #4336 we actually had the bad situation I'm trying to avoid and I had to fix it to get that PR to pass.
Why do you think this is unsafe? There is no valid reason to use a NodeModuleFile in browser anyway and it would be completely broken in other ways. The only thing we need to fix is that we shouldn't import
path
in browser contexts.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looking closer into this, I agree that it's likely fine if we do that (no-op in browser). Closing this PR, will re-open another one with that approach 👍