@sentry/node
Version:
Sentry Node SDK using OpenTelemetry for performance instrumentation
29 lines (26 loc) • 1.3 kB
JavaScript
Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
const majorVersion = "7";
const GLOBAL_INSTRUMENTATION_KEY = "PRISMA_INSTRUMENTATION";
const GLOBAL_VERSIONED_INSTRUMENTATION_KEY = `V${majorVersion}_PRISMA_INSTRUMENTATION`;
const globalThisWithPrismaInstrumentation = globalThis;
function getGlobalTracingHelper() {
const versionedGlobal = globalThisWithPrismaInstrumentation[GLOBAL_VERSIONED_INSTRUMENTATION_KEY];
if (versionedGlobal?.helper) {
return versionedGlobal.helper;
}
const fallbackGlobal = globalThisWithPrismaInstrumentation[GLOBAL_INSTRUMENTATION_KEY];
return fallbackGlobal?.helper;
}
function setGlobalTracingHelper(helper) {
const globalValue = { helper };
globalThisWithPrismaInstrumentation[GLOBAL_VERSIONED_INSTRUMENTATION_KEY] = globalValue;
globalThisWithPrismaInstrumentation[GLOBAL_INSTRUMENTATION_KEY] = globalValue;
}
function clearGlobalTracingHelper() {
delete globalThisWithPrismaInstrumentation[GLOBAL_VERSIONED_INSTRUMENTATION_KEY];
delete globalThisWithPrismaInstrumentation[GLOBAL_INSTRUMENTATION_KEY];
}
exports.clearGlobalTracingHelper = clearGlobalTracingHelper;
exports.getGlobalTracingHelper = getGlobalTracingHelper;
exports.setGlobalTracingHelper = setGlobalTracingHelper;
//# sourceMappingURL=global.js.map