-
Notifications
You must be signed in to change notification settings - Fork 200
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: do not run nodejs agent for unsupported node runtimes (#1528)
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
- Loading branch information
Showing
6 changed files
with
1,022 additions
and
22 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
node_modules |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
try { | ||
const [major] = process.versions.node.split('.').map(Number); | ||
if (major < 14) { | ||
console.error('Odigos: Unsupported Node.js version for OpenTelemetry auto-instrumentation'); | ||
} else { | ||
require('@odigos/opentelemetry-node') | ||
} | ||
} catch (e) { | ||
console.error('Odigos: Failed to load OpenTelemetry auto-instrumentation', e); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
{ | ||
"name": "@odigos/opentelemetry-node-native-community", | ||
"version": "0.0.1", | ||
"main": "index.js", | ||
"dependencies": { | ||
"@odigos/opentelemetry-node": "file:../../../opentelemetry-node" | ||
} | ||
} |
Oops, something went wrong.