File tree Expand file tree Collapse file tree
integration/misc/logger_spans Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -17,6 +17,8 @@ exports.agentUuid = undefined;
1717// @ts -ignore - Cannot redeclare exported variable
1818exports . autoProfile = false ;
1919
20+ exports . disableCollectorInitEvent = true ;
21+
2022/** @type {import('@instana/collector/src/types/collector').AgentConfig } config */
2123exports . config = { } ;
2224
@@ -34,4 +36,6 @@ exports.init = function init(config) {
3436 exports . autoProfile = config . autoProfile ;
3537
3638 exports . requestTimeout = config . agentRequestTimeout ;
39+
40+ exports . disableCollectorInitEvent = config . disableCollectorInitEvent ;
3741} ;
Original file line number Diff line number Diff line change @@ -156,8 +156,13 @@ function enter(_ctx) {
156156 if ( ! isMainThread ) {
157157 const { parentPort } = require ( 'worker_threads' ) ;
158158
159- if ( parentPort ) {
160- // CASE: This is for the worker thread if available.
159+ /**
160+ * Sending 'instana.collector.initialized' event is disabled by default.
161+ * This prevents interference with application-level communication channels.
162+ * The event is primarily used for testing purposes now.
163+ */
164+
165+ if ( parentPort && agentOpts . disableCollectorInitEvent === false ) {
161166 parentPort . postMessage ( 'instana.collector.initialized' ) ;
162167 }
163168 }
Original file line number Diff line number Diff line change @@ -33,4 +33,5 @@ export interface CollectorConfig {
3333 reportUnhandledPromiseRejections ?: boolean ;
3434 logger ?: GenericLogger ;
3535 level ?: string | number ;
36+ disableCollectorInitEvent ?: boolean ;
3637}
Original file line number Diff line number Diff line change @@ -11,7 +11,8 @@ const defaults = {
1111 agentHost : '127.0.0.1' ,
1212 agentPort : 42699 ,
1313 agentRequestTimeout : 5000 ,
14- autoProfile : false
14+ autoProfile : false ,
15+ disableCollectorInitEvent : true
1516} ;
1617
1718/**
@@ -33,6 +34,11 @@ module.exports = function normalizeConfig(config = {}) {
3334 config . reportUnhandledPromiseRejections = false ;
3435 }
3536
37+ if ( config . disableCollectorInitEvent == null ) {
38+ const envValue = process . env . INSTANA_DISABLE_COLLECTOR_INIT_EVENT ;
39+ config . disableCollectorInitEvent = envValue === 'true' ? true : defaults . disableCollectorInitEvent ;
40+ }
41+
3642 return config ;
3743} ;
3844
Original file line number Diff line number Diff line change @@ -11,7 +11,8 @@ const { workerData } = require('worker_threads');
1111console . log ( 'Worker thread: Starting' , workerData ) ;
1212
1313const instana = require ( '@instana/collector' ) ( {
14- agentPort : workerData . agentPort
14+ agentPort : workerData . agentPort ,
15+ disableCollectorInitEvent : false
1516} ) ;
1617
1718( async ( ) => {
Original file line number Diff line number Diff line change @@ -164,6 +164,10 @@ class ProcessControls {
164164 opts . env
165165 ) ;
166166
167+ if ( ! this . env . INSTANA_DISABLE_COLLECTOR_INIT_EVENT ) {
168+ this . env . INSTANA_DISABLE_COLLECTOR_INIT_EVENT = 'false' ;
169+ }
170+
167171 if ( this . usePreInit ) {
168172 this . env . INSTANA_EARLY_INSTRUMENTATION = 'true' ;
169173 }
You can’t perform that action at this time.
0 commit comments