-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathcontext.cpp
More file actions
55 lines (43 loc) · 1.68 KB
/
Copy pathcontext.cpp
File metadata and controls
55 lines (43 loc) · 1.68 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
// Unless explicitly stated otherwise all files in this repository are licensed
// under the Apache License Version 2.0.
//
// This product includes software developed at Datadog (https://www.datadoghq.com/).
// Copyright 2025-Present Datadog, Inc.
#include "datadog/impl/rum/context.hpp"
namespace datadog::impl {
void RumContext::Reset() {
application_id = UUID::Zero;
session_id = UUID::Zero;
session_is_active = false;
session_is_sampled = false;
active_view_id = UUID::Zero;
active_view_key.clear();
active_view_name.clear();
active_action_id = UUID::Zero;
}
RumFeatureContext RumContext::ToFeatureContext() const {
// If we don't have a valid RUM Application ID, return a zero-initialized value
if (application_id == UUID::Zero) {
return RumFeatureContext{};
}
// If we don't have an active session, or if the session isn't sampled, populate the
// application ID but leave it at that
if (session_id == UUID::Zero || !session_is_active || !session_is_sampled) {
return RumFeatureContext{application_id, UUID::Zero, UUID::Zero, UUID::Zero};
}
// We have a valid session: if there's no active view, just set application and
// session ID
if (active_view_id == UUID::Zero) {
return RumFeatureContext{application_id, session_id, UUID::Zero, UUID::Zero};
}
// We have an active view: if there's no active action, set application, session, and
// view state
if (active_action_id == UUID::Zero) {
return RumFeatureContext{application_id, session_id, active_view_id, UUID::Zero};
}
// We have an active action
return RumFeatureContext{
application_id, session_id, active_view_id, active_action_id
};
}
} // namespace datadog::impl