You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I'm using the opentelemetry-operator in k8s to auto-instrument and found that instrumentation-winston was running but it couldn't load @opentelemetry/winston-transport even though it was added to the app's package.json.
The issue is the operator mounts the auto-instrumentation packages at /otel-auto-instrumentation-nodejs/autoinstrumentation.js so the Node module lookup order means it only looks upwards for node_modules until /.
If you've built your Dockerfile following a typical tutorial then your package.json is installing into /home/node/app/node_modules which won't be on the search path during the require call. This can be fixed by adding the env-var:
NODE_PATH=/home/node/app/node_modules
which can also be done in the Instrumentation resource that's injecting into containers. Suggest adding this somewhere in documentation.
The text was updated successfully, but these errors were encountered:
Component(s)
node
,instrumentation-winston
Describe the issue you're reporting
I'm using the
opentelemetry-operator
in k8s to auto-instrument and found thatinstrumentation-winston
was running but it couldn't load@opentelemetry/winston-transport
even though it was added to the app's package.json.The issue is the operator mounts the auto-instrumentation packages at
/otel-auto-instrumentation-nodejs/autoinstrumentation.js
so the Node module lookup order means it only looks upwards fornode_modules
until/
.If you've built your Dockerfile following a typical tutorial then your
package.json
is installing into/home/node/app/node_modules
which won't be on the search path during therequire
call. This can be fixed by adding the env-var:which can also be done in the
Instrumentation
resource that's injecting into containers. Suggest adding this somewhere in documentation.The text was updated successfully, but these errors were encountered: