@@ -9,7 +9,7 @@ const log = require('../../../dd-trace/src/log')
9
9
const checkRequireCache = require ( './check-require-cache' )
10
10
const telemetry = require ( '../../../dd-trace/src/guardrails/telemetry' )
11
11
const { isInServerlessEnvironment } = require ( '../../../dd-trace/src/serverless' )
12
- const { isFalse, isTrue , normalizePluginEnvName } = require ( '../../../dd-trace/src/util' )
12
+ const { isFalse } = require ( '../../../dd-trace/src/util' )
13
13
const { getEnvironmentVariables } = require ( '../../../dd-trace/src/config-helper' )
14
14
15
15
const envs = getEnvironmentVariables ( )
@@ -25,20 +25,15 @@ const names = Object.keys(hooks)
25
25
const pathSepExpr = new RegExp ( `\\${ path . sep } ` , 'g' )
26
26
27
27
const disabledInstrumentations = new Set (
28
- DD_TRACE_DISABLED_INSTRUMENTATIONS ?. split ( ',' ) . map ( name => normalizePluginEnvName ( name , true ) ) ?? [ ]
28
+ DD_TRACE_DISABLED_INSTRUMENTATIONS ?. split ( ',' ) ?? [ ]
29
29
)
30
- const reenabledInstrumentations = new Set ( )
31
30
32
31
// Check for DD_TRACE_<INTEGRATION>_ENABLED environment variables
33
32
for ( const [ key , value ] of Object . entries ( envs ) ) {
34
33
const match = key . match ( / ^ D D _ T R A C E _ ( .+ ) _ E N A B L E D $ / )
35
- if ( match && value ) {
36
- const integration = normalizePluginEnvName ( match [ 1 ] , true )
37
- if ( isFalse ( value ) ) {
38
- disabledInstrumentations . add ( integration )
39
- } else if ( isTrue ( value ) ) {
40
- reenabledInstrumentations . add ( integration )
41
- }
34
+ if ( match && isFalse ( value ) ) {
35
+ const integration = match [ 1 ] . toLowerCase ( )
36
+ disabledInstrumentations . add ( integration )
42
37
}
43
38
}
44
39
@@ -65,8 +60,7 @@ const allInstrumentations = {}
65
60
66
61
// TODO: make this more efficient
67
62
for ( const packageName of names ) {
68
- const normalizedPackageName = normalizePluginEnvName ( packageName , true )
69
- if ( disabledInstrumentations . has ( normalizedPackageName ) ) continue
63
+ if ( disabledInstrumentations . has ( packageName ) ) continue
70
64
71
65
const hookOptions = { }
72
66
@@ -75,10 +69,6 @@ for (const packageName of names) {
75
69
if ( hook !== null && typeof hook === 'object' ) {
76
70
if ( hook . serverless === false && isInServerlessEnvironment ( ) ) continue
77
71
78
- // some integrations are disabled by default, but can be enabled by setting
79
- // the DD_TRACE_<INTEGRATION>_ENABLED environment variable to true
80
- if ( hook . disabled && ! reenabledInstrumentations . has ( normalizedPackageName ) ) continue
81
-
82
72
hookOptions . internals = hook . esmFirst
83
73
hook = hook . fn
84
74
}
0 commit comments