MCPcopy Index your code
hub / github.com/getsentry/sentry-javascript / makeSession

Function makeSession

packages/core/src/session.ts:13–34  ·  view source on GitHub ↗
(context?: Omit<SessionContext, 'started' | 'status'>)

Source from the content-addressed store, hash-verified

11 * @returns a new `Session` object
12 */
13export function makeSession(context?: Omit<SessionContext, 'started' | 'status'>): Session {
14 // Both timestamp and started are in seconds since the UNIX epoch.
15 const startingTime = timestampInSeconds();
16
17 const session: Session = {
18 sid: uuid4(),
19 init: true,
20 timestamp: startingTime,
21 started: startingTime,
22 duration: 0,
23 status: 'ok',
24 errors: 0,
25 ignoreDuration: false,
26 toJSON: () => sessionToJSON(session),
27 };
28
29 if (context) {
30 updateSession(session, context);
31 }
32
33 return session;
34}
35
36/**
37 * Updates a session object with the properties passed in the context.

Callers 6

session.test.tsFile · 0.90
client.test.tsFile · 0.90
startSessionFunction · 0.90
worker.tsFile · 0.90
sendAbnormalSessionFunction · 0.90

Calls 4

timestampInSecondsFunction · 0.90
uuid4Function · 0.90
sessionToJSONFunction · 0.85
updateSessionFunction · 0.85

Tested by

no test coverage detected