Skip to content

Commit

Permalink
feat: do not run nodejs agent for unsupported node runtimes
Browse files Browse the repository at this point in the history
  • Loading branch information
blumamir committed Sep 20, 2024
1 parent fdd037b commit 5650d94
Show file tree
Hide file tree
Showing 6 changed files with 1,022 additions and 22 deletions.
2 changes: 1 addition & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ verify-nodejs-agent:

.PHONY: build-odiglet-with-agents
build-odiglet-with-agents:
docker build -t $(ORG)/odigos-odiglet:$(TAG) . -f odiglet/Dockerfile --build-arg ODIGOS_VERSION=$(TAG) --build-context nodejs-agent-native-community-src=../opentelemetry-node
docker build -t $(ORG)/odigos-odiglet:$(TAG) . -f odiglet/Dockerfile --build-arg ODIGOS_VERSION=$(TAG) --build-context nodejs-agent-src=../opentelemetry-node

.PHONY: build-autoscaler
build-autoscaler:
Expand Down
1 change: 1 addition & 0 deletions agents/nodejs-native-community/.dockerignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
node_modules
10 changes: 10 additions & 0 deletions agents/nodejs-native-community/autoinstrumentation.js
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);
}
8 changes: 8 additions & 0 deletions agents/nodejs-native-community/package.json
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"
}
}
Loading

0 comments on commit 5650d94

Please sign in to comment.