@@ -190,18 +190,18 @@ describe('utils', () => {
190190 ) ;
191191 } ) ;
192192
193- it ( 'should respect OTEL_NODE_ENABLED_INSTRUMENTATIONS - env var overrides user config ' , ( ) => {
193+ it ( 'should respect programmatic config over OTEL_NODE_ENABLED_INSTRUMENTATIONS - user config overrides env var ' , ( ) => {
194194 process . env . OTEL_NODE_ENABLED_INSTRUMENTATIONS = 'fs,http' ;
195195 try {
196196 const instrumentations = getNodeAutoInstrumentations ( {
197197 '@opentelemetry/instrumentation-fs' : {
198- enabled : false , // User tries to disable but env var overrides
198+ enabled : false , // User explicitly disables - should override env var
199199 } ,
200200 '@opentelemetry/instrumentation-express' : {
201- enabled : true , // User tries to enable but not in env var list
201+ enabled : true , // User explicitly enables - should override env var
202202 } ,
203203 } ) ;
204-
204+
205205 const fsInstrumentation = instrumentations . find (
206206 instr => instr . instrumentationName === '@opentelemetry/instrumentation-fs'
207207 ) ;
@@ -211,32 +211,32 @@ describe('utils', () => {
211211 const expressInstrumentation = instrumentations . find (
212212 instr => instr . instrumentationName === '@opentelemetry/instrumentation-express'
213213 ) ;
214-
215- assert . notStrictEqual ( fsInstrumentation , undefined , 'fs should be enabled by env var despite user config ' ) ;
216- assert . notStrictEqual ( httpInstrumentation , undefined , 'http should be enabled by env var' ) ;
217- assert . strictEqual ( expressInstrumentation , undefined , 'express should be disabled - not in env var list' ) ;
214+
215+ assert . strictEqual ( fsInstrumentation , undefined , 'fs should be disabled by user config despite env var ' ) ;
216+ assert . notStrictEqual ( httpInstrumentation , undefined , 'http should be enabled by env var (no user override) ' ) ;
217+ assert . notStrictEqual ( expressInstrumentation , undefined , 'express should be enabled by user config despite not being in env var list' ) ;
218218 } finally {
219219 delete process . env . OTEL_NODE_ENABLED_INSTRUMENTATIONS ;
220220 }
221221 } ) ;
222222
223- it ( 'should respect OTEL_NODE_DISABLED_INSTRUMENTATIONS with absolute priority ' , ( ) => {
223+ it ( 'should respect programmatic config over OTEL_NODE_DISABLED_INSTRUMENTATIONS - user config overrides env var ' , ( ) => {
224224 process . env . OTEL_NODE_DISABLED_INSTRUMENTATIONS = 'http' ;
225225 try {
226226 const instrumentations = getNodeAutoInstrumentations ( {
227227 '@opentelemetry/instrumentation-http' : {
228- enabled : true , // User tries to enable but env var disables
228+ enabled : true , // User explicitly enables - should override env var
229229 } ,
230230 } ) ;
231231 const httpInstrumentation = instrumentations . find (
232232 instr =>
233233 instr . instrumentationName === '@opentelemetry/instrumentation-http'
234234 ) ;
235-
236- assert . strictEqual (
235+
236+ assert . notStrictEqual (
237237 httpInstrumentation ,
238238 undefined ,
239- 'http instrumentation should be disabled by OTEL_NODE_DISABLED_INSTRUMENTATIONS even when user enables it '
239+ 'http instrumentation should be enabled by user config despite OTEL_NODE_DISABLED_INSTRUMENTATIONS '
240240 ) ;
241241 } finally {
242242 delete process . env . OTEL_NODE_DISABLED_INSTRUMENTATIONS ;
0 commit comments