-
Notifications
You must be signed in to change notification settings - Fork 575
Description
Component(s)
node, instrumentation-winston
Describe the issue you're reporting
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.