From 4021e62c77d9f13dcc7c686b17869bcfbe1967b5 Mon Sep 17 00:00:00 2001 From: Ran Nozik Date: Tue, 26 Apr 2022 09:44:42 +0300 Subject: [PATCH] cr comment --- .../src/platform/node/instrumentation.ts | 9 +-------- 1 file changed, 1 insertion(+), 8 deletions(-) diff --git a/experimental/packages/opentelemetry-instrumentation/src/platform/node/instrumentation.ts b/experimental/packages/opentelemetry-instrumentation/src/platform/node/instrumentation.ts index 19d4ca138a4..e51bfac3edb 100644 --- a/experimental/packages/opentelemetry-instrumentation/src/platform/node/instrumentation.ts +++ b/experimental/packages/opentelemetry-instrumentation/src/platform/node/instrumentation.ts @@ -62,25 +62,18 @@ export abstract class InstrumentationBase } private _warnOnPreloadedModules(): void { - const preloadedModules: string[] = []; this._modules.forEach((module: InstrumentationModuleDefinition) => { const { name } = module; try { const resolvedModule = require.resolve(name); if (require.cache[resolvedModule]) { // Module is already cached, which means the instrumentation hook might not work - preloadedModules.push(name); + this._diag.warn(`Module ${name} has been loaded before ${this.instrumentationName} so it might not work, please initialize it before requiring ${name}`); } } catch { // Module isn't available, we can simply skip } }); - - if (!preloadedModules.length) { - return; - } - - this._diag.warn(`Some modules (${preloadedModules.join(', ')}) were already required when their respective plugin was loaded, some plugins might not work. Make sure the SDK is setup before you require in other modules.`); } private _extractPackageVersion(baseDir: string): string | undefined {