Search code examples
node.jsagentopen-telemetry

Node equivalent to "-javaagent" in Java


/bin/node -r /opt/otel/node/otel-agent.js /opt/service/dist/main.js

This is how I am running my application currently.

The problem is, sometimes otel-agent.js might not exist and I want to be able to define a 'Node' agent similar to how you can define various runtime arguments via the env variable

JAVA_TOOL_OPTIONS=javaagent:/opt/otel/java/aws-opentelemetry-agent.jar.

Does such a thing exist for Node?


Solution

  • NODE_OPTIONS=--require /opt/otel/otel-agent.js