Next.js website for Rocky Mountain Vending company featuring: - Product catalog with Stripe integration - Service areas and parts pages - Admin dashboard with Clerk authentication - SEO optimized pages with JSON-LD structured data Co-authored-by: Cursor <cursoragent@cursor.com>
39 lines
1.4 KiB
Text
39 lines
1.4 KiB
Text
import { isWrapped } from '@opentelemetry/instrumentation';
|
|
import { getClient, isEnabled, hasSpansEnabled, consoleSandbox, getGlobalScope } from '@sentry/core';
|
|
import { isCjs } from './commonjs.js';
|
|
import { createMissingInstrumentationContext } from './createMissingInstrumentationContext.js';
|
|
|
|
/**
|
|
* Checks and warns if a framework isn't wrapped by opentelemetry.
|
|
*/
|
|
function ensureIsWrapped(
|
|
maybeWrappedFunction,
|
|
name,
|
|
) {
|
|
const clientOptions = getClient()?.getOptions();
|
|
if (
|
|
!clientOptions?.disableInstrumentationWarnings &&
|
|
!isWrapped(maybeWrappedFunction) &&
|
|
isEnabled() &&
|
|
hasSpansEnabled(clientOptions)
|
|
) {
|
|
consoleSandbox(() => {
|
|
if (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/.`,
|
|
);
|
|
}
|
|
});
|
|
|
|
getGlobalScope().setContext('missing_instrumentation', createMissingInstrumentationContext(name));
|
|
}
|
|
}
|
|
|
|
export { ensureIsWrapped };
|
|
//# sourceMappingURL=ensureIsWrapped.js.map
|