File tree Expand file tree Collapse file tree 2 files changed +32
-10
lines changed
packages/auto-instrumentations-node Expand file tree Collapse file tree 2 files changed +32
-10
lines changed Original file line number Diff line number Diff line change @@ -158,12 +158,16 @@ function shouldDisableInstrumentation(
158158) : boolean {
159159 // Priority 1: Programmatic config
160160 if ( userConfig . enabled === false ) {
161- diag . debug ( `Disabling instrumentation for ${ name } - disabled by user config` ) ;
161+ diag . debug (
162+ `Disabling instrumentation for ${ name } - disabled by user config`
163+ ) ;
162164 return true ;
163165 }
164166
165167 if ( userConfig . enabled === true ) {
166- diag . debug ( `Enabling instrumentation for ${ name } - explicitly enabled by user config` ) ;
168+ diag . debug (
169+ `Enabling instrumentation for ${ name } - explicitly enabled by user config`
170+ ) ;
167171 return false ;
168172 }
169173
@@ -175,7 +179,9 @@ function shouldDisableInstrumentation(
175179
176180 const isEnabledEnvSet = ! ! process . env . OTEL_NODE_ENABLED_INSTRUMENTATIONS ;
177181 if ( isEnabledEnvSet && ! enabledInstrumentationsFromEnv . includes ( name ) ) {
178- diag . debug ( `Disabling instrumentation for ${ name } - not in enabled env var list` ) ;
182+ diag . debug (
183+ `Disabling instrumentation for ${ name } - not in enabled env var list`
184+ ) ;
179185 return true ;
180186 }
181187
@@ -203,7 +209,7 @@ export function getNodeAutoInstrumentations(
203209 const Instance = InstrumentationMap [ name ] ;
204210 // Defaults are defined by the instrumentation itself
205211 const userConfig : any = inputConfigs [ name ] ?? { } ;
206- ㄷ
212+
207213 const shouldDisable = shouldDisableInstrumentation (
208214 name ,
209215 userConfig ,
Original file line number Diff line number Diff line change @@ -203,18 +203,34 @@ describe('utils', () => {
203203 } ) ;
204204
205205 const fsInstrumentation = instrumentations . find (
206- instr => instr . instrumentationName === '@opentelemetry/instrumentation-fs'
206+ instr =>
207+ instr . instrumentationName === '@opentelemetry/instrumentation-fs'
207208 ) ;
208209 const httpInstrumentation = instrumentations . find (
209- instr => instr . instrumentationName === '@opentelemetry/instrumentation-http'
210+ instr =>
211+ instr . instrumentationName === '@opentelemetry/instrumentation-http'
210212 ) ;
211213 const expressInstrumentation = instrumentations . find (
212- instr => instr . instrumentationName === '@opentelemetry/instrumentation-express'
214+ instr =>
215+ instr . instrumentationName ===
216+ '@opentelemetry/instrumentation-express'
213217 ) ;
214218
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' ) ;
219+ assert . strictEqual (
220+ fsInstrumentation ,
221+ undefined ,
222+ 'fs should be disabled by user config despite env var'
223+ ) ;
224+ assert . notStrictEqual (
225+ httpInstrumentation ,
226+ undefined ,
227+ 'http should be enabled by env var (no user override)'
228+ ) ;
229+ assert . notStrictEqual (
230+ expressInstrumentation ,
231+ undefined ,
232+ 'express should be enabled by user config despite not being in env var list'
233+ ) ;
218234 } finally {
219235 delete process . env . OTEL_NODE_ENABLED_INSTRUMENTATIONS ;
220236 }
You can’t perform that action at this time.
0 commit comments