Skip to content

Commit

Permalink
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
refactor to use directly register from metapackage
Browse files Browse the repository at this point in the history
Signed-off-by: matteo.gazzetta <matteo.gazzetta@bitrock.it>
ElfoLiNk committed Jan 14, 2025
1 parent 04677de commit 8726e9e
Showing 11 changed files with 11 additions and 97 deletions.
2 changes: 0 additions & 2 deletions autoinstrumentation/nodejs/package.json
Original file line number Diff line number Diff line change
@@ -4,8 +4,6 @@
"private": true,
"scripts": {
"clean": "rimraf build/*",
"prepare": "npm run compile",
"compile": "tsc -p .",
"postcompile": "copyfiles -f 'build/src/**' build/workspace/ && copyfiles 'node_modules/**' package.json build/workspace/ && npm -C build/workspace prune --omit=dev --no-package-lock"
},
"devDependencies": {
84 changes: 0 additions & 84 deletions autoinstrumentation/nodejs/src/autoinstrumentation.ts

This file was deleted.

2 changes: 1 addition & 1 deletion pkg/instrumentation/nodejs.go
Original file line number Diff line number Diff line change
@@ -22,7 +22,7 @@ import (

const (
envNodeOptions = "NODE_OPTIONS"
nodeRequireArgument = " --require /otel-auto-instrumentation-nodejs/autoinstrumentation.js"
nodeRequireArgument = " --require /otel-auto-instrumentation-nodejs/node_modules/@opentelemetry/auto-instrumentations-node/build/src/register.js"
nodejsInitContainerName = initContainerName + "-nodejs"
nodejsVolumeName = volumeName + "-nodejs"
nodejsInstrMountPath = "/otel-auto-instrumentation-nodejs"
4 changes: 2 additions & 2 deletions pkg/instrumentation/nodejs_test.go
Original file line number Diff line number Diff line change
@@ -76,7 +76,7 @@ func TestInjectNodeJSSDK(t *testing.T) {
Env: []corev1.EnvVar{
{
Name: "NODE_OPTIONS",
Value: " --require /otel-auto-instrumentation-nodejs/autoinstrumentation.js",
Value: " --require /otel-auto-instrumentation-nodejs/node_modules/@opentelemetry/auto-instrumentations-node/build/src/register.js",
},
},
},
@@ -137,7 +137,7 @@ func TestInjectNodeJSSDK(t *testing.T) {
Env: []corev1.EnvVar{
{
Name: "NODE_OPTIONS",
Value: "-Dbaz=bar" + " --require /otel-auto-instrumentation-nodejs/autoinstrumentation.js",
Value: "-Dbaz=bar" + " --require /otel-auto-instrumentation-nodejs/node_modules/@opentelemetry/auto-instrumentations-node/build/src/register.js"",
},
},
},
Original file line number Diff line number Diff line change
@@ -21,7 +21,7 @@ spec:
- name: NODE_PATH
value: /usr/local/lib/node_modules
- name: NODE_OPTIONS
value: ' --require /otel-auto-instrumentation-nodejs/autoinstrumentation.js'
value: ' --require /otel-auto-instrumentation-nodejs/node_modules/@opentelemetry/auto-instrumentations-node/build/src/register.js'
- name: OTEL_TRACES_EXPORTER
value: otlp
- name: OTEL_EXPORTER_OTLP_ENDPOINT
@@ -65,7 +65,7 @@ spec:
fieldRef:
fieldPath: status.podIP
- name: NODE_OPTIONS
value: ' --require /otel-auto-instrumentation-nodejs/autoinstrumentation.js'
value: ' --require /otel-auto-instrumentation-nodejs/node_modules/@opentelemetry/auto-instrumentations-node/build/src/register.js'
- name: OTEL_TRACES_EXPORTER
value: otlp
- name: OTEL_EXPORTER_OTLP_ENDPOINT
Original file line number Diff line number Diff line change
@@ -32,7 +32,7 @@ spec:
- name: NODE_PATH
value: /usr/local/lib/node_modules
- name: NODE_OPTIONS
value: ' --require /otel-auto-instrumentation-nodejs/autoinstrumentation.js'
value: ' --require /otel-auto-instrumentation-nodejs/node_modules/@opentelemetry/auto-instrumentations-node/build/src/register.js'
- name: OTEL_TRACES_EXPORTER
value: otlp
- name: OTEL_EXPORTER_OTLP_ENDPOINT
Original file line number Diff line number Diff line change
@@ -22,7 +22,7 @@ spec:
- name: OTEL_NODEJS_DEBUG
value: "true"
- name: NODE_OPTIONS
value: " --require /otel-auto-instrumentation-nodejs/autoinstrumentation.js"
value: " --require /otel-auto-instrumentation-nodejs/node_modules/@opentelemetry/auto-instrumentations-node/build/src/register.js"
- name: OTEL_TRACES_EXPORTER
value: otlp
- name: OTEL_EXPORTER_OTLP_ENDPOINT
Original file line number Diff line number Diff line change
@@ -22,7 +22,7 @@ spec:
- name: OTEL_NODEJS_DEBUG
value: "true"
- name: NODE_OPTIONS
value: ' --require /otel-auto-instrumentation-nodejs/autoinstrumentation.js'
value: ' --require /otel-auto-instrumentation-nodejs/node_modules/@opentelemetry/auto-instrumentations-node/build/src/register.js'
- name: OTEL_TRACES_EXPORTER
value: otlp
- name: OTEL_EXPORTER_OTLP_ENDPOINT
Original file line number Diff line number Diff line change
@@ -131,7 +131,7 @@ spec:
- name: OTEL_SERVICE_NAME
value: nodejsapp
- name: NODE_OPTIONS
value: ' --require /otel-auto-instrumentation-nodejs/autoinstrumentation.js'
value: ' --require /otel-auto-instrumentation-nodejs/node_modules/@opentelemetry/auto-instrumentations-node/build/src/register.js'
- name: OTEL_TRACES_SAMPLER
value: parentbased_traceidratio
- name: OTEL_TRACES_SAMPLER_ARG
Original file line number Diff line number Diff line change
@@ -22,7 +22,7 @@ spec:
- name: OTEL_SERVICE_NAME
value: nodejsapp
- name: NODE_OPTIONS
value: ' --require /otel-auto-instrumentation-nodejs/autoinstrumentation.js'
value: ' --require /otel-auto-instrumentation-nodejs/node_modules/@opentelemetry/auto-instrumentations-node/build/src/register.js'
- name: OTEL_TRACES_SAMPLER
value: parentbased_traceidratio
- name: OTEL_TRACES_SAMPLER_ARG
2 changes: 1 addition & 1 deletion tests/e2e-openshift/must-gather/assert-install-app.yaml
Original file line number Diff line number Diff line change
@@ -22,7 +22,7 @@ spec:
- name: OTEL_NODEJS_DEBUG
value: "true"
- name: NODE_OPTIONS
value: ' --require /otel-auto-instrumentation-nodejs/autoinstrumentation.js'
value: ' --require /otel-auto-instrumentation-nodejs/node_modules/@opentelemetry/auto-instrumentations-node/build/src/register.js'
- name: OTEL_TRACES_EXPORTER
value: otlp
- name: OTEL_EXPORTER_OTLP_ENDPOINT

0 comments on commit 8726e9e

Please sign in to comment.