Skip to content

Commit a808ba2

Browse files
committed
chore: only parse INSTANA_TRACING_DISABLE as boolean when value is boolean
Fixed normalizeTracingEnabled to only use INSTANA_TRACING_DISABLE for the tracing.enabled config when the env var value is 'true' or 'false'. When it contains instrumentation/group names (e.g., 'logging'), it's now handled by the separate disable normalizer
1 parent 0b71784 commit a808ba2

2 files changed

Lines changed: 8 additions & 3 deletions

File tree

packages/core/src/config/configNormalizers/disable.js

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -31,12 +31,10 @@ exports.normalize = function normalize(config) {
3131

3232
if (envDisableConfig !== null) {
3333
if (envDisableConfig === true) {
34-
logger?.debug('[config] env:INSTANA_TRACING_DISABLE = true');
3534
return true;
3635
}
3736

3837
if (envDisableConfig === false) {
39-
logger?.debug('[config] env:INSTANA_TRACING_DISABLE = false (overrides in-code config)');
4038
return {};
4139
}
4240

packages/core/src/config/index.js

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -251,8 +251,15 @@ function normalizeTracingConfig({ userConfig = {}, defaultConfig = {}, finalConf
251251
* @param {{ userConfig?: InstanaConfig|null, defaultConfig?: InstanaConfig, finalConfig?: InstanaConfig }} [options]
252252
*/
253253
function normalizeTracingEnabled({ userConfig = {}, defaultConfig = {}, finalConfig = {} } = {}) {
254+
// INSTANA_TRACING_DISABLE can be either:
255+
// 1. A boolean ('true'/'false') to enable/disable all tracing
256+
// 2. A list of instrumentations/groups to selectively disable
257+
// We only use it for tracing.enabled if it's a boolean value
258+
const envValue = process.env.INSTANA_TRACING_DISABLE;
259+
const isBooleanValue = envValue === 'true' || envValue === 'false';
260+
254261
finalConfig.tracing.enabled = util.resolveBooleanConfigWithInvertedEnv({
255-
envVar: 'INSTANA_TRACING_DISABLE',
262+
envVar: isBooleanValue ? 'INSTANA_TRACING_DISABLE' : undefined,
256263
configValue: userConfig.tracing.enabled,
257264
defaultValue: defaultConfig.tracing.enabled,
258265
configPath: 'config.tracing.enabled'

0 commit comments

Comments
 (0)