-
-
Notifications
You must be signed in to change notification settings - Fork 176
/
Copy pathsentry_session.h
71 lines (58 loc) · 1.72 KB
/
sentry_session.h
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
#ifndef SENTRY_SESSION_H_INCLUDED
#define SENTRY_SESSION_H_INCLUDED
#include "sentry_boot.h"
#include "sentry_path.h"
#include "sentry_utils.h"
struct sentry_jsonwriter_s;
/**
* This represents a session, with the number of errors, a status and other
* metadata.
*/
typedef struct sentry_session_s {
char *release;
char *environment;
sentry_uuid_t session_id;
sentry_value_t distinct_id;
uint64_t started_us;
uint64_t duration_us;
uint64_t errors;
sentry_session_status_t status;
long init;
} sentry_session_t;
/**
* This creates a new session.
*/
sentry_session_t *sentry__session_new(void);
/**
* This will free a previously allocated session.
*/
void sentry__session_free(sentry_session_t *session);
/**
* This will write the gives session into the json writer `jw`.
*/
void sentry__session_to_json(
const sentry_session_t *session, struct sentry_jsonwriter_s *jw);
/**
* Given a JSON string, this will parse and create a session out of it, or NULL
* on failure.
*/
sentry_session_t *sentry__session_from_json(const char *buf, size_t buf_len);
/**
* This will read the JSON serialized session from `path`, or return NULL on
* failure.
*/
sentry_session_t *sentry__session_from_path(const sentry_path_t *path);
/**
* This will end the current session with an explicit `status` code.
*/
sentry_session_t *sentry__end_current_session_with_status(
sentry_session_status_t status);
/**
* This will add `error_count` new errors to the current session.
*/
void sentry__record_errors_on_current_session(uint32_t error_count);
/**
* This will update a sessions `distinct_id`, which is based on the user.
*/
void sentry__session_sync_user(sentry_session_t *session, sentry_value_t user);
#endif