Skip to content
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

Add documentation for instrumentation-winston lookup path #3653

Open
hien-prio opened this issue Jan 23, 2025 · 0 comments
Open

Add documentation for instrumentation-winston lookup path #3653

hien-prio opened this issue Jan 23, 2025 · 0 comments

Comments

@hien-prio
Copy link

hien-prio commented Jan 23, 2025

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant