-
Notifications
You must be signed in to change notification settings - Fork 199
feat(nodejs): bundling with webpack #1679
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
Merged
serkan-ozal
merged 4 commits into
open-telemetry:main
from
serkan-ozal:feat/nodejs/bundling-with-webpack
Feb 10, 2025
Merged
Changes from all commits
Commits
Show all changes
4 commits
Select commit
Hold shift + click to select a range
0c63288
feat(nodejs): bundling with webpack
serkan-ozal a6a8aa7
feat(nodejs): load instrumentation packages dynamic
serkan-ozal c1ed495
feat(nodejs): load metric and log providers dynamic
serkan-ozal f6c4b35
feat(nodejs): merge with main branch and update dependency versions
serkan-ozal 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
Large diffs are not rendered by default.
Oops, something went wrong.
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 |
---|---|---|
@@ -0,0 +1,25 @@ | ||
#!/bin/bash | ||
|
||
set -euf -o pipefail | ||
|
||
rm -rf ./build/workspace/node_modules | ||
|
||
# Space separated list of external NPM packages | ||
EXTERNAL_PACKAGES=( "import-in-the-middle" ) | ||
|
||
for EXTERNAL_PACKAGE in "${EXTERNAL_PACKAGES[@]}" | ||
do | ||
echo "Installing external package $EXTERNAL_PACKAGE ..." | ||
|
||
PACKAGE_VERSION=$(npm query "#$EXTERNAL_PACKAGE" \ | ||
| grep version \ | ||
| head -1 \ | ||
| awk -F: '{ print $2 }' \ | ||
| sed 's/[",]//g') | ||
|
||
echo "Resolved version of the external package $EXTERNAL_PACKAGE: $PACKAGE_VERSION" | ||
|
||
npm install "$EXTERNAL_PACKAGE@$PACKAGE_VERSION" --prefix ./build/workspace --production --ignore-scripts | ||
|
||
echo "Installed external package $EXTERNAL_PACKAGE" | ||
done |
Large diffs are not rendered by default.
Oops, something went wrong.
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 |
---|---|---|
@@ -0,0 +1,9 @@ | ||
const WRAPPER_INIT_START_TIME = Date.now(); | ||
const { default: wrapper } = await import('./wrapper.js'); | ||
await wrapper.init(); | ||
await wrapper.wrap(); | ||
console.log('OpenTelemetry wrapper init completed in', Date.now() - WRAPPER_INIT_START_TIME, 'ms'); | ||
|
||
const LOADER_INIT_START_TIME = Date.now(); | ||
await import('./loader.mjs'); | ||
console.log('OpenTelemetry loader init completed in', Date.now() - LOADER_INIT_START_TIME, 'ms'); |
Oops, something went wrong.
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.
js newbie here :)
Instead of having this separated script file with a list of external dependencies, would it work if we had a separated node package with package.json where you define all the dependencies. This would be a "noop package", but it would allow you to explicitly select what version of the external dependencies you want to use. and then you install it with just
npm install --prefix ./build/workspace --production --ignore-scripts
.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.
The reason why I have used bash script to install external packages is that I want to use the same version of
import-in-the-middle
coming from OTEL packages. So, I have to resolve its version dynamically. That is why I first resolve its version by npm query below and then install it with that specific version.