Repository navigation
Conversation
🦋 Changeset detectedLatest commit: f3fb6f2 The changes in this PR will be included in the next version bump. This PR includes changesets to release 1 package
Not sure what this means? Click here to learn what changesets are. Click here if you're a maintainer who wants to add another changeset to this PR |
commit: |
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.
Fixes #418.
With
start: { node: true, instrument },dist/server/node.jsloadednode:httpbefore the instrument module ran, so OpenTelemetry's HTTP instrumentation never patched the server and no request got an HTTP server span.The runtime inlined into
node.jsstatically importsnode:http(plusnode:fs,node:streamand the rest). ESM links every static import before any module body runs. Sonode:httpwas loaded before./server.jscouldawait import(instrument), and the module hooks the instrument registers never saw it.When
instrumentis set,node.jsis now a wrapper with no static imports. It awaits./server.js(which runs the instrument, then the handler graph) and then imports the unchanged runtime from a new sibling file,node-runtime.js. Withoutinstrument,node.jsstays the same single self-contained file, apart from one new config field. The runtime's "listen when run as the program" check now comparesargv[1]againstSOLID_NODE_CONFIG.entry(node.js) instead of its own file name. Sonode dist/server/node.jsstill listens, and runningnode-runtime.jsdirectly does not start a server that skips the instrument. The README notes the extra file.Verification:
node test/run.mjs nodeinexamples/start-ssrpasses 89/89. The new sub-run builds withSTART_NODE=1 SSR_INSTRUMENT=1. It asserts thatnode.jshas no static imports, that it listens when run, that the instrument sawnode:httpunloaded (process.moduleLoadList), and that importing it exportscreateListener,listenerandservewithout listening. Againstorigin/next, two of those assertions fail (httpLoaded: true).node test/run.mjs middlewarepasses 99/99.NodeSDKand@opentelemetry/instrumentation-httploaded from the instrument chunk,node dist/server/node.jsrecorded no spans before the fix and one SERVER span per request after it.Open question:
node.jsnow has two layouts depending oninstrument. A single layout would also work: always emit the wrapper, or make the runtime loadnode:*lazily. I kept the change scoped to the option that needs it.🤖 Generated with Claude Code