UNPKG

@sentry/node

Version:

Sentry Node SDK using OpenTelemetry for performance instrumentation

36 lines (32 loc) • 1.08 kB
Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' }); const core = require('@sentry/core'); const INTEGRATION_NAME = "ProcessSession"; const processSessionIntegration = core.defineIntegration(() => { return { name: INTEGRATION_NAME, setup(client) { core.startSession(); const processIsolationScope = core.getIsolationScope(); process.on("beforeExit", () => { const session = core.getIsolationScope().getSession(); if (session?.status === "ok") { core.endSession(); } }); const unsubscribe = client.on("startRequestSession", () => { unsubscribe(); const session = processIsolationScope.getSession(); if (!session) { return; } if (!session.init && session.status === "ok") { core.closeSession(session); client.captureSession(session); } processIsolationScope.setSession(); }); } }; }); exports.processSessionIntegration = processSessionIntegration; //# sourceMappingURL=processSession.js.map