diff --git a/experimental/packages/opentelemetry-instrumentation/src/platform/node/instrumentation.ts b/experimental/packages/opentelemetry-instrumentation/src/platform/node/instrumentation.ts index c639bc8bd4..3d5ff7720f 100644 --- a/experimental/packages/opentelemetry-instrumentation/src/platform/node/instrumentation.ts +++ b/experimental/packages/opentelemetry-instrumentation/src/platform/node/instrumentation.ts @@ -25,7 +25,7 @@ import { Hooked, } from './RequireInTheMiddleSingleton'; import type { HookFn } from 'import-in-the-middle'; -import * as ImportInTheMiddle from 'import-in-the-middle'; +const ImportInTheMiddle = require('import-in-the-middle'); import { InstrumentationModuleDefinition } from '../../types'; import { diag } from '@opentelemetry/api'; import type { OnRequireFn } from 'require-in-the-middle'; @@ -268,7 +268,7 @@ export abstract class InstrumentationBase this._hooks.push(hook); const esmHook = - new (ImportInTheMiddle as unknown as typeof ImportInTheMiddle.default)( + new ImportInTheMiddle( [module.name], { internals: false }, hookFn