-
Notifications
You must be signed in to change notification settings - Fork 821
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
express instrumentation is not applied after webpack compilation #3785
Comments
instrumentations for modules like express depend on Clearly this breaks one of the main goals of bundlers to get a single file so one has to decide what is more important monitoring or bundling. |
Hi @Flarna ,
I am wondering how other people use opentelemery with express in the production environment if using typescript. |
I would assume they use it without bundler or with a bundler configured to not include express. |
Hm...the interesting thing is when I excluded express and running the application it did not start because of error
|
see here: NOTE: Bundling (with e.g. webpack, rollup, esbuild, ...) is not supported by this package. Please use @opentelemetry/exporter-trace-otlp-proto instead. |
I do not use |
should be fixed by #3739 |
Thank you @Flarna for your suggestions. I managed to make it work by compiling typescript to javascript and I had to throw out webpack. As a side note: with the newer approach I need to install the dependencies and keep node_modules, therefore my docker image size now is ~500Mb, and the previous version - ~60Mb. |
Thanks for the update! |
What happened?
Steps to Reproduce
Hi there. Thank you for the awesome software.
I am trying to integrate the opentelemetry into the express application.
It has only 2 files: index.ts and tracer.ts.
When I run the applications using ts-node by script
nodemon --exec ts-node -r dotenv/config -r ./src/tracer.ts ./src/index.ts
all works perfectly, I see that express-instumentation library is injected and doing the job, I see traces in debug mode, middleware spans, etc.
I want to webpack the application using webpack.config.js
It generates 2 files: index.js and tracer.js
Then I am running this as node (Node.js v18.12.1) process
node -r "./tracer.js" index.js
the express-instrumentation is not applied - I do not see any spans, etc.There is no
Applying patch for [email protected]:load:flatten Completed in 3ms
in that case as it was in the example above.In index.js I see express-instumentation is included.
Could you please help me with this?
Expected Result
express instrumentation is working
Actual Result
express instrumentation is not working
Additional Details
OpenTelemetry Setup Code
package.json
Relevant log output
my tsconfig.json
No response
The text was updated successfully, but these errors were encountered: