From c127e22f851fd774e16414366b6a96bf2f34a230 Mon Sep 17 00:00:00 2001 From: Juan Fernandez Date: Wed, 15 Jan 2025 17:40:13 +0100 Subject: [PATCH] so let's see now --- .../dynamic-instrumentation/index.js | 23 +++++++------------ 1 file changed, 8 insertions(+), 15 deletions(-) diff --git a/packages/dd-trace/src/ci-visibility/dynamic-instrumentation/index.js b/packages/dd-trace/src/ci-visibility/dynamic-instrumentation/index.js index 306f8a3dbbb..9ffe1f11c3e 100644 --- a/packages/dd-trace/src/ci-visibility/dynamic-instrumentation/index.js +++ b/packages/dd-trace/src/ci-visibility/dynamic-instrumentation/index.js @@ -1,5 +1,6 @@ 'use strict' +const { join } = require('path') const { Worker, threadId: parentThreadId } = require('worker_threads') const { randomUUID } = require('crypto') const log = require('../../log') @@ -54,25 +55,21 @@ class TestVisDynamicInstrumentation { start (config) { if (this.worker) return - const { NODE_OPTIONS, ...envWithoutNodeOptions } = process.env - - // Remove initialization of dd-trace but keep other NODE_OPTIONS - const DD_TRACE_CI_INIT_REGEX = /-r [^\s]*?dd-trace\/ci\/init\b/ - envWithoutNodeOptions.NODE_OPTIONS = NODE_OPTIONS.replace(DD_TRACE_CI_INIT_REGEX, '') - - console.log('original node_options', NODE_OPTIONS) - console.log('changes node_options', envWithoutNodeOptions.NODE_OPTIONS) - + console.log('TestVisDynamicInstrumentation#start') log.debug('Starting Test Visibility - Dynamic Instrumentation client...') const rcChannel = new MessageChannel() // mock channel const configChannel = new MessageChannel() // mock channel this.worker = new Worker( - require.resolve('./worker/index.js'), + join(__dirname, 'worker', 'index.js'), { execArgv: [], - env: envWithoutNodeOptions, + env: { + ...process.env, + DD_TRACE_ENABLED: 0, + DD_TEST_DYNAMIC_INSTRUMENTATION_ENABLED: 0 + }, workerData: { config: config.serialize(), parentThreadId, @@ -102,10 +99,6 @@ class TestVisDynamicInstrumentation { log.error('Test Visibility - Dynamic Instrumentation worker messageerror', err) }) - this.worker.on('message', (message) => { - console.log('from worker:', message) - }) - // Allow the parent to exit even if the worker is still running this.worker.unref()