Repository navigation
docs(observability): say a commonjs build on nest 12 needs the loader hook too - #3681
Merged
Merged
Conversation
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.
PR Checklist
Please check if your PR fulfills the following requirements:
PR Type
What kind of change does this PR introduce?
What is the current behavior?
Issue Number: N/A
OpenTelemetry page says the loader flag is only needed for ES module build. On Nest 12 CommonJS build (
nest new --type cjs) still loads@nestjs/*as ES modules (@nestjs/platform-expressis"type": "module"and doesimport express from 'express'), and--requirehook only seesrequire(). So with CommonJS commands from the page Express is not patched, there are noinstrumentation-expressspans and HTTP span isPOSTinstead ofPOST /orders. Same with importinginstrumentation.tson first line ofmain.tsWhat is the new behavior?
Hint says CommonJS build on Nest 12 needs the loader flag as well, and the first-line import note says it is not enough for Express there. Checked on Nest 12.3.2 with auto-instrumentations-node 0.82.0 and sdk-node 0.300.0, Node 24: adding
--experimental-loader=@opentelemetry/instrumentation/hook.mjsto CommonJS command brings Express spans andPOST /ordersbackDoes this PR introduce a breaking change?