MCPcopy Create free account
hub / github.com/getsentry/sentry-javascript / makeSession

Function makeSession

packages/replay-internal/src/session/Session.ts:7–27  ·  view source on GitHub ↗
(session: Partial<Session> & { sampled: Sampled })

Source from the content-addressed store, hash-verified

5 * Get a session with defaults & applied sampling.
6 */
7export function makeSession(session: Partial<Session> & { sampled: Sampled }): Session {
8 const now = Date.now();
9 const id = session.id || uuid4();
10 // Note that this means we cannot set a started/lastActivity of `0`, but this should not be relevant outside of tests.
11 const started = session.started || now;
12 const lastActivity = session.lastActivity || now;
13 const segmentId = session.segmentId || 0;
14 const sampled = session.sampled;
15 const previousSessionId = session.previousSessionId;
16 const dirty = session.dirty || false;
17
18 return {
19 id,
20 started,
21 lastActivity,
22 segmentId,
23 sampled,
24 previousSessionId,
25 dirty,
26 };
27}

Callers 8

createMockSessionFunction · 0.90
createSessionFunction · 0.90
fetchSessionFunction · 0.90
createSessionFunction · 0.90

Calls 2

uuid4Function · 0.90
nowMethod · 0.65

Tested by 2

createMockSessionFunction · 0.72
createSessionFunction · 0.72