@datadog/browser-logs
Version:
28 lines • 1.15 kB
JavaScript
;
Object.defineProperty(exports, "__esModule", { value: true });
exports.startSessionContext = startSessionContext;
const browser_core_1 = require("@datadog/browser-core");
function startSessionContext(hooks, configuration, sessionManager) {
hooks.register(0 /* HookNames.Assemble */, ({ startTime }) => {
const session = sessionManager.findTrackedSession(startTime);
const isSessionTracked = sessionManager.findTrackedSession(startTime, { returnInactive: true });
if (!isSessionTracked) {
return browser_core_1.DISCARDED;
}
return {
service: configuration.service,
session_id: session ? session.id : undefined,
session: session ? { id: session.id } : undefined,
};
});
hooks.register(1 /* HookNames.AssembleTelemetry */, ({ startTime }) => {
const session = sessionManager.findTrackedSession(startTime);
if (!session || !session.id) {
return browser_core_1.SKIPPED;
}
return {
session: { id: session.id },
};
});
}
//# sourceMappingURL=sessionContext.js.map