feat: do not run nodejs agent for unsupported node runtimes #1528
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
At the moment, nodejs agent will import all it's dependencies when it starts. Those might pull in code that is not compatible with old node runtimes, and cause an exception in agent code.
This PR makes it so that the agent is only loaded if the nodejs version is supported, and silently catch and ignore any exception from the agent.
This PR extract the compiling of the nodejs agent to a separate docker build stage, a bit simplifying the dockerfile
If the nodejs runtime version was detected in language detection, the instrumentation device should not even be injected and the agent should not be loaded. However, if the runtime details is not detected, or some other situation causes the agent to run on an old node runtime, the agent should handle it and not cause any issues for application