Skip to content

Commit bdf662f

Browse files
committed
test: only set INSTANA_TRACING_DISABLE when tracing is actually disabled
ProcessControls was setting INSTANA_TRACING_DISABLE=false for all tests where tracingEnabled=true (the default). According to the precedence rules in disable.js, when INSTANA_TRACING_DISABLE is set to 'false', it takes precedence over INSTANA_TRACING_DISABLE_INSTRUMENTATIONS and INSTANA_TRACING_DISABLE_GROUPS, preventing granular disable configurations from working in tests. This caused logging integration tests to fail when trying to disable specific instrumentations using INSTANA_TRACING_DISABLE_INSTRUMENTATIONS or INSTANA_TRACING_DISABLE_GROUPS. Changed ProcessControls to only set INSTANA_TRACING_DISABLE='true' when tracingEnabled=false, and not set it at all when tracingEnabled=true, allowing other disable environment variables to work correctly.
1 parent 7059a40 commit bdf662f

1 file changed

Lines changed: 7 additions & 1 deletion

File tree

packages/collector/test/test_util/ProcessControls.js

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -151,7 +151,6 @@ class ProcessControls {
151151
APP_CWD: this.cwd,
152152
INSTANA_AGENT_PORT: agentPort,
153153
INSTANA_LOG_LEVEL: 'warn',
154-
INSTANA_TRACING_DISABLE: !this.tracingEnabled,
155154
INSTANA_FORCE_TRANSMISSION_STARTING_AT: '1',
156155
INSTANA_FULL_METRICS_INTERNAL_IN_S: 1,
157156
INSTANA_FIRE_MONITORING_EVENT_DURATION_IN_MS: 500,
@@ -164,6 +163,13 @@ class ProcessControls {
164163
opts.env
165164
);
166165

166+
// Only set INSTANA_TRACING_DISABLE when tracing is actually disabled to avoid
167+
// overriding other disable environment variables (INSTANA_TRACING_DISABLE_INSTRUMENTATIONS, etc.)
168+
// See packages/core/src/config/configNormalizers/disable.js for precedence rules
169+
if (!this.tracingEnabled) {
170+
this.env.INSTANA_TRACING_DISABLE = 'true';
171+
}
172+
167173
if (this.usePreInit) {
168174
this.env.INSTANA_EARLY_INSTRUMENTATION = 'true';
169175
}

0 commit comments

Comments
 (0)