UNPKG

@sentry/node

Version:

Sentry Node SDK using OpenTelemetry for performance instrumentation

37 lines (32 loc) • 1.42 kB
Object.defineProperty(exports, '__esModule', { value: true }); const core = require('@opentelemetry/core'); const core$1 = require('@sentry/core'); const utils = require('@sentry/utils'); const commonjs = require('./commonjs.js'); const createMissingInstrumentationContext = require('./createMissingInstrumentationContext.js'); /** * Checks and warns if a framework isn't wrapped by opentelemetry. */ function ensureIsWrapped( maybeWrappedModule, name, ) { if (!core.isWrapped(maybeWrappedModule) && core$1.isEnabled() && core$1.hasTracingEnabled()) { utils.consoleSandbox(() => { if (commonjs.isCjs()) { // eslint-disable-next-line no-console console.warn( `[Sentry] ${name} is not instrumented. This is likely because you required/imported ${name} before calling \`Sentry.init()\`.`, ); } else { // eslint-disable-next-line no-console console.warn( `[Sentry] ${name} is not instrumented. Please make sure to initialize Sentry in a separate file that you \`--import\` when running node, see: https://docs.sentry.io/platforms/javascript/guides/${name}/install/esm/.`, ); } }); core$1.getGlobalScope().setContext('missing_instrumentation', createMissingInstrumentationContext.createMissingInstrumentationContext(name)); } } exports.ensureIsWrapped = ensureIsWrapped; //# sourceMappingURL=ensureIsWrapped.js.map