Skip to content

Commit c6ed877

Browse files
committed
refactor to use directly register from metapackage and simplify deps
Signed-off-by: matteo.gazzetta <[email protected]>
1 parent 04677de commit c6ed877

File tree

11 files changed

+13
-100
lines changed

11 files changed

+13
-100
lines changed

autoinstrumentation/nodejs/package.json

+2-5
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,6 @@
44
"private": true,
55
"scripts": {
66
"clean": "rimraf build/*",
7-
"prepare": "npm run compile",
8-
"compile": "tsc -p .",
97
"postcompile": "copyfiles -f 'build/src/**' build/workspace/ && copyfiles 'node_modules/**' package.json build/workspace/ && npm -C build/workspace prune --omit=dev --no-package-lock"
108
},
119
"devDependencies": {
@@ -14,8 +12,7 @@
1412
"typescript": "^5.6.3"
1513
},
1614
"dependencies": {
17-
"@opentelemetry/exporter-metrics-otlp-grpc": "0.57.0",
18-
"@opentelemetry/auto-instrumentations-node": "0.55.0",
19-
"@opentelemetry/exporter-prometheus": "0.57.0"
15+
"@opentelemetry/api": "1.9.0",
16+
"@opentelemetry/auto-instrumentations-node": "0.55.2"
2017
}
2118
}

autoinstrumentation/nodejs/src/autoinstrumentation.ts

-84
This file was deleted.

pkg/instrumentation/nodejs.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ import (
2222

2323
const (
2424
envNodeOptions = "NODE_OPTIONS"
25-
nodeRequireArgument = " --require /otel-auto-instrumentation-nodejs/autoinstrumentation.js"
25+
nodeRequireArgument = " --require /otel-auto-instrumentation-nodejs/node_modules/@opentelemetry/auto-instrumentations-node/build/src/register.js"
2626
nodejsInitContainerName = initContainerName + "-nodejs"
2727
nodejsVolumeName = volumeName + "-nodejs"
2828
nodejsInstrMountPath = "/otel-auto-instrumentation-nodejs"

pkg/instrumentation/nodejs_test.go

+2-2
Original file line numberDiff line numberDiff line change
@@ -76,7 +76,7 @@ func TestInjectNodeJSSDK(t *testing.T) {
7676
Env: []corev1.EnvVar{
7777
{
7878
Name: "NODE_OPTIONS",
79-
Value: " --require /otel-auto-instrumentation-nodejs/autoinstrumentation.js",
79+
Value: " --require /otel-auto-instrumentation-nodejs/node_modules/@opentelemetry/auto-instrumentations-node/build/src/register.js",
8080
},
8181
},
8282
},
@@ -137,7 +137,7 @@ func TestInjectNodeJSSDK(t *testing.T) {
137137
Env: []corev1.EnvVar{
138138
{
139139
Name: "NODE_OPTIONS",
140-
Value: "-Dbaz=bar" + " --require /otel-auto-instrumentation-nodejs/autoinstrumentation.js",
140+
Value: "-Dbaz=bar" + " --require /otel-auto-instrumentation-nodejs/node_modules/@opentelemetry/auto-instrumentations-node/build/src/register.js",
141141
},
142142
},
143143
},

tests/e2e-instrumentation/instrumentation-nodejs-multicontainer/01-assert.yaml

+2-2
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ spec:
2121
- name: NODE_PATH
2222
value: /usr/local/lib/node_modules
2323
- name: NODE_OPTIONS
24-
value: ' --require /otel-auto-instrumentation-nodejs/autoinstrumentation.js'
24+
value: ' --require /otel-auto-instrumentation-nodejs/node_modules/@opentelemetry/auto-instrumentations-node/build/src/register.js'
2525
- name: OTEL_TRACES_EXPORTER
2626
value: otlp
2727
- name: OTEL_EXPORTER_OTLP_ENDPOINT
@@ -65,7 +65,7 @@ spec:
6565
fieldRef:
6666
fieldPath: status.podIP
6767
- name: NODE_OPTIONS
68-
value: ' --require /otel-auto-instrumentation-nodejs/autoinstrumentation.js'
68+
value: ' --require /otel-auto-instrumentation-nodejs/node_modules/@opentelemetry/auto-instrumentations-node/build/src/register.js'
6969
- name: OTEL_TRACES_EXPORTER
7070
value: otlp
7171
- name: OTEL_EXPORTER_OTLP_ENDPOINT

tests/e2e-instrumentation/instrumentation-nodejs-multicontainer/02-assert.yaml

+1-1
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ spec:
3232
- name: NODE_PATH
3333
value: /usr/local/lib/node_modules
3434
- name: NODE_OPTIONS
35-
value: ' --require /otel-auto-instrumentation-nodejs/autoinstrumentation.js'
35+
value: ' --require /otel-auto-instrumentation-nodejs/node_modules/@opentelemetry/auto-instrumentations-node/build/src/register.js'
3636
- name: OTEL_TRACES_EXPORTER
3737
value: otlp
3838
- name: OTEL_EXPORTER_OTLP_ENDPOINT

tests/e2e-instrumentation/instrumentation-nodejs-volume/01-assert.yaml

+1-1
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ spec:
2222
- name: OTEL_NODEJS_DEBUG
2323
value: "true"
2424
- name: NODE_OPTIONS
25-
value: " --require /otel-auto-instrumentation-nodejs/autoinstrumentation.js"
25+
value: " --require /otel-auto-instrumentation-nodejs/node_modules/@opentelemetry/auto-instrumentations-node/build/src/register.js"
2626
- name: OTEL_TRACES_EXPORTER
2727
value: otlp
2828
- name: OTEL_EXPORTER_OTLP_ENDPOINT

tests/e2e-instrumentation/instrumentation-nodejs/01-assert.yaml

+1-1
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ spec:
2222
- name: OTEL_NODEJS_DEBUG
2323
value: "true"
2424
- name: NODE_OPTIONS
25-
value: ' --require /otel-auto-instrumentation-nodejs/autoinstrumentation.js'
25+
value: ' --require /otel-auto-instrumentation-nodejs/node_modules/@opentelemetry/auto-instrumentations-node/build/src/register.js'
2626
- name: OTEL_TRACES_EXPORTER
2727
value: otlp
2828
- name: OTEL_EXPORTER_OTLP_ENDPOINT

tests/e2e-multi-instrumentation/instrumentation-multi-multicontainer/01-assert.yaml

+1-1
Original file line numberDiff line numberDiff line change
@@ -131,7 +131,7 @@ spec:
131131
- name: OTEL_SERVICE_NAME
132132
value: nodejsapp
133133
- name: NODE_OPTIONS
134-
value: ' --require /otel-auto-instrumentation-nodejs/autoinstrumentation.js'
134+
value: ' --require /otel-auto-instrumentation-nodejs/node_modules/@opentelemetry/auto-instrumentations-node/build/src/register.js'
135135
- name: OTEL_TRACES_SAMPLER
136136
value: parentbased_traceidratio
137137
- name: OTEL_TRACES_SAMPLER_ARG

tests/e2e-multi-instrumentation/instrumentation-single-instr-first-container/01-assert.yaml

+1-1
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ spec:
2222
- name: OTEL_SERVICE_NAME
2323
value: nodejsapp
2424
- name: NODE_OPTIONS
25-
value: ' --require /otel-auto-instrumentation-nodejs/autoinstrumentation.js'
25+
value: ' --require /otel-auto-instrumentation-nodejs/node_modules/@opentelemetry/auto-instrumentations-node/build/src/register.js'
2626
- name: OTEL_TRACES_SAMPLER
2727
value: parentbased_traceidratio
2828
- name: OTEL_TRACES_SAMPLER_ARG

tests/e2e-openshift/must-gather/assert-install-app.yaml

+1-1
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ spec:
2222
- name: OTEL_NODEJS_DEBUG
2323
value: "true"
2424
- name: NODE_OPTIONS
25-
value: ' --require /otel-auto-instrumentation-nodejs/autoinstrumentation.js'
25+
value: ' --require /otel-auto-instrumentation-nodejs/node_modules/@opentelemetry/auto-instrumentations-node/build/src/register.js'
2626
- name: OTEL_TRACES_EXPORTER
2727
value: otlp
2828
- name: OTEL_EXPORTER_OTLP_ENDPOINT

0 commit comments

Comments
 (0)