Repository navigation
Expand file tree
/
Copy pathsession.ts
More file actions
86 lines (76 loc) · 1.98 KB
/
Copy pathsession.ts
File metadata and controls
86 lines (76 loc) · 1.98 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
import type { User } from './user';
export interface RequestSession {
status?: RequestSessionStatus;
}
export interface Session {
sid: string;
did?: string | number;
init: boolean;
// seconds since the UNIX epoch
timestamp: number;
// seconds since the UNIX epoch
started: number;
duration?: number;
status: SessionStatus;
release?: string;
environment?: string;
userAgent?: string;
ipAddress?: string;
errors: number;
user?: User | null;
ignoreDuration: boolean;
abnormal_mechanism?: string;
/**
* Overrides default JSON serialization of the Session because
* the Sentry servers expect a slightly different schema of a session
* which is described in the interface @see SerializedSession in this file.
*
* @return a Sentry-backend conforming JSON object of the session
*/
toJSON(): SerializedSession;
}
export type SessionContext = Partial<Session>;
export type SessionStatus = 'ok' | 'exited' | 'crashed' | 'abnormal';
export type RequestSessionStatus = 'ok' | 'errored' | 'crashed';
/** JSDoc */
export interface SessionAggregates {
attrs?: {
environment?: string;
release?: string;
};
aggregates: Array<AggregationCounts>;
}
export interface SessionFlusherLike {
/**
* Increments the Session Status bucket in SessionAggregates Object corresponding to the status of the session
* captured
*/
incrementSessionStatusCount(): void;
/** Empties Aggregate Buckets and Sends them to Transport Buffer */
flush(): void;
/** Clears setInterval and calls flush */
close(): void;
}
export interface AggregationCounts {
started: string;
errored?: number;
exited?: number;
crashed?: number;
}
export interface SerializedSession {
init: boolean;
sid: string;
did?: string;
timestamp: string;
started: string;
duration?: number;
status: SessionStatus;
errors: number;
abnormal_mechanism?: string;
attrs?: {
release?: string;
environment?: string;
user_agent?: string;
ip_address?: string;
};
}