Some checks failed
Build & Deploy / 🔍 Prepare (push) Successful in 20s
Build & Deploy / 🧪 QA (push) Failing after 34s
Build & Deploy / 🏗️ Build (push) Has started running
Build & Deploy / 🚀 Deploy (push) Has been cancelled
Build & Deploy / 🧪 Smoke Test (push) Has been cancelled
Build & Deploy / ⚡ Lighthouse (push) Has been cancelled
Build & Deploy / 🔔 Notify (push) Has been cancelled
1 line
2.4 KiB
Plaintext
1 line
2.4 KiB
Plaintext
{"version":3,"file":"ensureIsWrapped.js","sources":["../../../src/utils/ensureIsWrapped.ts"],"sourcesContent":["import { isWrapped } from '@opentelemetry/instrumentation';\nimport { consoleSandbox, getClient, getGlobalScope, hasSpansEnabled, isEnabled } from '@sentry/core';\nimport type { NodeClient } from '../sdk/client';\nimport { createMissingInstrumentationContext } from './createMissingInstrumentationContext';\nimport { isCjs } from './detection';\n\n/**\n * Checks and warns if a framework isn't wrapped by opentelemetry.\n */\nexport function ensureIsWrapped(\n maybeWrappedFunction: unknown,\n name: 'express' | 'connect' | 'fastify' | 'hapi' | 'koa' | 'hono',\n): void {\n const clientOptions = getClient<NodeClient>()?.getOptions();\n if (\n !clientOptions?.disableInstrumentationWarnings &&\n !isWrapped(maybeWrappedFunction) &&\n isEnabled() &&\n hasSpansEnabled(clientOptions)\n ) {\n consoleSandbox(() => {\n if (isCjs()) {\n // eslint-disable-next-line no-console\n console.warn(\n `[Sentry] ${name} is not instrumented. This is likely because you required/imported ${name} before calling \\`Sentry.init()\\`.`,\n );\n } else {\n // eslint-disable-next-line no-console\n console.warn(\n `[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/.`,\n );\n }\n });\n\n getGlobalScope().setContext('missing_instrumentation', createMissingInstrumentationContext(name));\n }\n}\n"],"names":["getClient","isWrapped","isEnabled","hasSpansEnabled","consoleSandbox","isCjs","getGlobalScope","createMissingInstrumentationContext"],"mappings":";;;;;;;AAMA;AACA;AACA;AACO,SAAS,eAAe;AAC/B,EAAE,oBAAoB;AACtB,EAAE,IAAI;AACN,EAAQ;AACR,EAAE,MAAM,gBAAgBA,cAAS,EAAc,EAAE,UAAU,EAAE;AAC7D,EAAE;AACF,IAAI,CAAC,aAAa,EAAE,8BAAA;AACpB,IAAI,CAACC,yBAAS,CAAC,oBAAoB,CAAA;AACnC,IAAIC,cAAS,EAAC;AACd,IAAIC,oBAAe,CAAC,aAAa;AACjC,IAAI;AACJ,IAAIC,mBAAc,CAAC,MAAM;AACzB,MAAM,IAAIC,eAAK,EAAE,EAAE;AACnB;AACA,QAAQ,OAAO,CAAC,IAAI;AACpB,UAAU,CAAC,SAAS,EAAE,IAAI,CAAC,mEAAmE,EAAE,IAAI,CAAC,kCAAkC,CAAC;AACxI,SAAS;AACT,MAAM,OAAO;AACb;AACA,QAAQ,OAAO,CAAC,IAAI;AACpB,UAAU,CAAC,SAAS,EAAE,IAAI,CAAC,gLAAgL,EAAE,IAAI,CAAC,cAAc,CAAC;AACjO,SAAS;AACT,MAAM;AACN,IAAI,CAAC,CAAC;;AAEN,IAAIC,mBAAc,EAAE,CAAC,UAAU,CAAC,yBAAyB,EAAEC,uEAAmC,CAAC,IAAI,CAAC,CAAC;AACrG,EAAE;AACF;;;;"} |