avoid instrumenting some Node.js apps when NODE_OPTIONS=-r elastic-apm-node/start
is being used
#3820
Labels
agent-nodejs
Make available for APM Agents project planning.
When
NODE_OPTIONS=-r elastic-apm-node/start
is being used, e.g. in Kubernetes via the apm-k8s-attacher.git Helm chart, the APM agent will be instrumenting every Node.js app in the k8s Pod. That might be casting too wide of a net.For example, I was testing apm-k8s-attacher on a k8s service with a Node.js app that started with
npm start
. The result was that firstnpm
itself was instrumented (before it found the "start" script in "package.json" and executednode app.js
):There isn't great harm in this case, but it will mean some requests (and possible tracing data) sent to APM server. And it results in some log spam that might confuse.
The Java APM agent has something similar: https://github.com/elastic/apm-agent-java/blob/main/elastic-apm-agent-premain/src/main/java/co/elastic/apm/agent/premain/ExcludeJvmBootstrapCheck.java#L32
ELASTIC_APM_BOOTSTRAP_ALLOWLIST
andELASTIC_APM_BOOTSTRAP_EXCLUDE_LIST
config vars for controlling this. IIUC they don't have a default value. I'm not sure if we'd want to make some attempt to excludenpm
itself by default.I think this is low priority. Just noting it now while I noticed it.
The text was updated successfully, but these errors were encountered: