@cloudcare/rum-uniapp 2.1.18 → 2.1.22
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +42 -34
- package/cjs/boot/buildEnv.js +3 -4
- package/cjs/boot/rum.entry.js +11 -36
- package/cjs/boot/rum.js +2 -25
- package/cjs/core/baseInfo.js +6 -25
- package/cjs/core/boundedBuffer.js +1 -7
- package/cjs/core/configuration.js +15 -27
- package/cjs/core/contextManager.js +5 -17
- package/cjs/core/dataMap.js +5 -10
- package/cjs/core/downloadProxy.js +4 -26
- package/cjs/core/errorCollection.js +5 -35
- package/cjs/core/errorFilter.js +0 -8
- package/cjs/core/errorTools.js +2 -10
- package/cjs/core/heavyCustomerDataWarning.js +3 -9
- package/cjs/core/lifeCycle.js +8 -18
- package/cjs/core/observable.js +7 -13
- package/cjs/core/sdk.js +11 -19
- package/cjs/core/sessionManagement.js +8 -17
- package/cjs/core/transport.js +6 -53
- package/cjs/core/user.js +2 -7
- package/cjs/core/xhrProxy.js +4 -26
- package/cjs/helper/byteUtils.js +6 -12
- package/cjs/helper/commonContext.js +2 -3
- package/cjs/helper/enums.js +17 -28
- package/cjs/helper/jsonStringify.js +5 -12
- package/cjs/helper/limitModification.js +3 -21
- package/cjs/helper/tracekit.js +32 -145
- package/cjs/helper/utils.js +92 -306
- package/cjs/index.js +0 -1
- package/cjs/main.js +10 -0
- package/cjs/rumEventsCollection/action/actionCollection.js +0 -9
- package/cjs/rumEventsCollection/action/trackActions.js +46 -39
- package/cjs/rumEventsCollection/app/appCollection.js +0 -6
- package/cjs/rumEventsCollection/app/index.js +14 -25
- package/cjs/rumEventsCollection/assembly.js +0 -14
- package/cjs/rumEventsCollection/error/errorCollection.js +1 -16
- package/cjs/rumEventsCollection/internalContext.js +0 -2
- package/cjs/rumEventsCollection/page/index.js +19 -49
- package/cjs/rumEventsCollection/page/viewCollection.js +0 -8
- package/cjs/rumEventsCollection/parentContexts.js +3 -20
- package/cjs/rumEventsCollection/performanceCollection.js +0 -4
- package/cjs/rumEventsCollection/requestCollection.js +1 -14
- package/cjs/rumEventsCollection/resource/resourceCollection.js +0 -11
- package/cjs/rumEventsCollection/resource/resourceUtils.js +50 -46
- package/cjs/rumEventsCollection/setDataCollection.js +0 -16
- package/cjs/rumEventsCollection/tracing/ddtraceTracer.js +0 -6
- package/cjs/rumEventsCollection/tracing/jaegerTracer.js +3 -9
- package/cjs/rumEventsCollection/tracing/skywalkingTracer.js +3 -10
- package/cjs/rumEventsCollection/tracing/tracer.js +1 -25
- package/cjs/rumEventsCollection/tracing/w3cTraceParentTracer.js +1 -6
- package/cjs/rumEventsCollection/tracing/zipkinMultiTracer.js +3 -10
- package/cjs/rumEventsCollection/tracing/zipkinSingleTracer.js +1 -6
- package/cjs/rumEventsCollection/trackEventCounts.js +0 -8
- package/cjs/rumEventsCollection/trackPageActiveites.js +10 -33
- package/cjs/rumEventsCollection/transport/batch.js +0 -9
- package/esm/boot/buildEnv.js +1 -1
- package/esm/boot/rum.entry.js +8 -20
- package/esm/boot/rum.js +0 -4
- package/esm/core/baseInfo.js +0 -11
- package/esm/core/boundedBuffer.js +0 -3
- package/esm/core/configuration.js +13 -21
- package/esm/core/contextManager.js +3 -8
- package/esm/core/dataMap.js +2 -2
- package/esm/core/downloadProxy.js +2 -17
- package/esm/core/errorCollection.js +2 -15
- package/esm/core/errorFilter.js +0 -5
- package/esm/core/errorTools.js +0 -3
- package/esm/core/heavyCustomerDataWarning.js +3 -3
- package/esm/core/lifeCycle.js +0 -5
- package/esm/core/observable.js +0 -3
- package/esm/core/sdk.js +8 -12
- package/esm/core/sessionManagement.js +0 -3
- package/esm/core/transport.js +4 -38
- package/esm/core/user.js +2 -4
- package/esm/core/xhrProxy.js +2 -17
- package/esm/helper/byteUtils.js +4 -7
- package/esm/helper/commonContext.js +2 -2
- package/esm/helper/jsonStringify.js +4 -7
- package/esm/helper/limitModification.js +1 -11
- package/esm/helper/tracekit.js +29 -130
- package/esm/helper/utils.js +27 -125
- package/esm/main.js +4 -0
- package/esm/rumEventsCollection/action/actionCollection.js +0 -4
- package/esm/rumEventsCollection/action/trackActions.js +46 -31
- package/esm/rumEventsCollection/app/appCollection.js +0 -1
- package/esm/rumEventsCollection/app/index.js +12 -17
- package/esm/rumEventsCollection/assembly.js +0 -6
- package/esm/rumEventsCollection/error/errorCollection.js +0 -7
- package/esm/rumEventsCollection/internalContext.js +0 -1
- package/esm/rumEventsCollection/page/index.js +19 -43
- package/esm/rumEventsCollection/page/viewCollection.js +0 -3
- package/esm/rumEventsCollection/parentContexts.js +0 -10
- package/esm/rumEventsCollection/requestCollection.js +0 -4
- package/esm/rumEventsCollection/resource/resourceCollection.js +0 -5
- package/esm/rumEventsCollection/resource/resourceUtils.js +48 -39
- package/esm/rumEventsCollection/setDataCollection.js +0 -13
- package/esm/rumEventsCollection/tracing/ddtraceTracer.js +0 -4
- package/esm/rumEventsCollection/tracing/jaegerTracer.js +3 -7
- package/esm/rumEventsCollection/tracing/skywalkingTracer.js +5 -9
- package/esm/rumEventsCollection/tracing/tracer.js +0 -14
- package/esm/rumEventsCollection/tracing/w3cTraceParentTracer.js +1 -4
- package/esm/rumEventsCollection/tracing/zipkinMultiTracer.js +3 -8
- package/esm/rumEventsCollection/tracing/zipkinSingleTracer.js +1 -4
- package/esm/rumEventsCollection/trackEventCounts.js +0 -4
- package/esm/rumEventsCollection/trackPageActiveites.js +9 -22
- package/esm/rumEventsCollection/transport/batch.js +0 -5
- package/package.json +7 -4
package/cjs/index.js
CHANGED
package/cjs/main.js
ADDED
|
@@ -4,24 +4,17 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
6
|
exports.startActionCollection = startActionCollection;
|
|
7
|
-
|
|
8
7
|
var _utils = require("../../helper/utils");
|
|
9
|
-
|
|
10
8
|
var _lifeCycle = require("../../core/lifeCycle");
|
|
11
|
-
|
|
12
9
|
var _enums = require("../../helper/enums");
|
|
13
|
-
|
|
14
10
|
var _trackActions = require("./trackActions");
|
|
15
|
-
|
|
16
11
|
function startActionCollection(lifeCycle, configuration, Vue) {
|
|
17
12
|
lifeCycle.subscribe(_lifeCycle.LifeCycleEventType.AUTO_ACTION_COMPLETED, function (action) {
|
|
18
13
|
lifeCycle.notify(_lifeCycle.LifeCycleEventType.RAW_RUM_EVENT_COLLECTED, processAction(action));
|
|
19
14
|
});
|
|
20
|
-
|
|
21
15
|
if (configuration.trackInteractions) {
|
|
22
16
|
(0, _trackActions.trackActions)(lifeCycle, Vue);
|
|
23
17
|
}
|
|
24
|
-
|
|
25
18
|
return {
|
|
26
19
|
addAction: function addAction(action, savedCommonContext) {
|
|
27
20
|
lifeCycle.notify(_lifeCycle.LifeCycleEventType.RAW_RUM_EVENT_COLLECTED, (0, _utils.extend2Lev)({
|
|
@@ -30,7 +23,6 @@ function startActionCollection(lifeCycle, configuration, Vue) {
|
|
|
30
23
|
}
|
|
31
24
|
};
|
|
32
25
|
}
|
|
33
|
-
|
|
34
26
|
function processAction(action) {
|
|
35
27
|
var autoActionProperties = isAutoAction(action) ? {
|
|
36
28
|
action: {
|
|
@@ -68,7 +60,6 @@ function processAction(action) {
|
|
|
68
60
|
startTime: action.startClocks
|
|
69
61
|
};
|
|
70
62
|
}
|
|
71
|
-
|
|
72
63
|
function isAutoAction(action) {
|
|
73
64
|
return action.type !== _enums.ActionType.custom;
|
|
74
65
|
}
|
|
@@ -4,57 +4,75 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
6
|
exports.trackActions = trackActions;
|
|
7
|
-
|
|
8
7
|
var _utils = require("../../helper/utils");
|
|
9
|
-
|
|
10
8
|
var _lifeCycle = require("../../core/lifeCycle");
|
|
11
|
-
|
|
12
9
|
var _trackEventCounts = require("../trackEventCounts");
|
|
13
|
-
|
|
14
10
|
var _trackPageActiveites = require("../trackPageActiveites");
|
|
15
|
-
|
|
16
11
|
var _enums = require("../../helper/enums");
|
|
17
|
-
|
|
18
12
|
var _sdk = require("../../core/sdk");
|
|
19
|
-
|
|
20
13
|
var WHITE_METHOD = ['setup'];
|
|
21
|
-
|
|
22
14
|
function trackActions(lifeCycle, Vue) {
|
|
23
|
-
var action = startActionManagement(lifeCycle);
|
|
15
|
+
var action = startActionManagement(lifeCycle);
|
|
24
16
|
|
|
17
|
+
// New views trigger the discard of the current pending Action
|
|
25
18
|
lifeCycle.subscribe(_lifeCycle.LifeCycleEventType.VIEW_CREATED, function () {
|
|
26
19
|
action.discardCurrent();
|
|
27
20
|
});
|
|
28
|
-
|
|
29
21
|
if (Vue && Vue.extend) {
|
|
30
22
|
var originVueExtend = Vue.extend;
|
|
31
|
-
|
|
32
23
|
Vue.extend = function (vueOptions) {
|
|
33
24
|
proxyInstance(vueOptions, action, lifeCycle);
|
|
34
25
|
return originVueExtend.call(this, vueOptions);
|
|
35
26
|
};
|
|
36
27
|
} else {
|
|
37
28
|
if (!_sdk.tracker) return;
|
|
38
|
-
var
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
}
|
|
52
|
-
|
|
53
|
-
|
|
29
|
+
var hasComponent = false;
|
|
30
|
+
if (Page) {
|
|
31
|
+
hasComponent = true;
|
|
32
|
+
var originPage = Page;
|
|
33
|
+
Page = function Page(page) {
|
|
34
|
+
var methods = (0, _utils.getMethods)(page);
|
|
35
|
+
methods.forEach(function (methodName) {
|
|
36
|
+
clickProxy(page, methodName, function (_action) {
|
|
37
|
+
action.create(_action.type, _action.name);
|
|
38
|
+
}, lifeCycle);
|
|
39
|
+
});
|
|
40
|
+
return originPage(page);
|
|
41
|
+
};
|
|
42
|
+
}
|
|
43
|
+
if (Component) {
|
|
44
|
+
hasComponent = true;
|
|
45
|
+
var originComponent = Component;
|
|
46
|
+
Component = function Component(component) {
|
|
47
|
+
var methods = (0, _utils.getMethods)(component.methods);
|
|
48
|
+
methods.forEach(function (methodName) {
|
|
49
|
+
clickProxy(component, methodName, function (_action) {
|
|
50
|
+
action.create(_action.type, _action.name);
|
|
51
|
+
});
|
|
52
|
+
});
|
|
53
|
+
return originComponent(component);
|
|
54
|
+
};
|
|
55
|
+
}
|
|
56
|
+
if (!hasComponent) {
|
|
57
|
+
var originCreatePage = _sdk.tracker.createPage;
|
|
58
|
+
_sdk.tracker.createPage = function (page) {
|
|
59
|
+
// methods 方法
|
|
60
|
+
proxyInstance(page, action, lifeCycle);
|
|
61
|
+
return originCreatePage.call(this, page);
|
|
62
|
+
};
|
|
63
|
+
var originCreateComponent = _sdk.tracker.createComponent;
|
|
64
|
+
_sdk.tracker.createComponent = function (component) {
|
|
65
|
+
proxyInstance(component, action, lifeCycle);
|
|
66
|
+
return originCreateComponent.call(this, component);
|
|
67
|
+
};
|
|
68
|
+
}
|
|
69
|
+
}
|
|
70
|
+
// var originVueExtend = Vue.extend
|
|
54
71
|
|
|
55
72
|
return {
|
|
56
73
|
stop: function stop() {
|
|
57
|
-
action.discardCurrent();
|
|
74
|
+
action.discardCurrent();
|
|
75
|
+
// stopListener()
|
|
58
76
|
}
|
|
59
77
|
};
|
|
60
78
|
}
|
|
@@ -69,7 +87,6 @@ function proxyInstance(options, action, lifeCycle) {
|
|
|
69
87
|
}, lifeCycle);
|
|
70
88
|
});
|
|
71
89
|
}
|
|
72
|
-
|
|
73
90
|
var originMethods = (0, _utils.getMethods)(options);
|
|
74
91
|
originMethods.forEach(function (methodName) {
|
|
75
92
|
clickProxy(options, methodName, function (_action) {
|
|
@@ -77,20 +94,16 @@ function proxyInstance(options, action, lifeCycle) {
|
|
|
77
94
|
}, lifeCycle);
|
|
78
95
|
});
|
|
79
96
|
}
|
|
80
|
-
|
|
81
97
|
function clickProxy(origin, methodName, callback, lifeCycle) {
|
|
82
98
|
if (WHITE_METHOD.indexOf(methodName) > -1) return;
|
|
83
99
|
var originMethod = origin[methodName];
|
|
84
|
-
|
|
85
100
|
origin[methodName] = function () {
|
|
86
101
|
var result = originMethod.apply(this, arguments);
|
|
87
102
|
var action = {};
|
|
88
|
-
|
|
89
103
|
if ((0, _utils.isObject)(arguments[0])) {
|
|
90
104
|
var currentTarget = arguments[0].currentTarget || {};
|
|
91
105
|
var dataset = currentTarget.dataset || {};
|
|
92
106
|
var actionType = arguments[0].type;
|
|
93
|
-
|
|
94
107
|
if (actionType && _enums.ActionType[actionType]) {
|
|
95
108
|
action.type = actionType;
|
|
96
109
|
action.name = dataset.name || dataset.content || dataset.type;
|
|
@@ -119,11 +132,9 @@ function clickProxy(origin, methodName, callback, lifeCycle) {
|
|
|
119
132
|
lifeCycle.notify(_lifeCycle.LifeCycleEventType.PAGE_ALIAS_ACTION, true);
|
|
120
133
|
}
|
|
121
134
|
}
|
|
122
|
-
|
|
123
135
|
return result;
|
|
124
136
|
};
|
|
125
137
|
}
|
|
126
|
-
|
|
127
138
|
function startActionManagement(lifeCycle) {
|
|
128
139
|
var currentAction;
|
|
129
140
|
var currentIdlePageActivitySubscription;
|
|
@@ -133,7 +144,6 @@ function startActionManagement(lifeCycle) {
|
|
|
133
144
|
// Ignore any new action if another one is already occurring.
|
|
134
145
|
return;
|
|
135
146
|
}
|
|
136
|
-
|
|
137
147
|
var pendingAutoAction = new PendingAutoAction(lifeCycle, type, name);
|
|
138
148
|
currentAction = pendingAutoAction;
|
|
139
149
|
currentIdlePageActivitySubscription = (0, _trackPageActiveites.waitIdlePageActivity)(lifeCycle, function (params) {
|
|
@@ -142,7 +152,6 @@ function startActionManagement(lifeCycle) {
|
|
|
142
152
|
} else {
|
|
143
153
|
pendingAutoAction.discard();
|
|
144
154
|
}
|
|
145
|
-
|
|
146
155
|
currentAction = undefined;
|
|
147
156
|
});
|
|
148
157
|
},
|
|
@@ -155,7 +164,6 @@ function startActionManagement(lifeCycle) {
|
|
|
155
164
|
}
|
|
156
165
|
};
|
|
157
166
|
}
|
|
158
|
-
|
|
159
167
|
var PendingAutoAction = function PendingAutoAction(lifeCycle, type, name) {
|
|
160
168
|
this.id = (0, _utils.UUID)();
|
|
161
169
|
this.startClocks = (0, _utils.now)();
|
|
@@ -168,7 +176,6 @@ var PendingAutoAction = function PendingAutoAction(lifeCycle, type, name) {
|
|
|
168
176
|
startClocks: this.startClocks
|
|
169
177
|
});
|
|
170
178
|
};
|
|
171
|
-
|
|
172
179
|
PendingAutoAction.prototype = {
|
|
173
180
|
complete: function complete(endTime) {
|
|
174
181
|
var eventCounts = this.eventCountsSubscription.eventCounts;
|
|
@@ -4,22 +4,16 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
6
|
exports.startAppCollection = startAppCollection;
|
|
7
|
-
|
|
8
7
|
var _index = require("./index");
|
|
9
|
-
|
|
10
8
|
var _lifeCycle = require("../../core/lifeCycle");
|
|
11
|
-
|
|
12
9
|
var _enums = require("../../helper/enums");
|
|
13
|
-
|
|
14
10
|
var _utils = require("../../helper/utils");
|
|
15
|
-
|
|
16
11
|
function startAppCollection(lifeCycle, configuration) {
|
|
17
12
|
lifeCycle.subscribe(_lifeCycle.LifeCycleEventType.APP_UPDATE, function (appinfo) {
|
|
18
13
|
lifeCycle.notify(_lifeCycle.LifeCycleEventType.RAW_RUM_EVENT_COLLECTED, processAppUpdate(appinfo));
|
|
19
14
|
});
|
|
20
15
|
return (0, _index.rewriteApp)(configuration, lifeCycle);
|
|
21
16
|
}
|
|
22
|
-
|
|
23
17
|
function processAppUpdate(appinfo) {
|
|
24
18
|
var appEvent = {
|
|
25
19
|
date: appinfo.startTime,
|
|
@@ -3,32 +3,27 @@
|
|
|
3
3
|
Object.defineProperty(exports, "__esModule", {
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
|
+
exports.THROTTLE_VIEW_UPDATE_PERIOD = void 0;
|
|
6
7
|
exports.rewriteApp = rewriteApp;
|
|
7
|
-
exports.startupTypes =
|
|
8
|
-
|
|
8
|
+
exports.startupTypes = void 0;
|
|
9
9
|
var _utils = require("../../helper/utils");
|
|
10
|
-
|
|
11
10
|
var _lifeCycle = require("../../core/lifeCycle");
|
|
12
|
-
|
|
13
11
|
// 劫持原小程序App方法
|
|
14
|
-
var THROTTLE_VIEW_UPDATE_PERIOD = 3000;
|
|
15
|
-
exports.
|
|
16
|
-
var startupTypes = {
|
|
12
|
+
var THROTTLE_VIEW_UPDATE_PERIOD = exports.THROTTLE_VIEW_UPDATE_PERIOD = 3000;
|
|
13
|
+
var startupTypes = exports.startupTypes = {
|
|
17
14
|
COLD: 'cold',
|
|
18
15
|
HOT: 'hot'
|
|
19
16
|
};
|
|
20
|
-
exports.startupTypes = startupTypes;
|
|
21
|
-
|
|
22
17
|
function rewriteApp(configuration, lifeCycle, Vue) {
|
|
23
18
|
var originApp = App;
|
|
24
19
|
var appInfo = {
|
|
25
20
|
isStartUp: false // 是否启动
|
|
26
|
-
|
|
27
21
|
};
|
|
28
|
-
var startTime;
|
|
29
22
|
|
|
23
|
+
var startTime;
|
|
30
24
|
App = function App(app) {
|
|
31
|
-
startTime = (0, _utils.now)()
|
|
25
|
+
startTime = (0, _utils.now)()
|
|
26
|
+
// 合并方法,插入记录脚本
|
|
32
27
|
;
|
|
33
28
|
['onLaunch', 'onShow', 'onHide'].forEach(function (methodName) {
|
|
34
29
|
var userDefinedMethod = app[methodName]; // 暂存用户定义的方法
|
|
@@ -41,22 +36,20 @@ function rewriteApp(configuration, lifeCycle, Vue) {
|
|
|
41
36
|
} else if (methodName === 'onShow') {
|
|
42
37
|
if (appInfo.isStartUp && appInfo.isHide) {
|
|
43
38
|
// 判断是热启动
|
|
44
|
-
appInfo.startupType = startupTypes.HOT;
|
|
39
|
+
appInfo.startupType = startupTypes.HOT;
|
|
40
|
+
// appUpdate()
|
|
45
41
|
}
|
|
46
42
|
} else if (methodName === 'onHide') {
|
|
47
43
|
lifeCycle.notify(_lifeCycle.LifeCycleEventType.APP_HIDE);
|
|
48
44
|
appInfo.isHide = true;
|
|
49
45
|
}
|
|
50
|
-
|
|
51
46
|
return userDefinedMethod && userDefinedMethod.call(this, options);
|
|
52
47
|
};
|
|
53
48
|
});
|
|
54
49
|
return originApp(app);
|
|
55
50
|
};
|
|
56
|
-
|
|
57
51
|
startPerformanceObservable(lifeCycle);
|
|
58
52
|
}
|
|
59
|
-
|
|
60
53
|
function startPerformanceObservable(lifeCycle) {
|
|
61
54
|
var subscribe = lifeCycle.subscribe(_lifeCycle.LifeCycleEventType.PERFORMANCE_ENTRY_COLLECTED, function (entitys) {
|
|
62
55
|
// 过滤掉其他页面监听,只保留首次启动
|
|
@@ -64,7 +57,6 @@ function startPerformanceObservable(lifeCycle) {
|
|
|
64
57
|
var launchEntity = entitys.find(function (entity) {
|
|
65
58
|
return entity.entryType === 'navigation' && entity.navigationType === 'appLaunch';
|
|
66
59
|
});
|
|
67
|
-
|
|
68
60
|
if (typeof launchEntity !== 'undefined') {
|
|
69
61
|
lifeCycle.notify(_lifeCycle.LifeCycleEventType.APP_UPDATE, {
|
|
70
62
|
startTime: launchEntity.startTime,
|
|
@@ -74,11 +66,9 @@ function startPerformanceObservable(lifeCycle) {
|
|
|
74
66
|
duration: launchEntity.duration
|
|
75
67
|
});
|
|
76
68
|
}
|
|
77
|
-
|
|
78
69
|
var scriptentity = entitys.find(function (entity) {
|
|
79
70
|
return entity.entryType === 'script' && entity.name === 'evaluateScript';
|
|
80
71
|
});
|
|
81
|
-
|
|
82
72
|
if (typeof scriptentity !== 'undefined') {
|
|
83
73
|
lifeCycle.notify(_lifeCycle.LifeCycleEventType.APP_UPDATE, {
|
|
84
74
|
startTime: scriptentity.startTime,
|
|
@@ -88,27 +78,26 @@ function startPerformanceObservable(lifeCycle) {
|
|
|
88
78
|
duration: scriptentity.duration
|
|
89
79
|
});
|
|
90
80
|
}
|
|
91
|
-
|
|
92
81
|
var firstEntity = entitys.find(function (entity) {
|
|
93
82
|
return entity.entryType === 'render' && entity.name === 'firstRender';
|
|
94
83
|
});
|
|
95
|
-
|
|
96
84
|
if (firstEntity && scriptentity && launchEntity) {
|
|
97
85
|
if (!(0, _utils.areInOrder)(firstEntity.duration, launchEntity.duration) || !(0, _utils.areInOrder)(scriptentity.duration, launchEntity.duration)) {
|
|
98
86
|
return;
|
|
99
87
|
}
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
88
|
+
codeDownloadDuration = launchEntity.duration - firstEntity.duration - scriptentity.duration;
|
|
89
|
+
// 资源下载耗时
|
|
103
90
|
lifeCycle.notify(_lifeCycle.LifeCycleEventType.APP_UPDATE, {
|
|
104
91
|
startTime: launchEntity.startTime,
|
|
105
92
|
name: '小程序包下载',
|
|
106
93
|
type: 'package_download',
|
|
107
94
|
id: (0, _utils.UUID)(),
|
|
108
95
|
duration: codeDownloadDuration
|
|
109
|
-
});
|
|
96
|
+
});
|
|
97
|
+
// 资源下载时间暂时定为:首次启动时间-脚本加载时间-初次渲染时间
|
|
110
98
|
}
|
|
111
99
|
});
|
|
100
|
+
|
|
112
101
|
return {
|
|
113
102
|
stop: subscribe.unsubscribe
|
|
114
103
|
};
|
|
@@ -4,21 +4,13 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
6
|
exports.startRumAssembly = startRumAssembly;
|
|
7
|
-
|
|
8
7
|
var _utils = require("../helper/utils");
|
|
9
|
-
|
|
10
8
|
var _lifeCycle = require("../core/lifeCycle");
|
|
11
|
-
|
|
12
9
|
var _enums = require("../helper/enums");
|
|
13
|
-
|
|
14
10
|
var _baseInfo = _interopRequireDefault(require("../core/baseInfo"));
|
|
15
|
-
|
|
16
11
|
var _sessionManagement = require("../core/sessionManagement");
|
|
17
|
-
|
|
18
12
|
var _errorFilter = require("../core/errorFilter");
|
|
19
|
-
|
|
20
13
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
|
|
21
|
-
|
|
22
14
|
function startRumAssembly(applicationId, configuration, session, lifeCycle, parentContexts, getCommonContext) {
|
|
23
15
|
var errorFilter = (0, _errorFilter.createErrorFilter)(configuration, function (error) {
|
|
24
16
|
lifeCycle.notify(_lifeCycle.LifeCycleEventType.RAW_ERROR_COLLECTED, {
|
|
@@ -39,7 +31,6 @@ function startRumAssembly(applicationId, configuration, session, lifeCycle, pare
|
|
|
39
31
|
launch: _baseInfo["default"].getLaunchOptions()
|
|
40
32
|
}
|
|
41
33
|
};
|
|
42
|
-
|
|
43
34
|
if (session.isTracked() && (viewContext || rawRumEvent.type === _enums.RumEventType.APP)) {
|
|
44
35
|
var actionContext = parentContexts.findAction(startTime);
|
|
45
36
|
var commonContext = savedCommonContext || getCommonContext();
|
|
@@ -69,11 +60,9 @@ function startRumAssembly(applicationId, configuration, session, lifeCycle, pare
|
|
|
69
60
|
var rumEvent = (0, _utils.extend2Lev)(rumContext, deviceContext, appContext, viewContext, actionContext, rawRumEvent);
|
|
70
61
|
var serverRumEvent = (0, _utils.withSnakeCaseKeys)(rumEvent);
|
|
71
62
|
var context = (0, _utils.extend2Lev)({}, commonContext.context, customerContext);
|
|
72
|
-
|
|
73
63
|
if (!(0, _utils.isEmptyObject)(context)) {
|
|
74
64
|
serverRumEvent.tags = context;
|
|
75
65
|
}
|
|
76
|
-
|
|
77
66
|
if (!(0, _utils.isEmptyObject)(commonContext.user)) {
|
|
78
67
|
// eslint-disable-next-line @typescript-eslint/no-unnecessary-type-assertion
|
|
79
68
|
serverRumEvent.user = (0, _utils.extend2Lev)({
|
|
@@ -81,18 +70,15 @@ function startRumAssembly(applicationId, configuration, session, lifeCycle, pare
|
|
|
81
70
|
is_signin: 'T'
|
|
82
71
|
}, commonContext.user);
|
|
83
72
|
}
|
|
84
|
-
|
|
85
73
|
if (shouldSend(serverRumEvent, errorFilter)) {
|
|
86
74
|
lifeCycle.notify(_lifeCycle.LifeCycleEventType.RUM_EVENT_COLLECTED, serverRumEvent);
|
|
87
75
|
}
|
|
88
76
|
}
|
|
89
77
|
});
|
|
90
78
|
}
|
|
91
|
-
|
|
92
79
|
function shouldSend(event, errorFilter) {
|
|
93
80
|
if (event.type === _enums.RumEventType.ERROR) {
|
|
94
81
|
return !errorFilter.isLimitReached();
|
|
95
82
|
}
|
|
96
|
-
|
|
97
83
|
return true;
|
|
98
84
|
}
|
|
@@ -3,21 +3,14 @@
|
|
|
3
3
|
Object.defineProperty(exports, "__esModule", {
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
|
-
exports.startErrorCollection = startErrorCollection;
|
|
7
6
|
exports.doStartErrorCollection = doStartErrorCollection;
|
|
8
|
-
|
|
7
|
+
exports.startErrorCollection = startErrorCollection;
|
|
9
8
|
var _errorCollection = require("../../core/errorCollection");
|
|
10
|
-
|
|
11
9
|
var _enums = require("../../helper/enums");
|
|
12
|
-
|
|
13
10
|
var _lifeCycle = require("../../core/lifeCycle");
|
|
14
|
-
|
|
15
11
|
var _errorTools = require("../../core/errorTools");
|
|
16
|
-
|
|
17
12
|
var _utils = require("../../helper/utils");
|
|
18
|
-
|
|
19
13
|
var _tracekit = require("../../helper/tracekit");
|
|
20
|
-
|
|
21
14
|
function startErrorCollection(lifeCycle, configuration) {
|
|
22
15
|
(0, _errorCollection.startAutomaticErrorCollection)(configuration).subscribe(function (error) {
|
|
23
16
|
lifeCycle.notify(_lifeCycle.LifeCycleEventType.RAW_ERROR_COLLECTED, {
|
|
@@ -26,7 +19,6 @@ function startErrorCollection(lifeCycle, configuration) {
|
|
|
26
19
|
});
|
|
27
20
|
return doStartErrorCollection(lifeCycle);
|
|
28
21
|
}
|
|
29
|
-
|
|
30
22
|
function doStartErrorCollection(lifeCycle) {
|
|
31
23
|
lifeCycle.subscribe(_lifeCycle.LifeCycleEventType.RAW_ERROR_COLLECTED, function (error) {
|
|
32
24
|
lifeCycle.notify(_lifeCycle.LifeCycleEventType.RAW_RUM_EVENT_COLLECTED, processError(error.error));
|
|
@@ -41,7 +33,6 @@ function doStartErrorCollection(lifeCycle) {
|
|
|
41
33
|
}
|
|
42
34
|
};
|
|
43
35
|
}
|
|
44
|
-
|
|
45
36
|
function computeRawError(error, startTime, context) {
|
|
46
37
|
var stackTrace = error instanceof Error ? (0, _tracekit.computeStackTrace)(error) : undefined;
|
|
47
38
|
return (0, _utils.extend)({
|
|
@@ -50,11 +41,9 @@ function computeRawError(error, startTime, context) {
|
|
|
50
41
|
context: context
|
|
51
42
|
}, (0, _errorTools.formatUnknownError)(stackTrace, error, 'Provided'));
|
|
52
43
|
}
|
|
53
|
-
|
|
54
44
|
function processError(error) {
|
|
55
45
|
var resource = error.resource;
|
|
56
46
|
var tracingInfo;
|
|
57
|
-
|
|
58
47
|
if (resource) {
|
|
59
48
|
tracingInfo = computeRequestTracingInfo(resource);
|
|
60
49
|
var urlObj = (0, _utils.urlParse)(error.resource.url).getParse();
|
|
@@ -68,7 +57,6 @@ function processError(error) {
|
|
|
68
57
|
urlPathGroup: (0, _utils.replaceNumberCharByPath)(urlObj.Path)
|
|
69
58
|
};
|
|
70
59
|
}
|
|
71
|
-
|
|
72
60
|
var rawRumEvent = (0, _utils.extend2Lev)({
|
|
73
61
|
date: error.startTime,
|
|
74
62
|
error: {
|
|
@@ -87,14 +75,11 @@ function processError(error) {
|
|
|
87
75
|
startTime: error.startTime
|
|
88
76
|
};
|
|
89
77
|
}
|
|
90
|
-
|
|
91
78
|
function computeRequestTracingInfo(request) {
|
|
92
79
|
var hasBeenTraced = request.traceId && request.spanId;
|
|
93
|
-
|
|
94
80
|
if (!hasBeenTraced) {
|
|
95
81
|
return undefined;
|
|
96
82
|
}
|
|
97
|
-
|
|
98
83
|
return {
|
|
99
84
|
_dd: {
|
|
100
85
|
spanId: request.spanId,
|
|
@@ -4,7 +4,6 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
6
|
exports.startInternalContext = startInternalContext;
|
|
7
|
-
|
|
8
7
|
/**
|
|
9
8
|
* Internal context keep returning v1 format
|
|
10
9
|
* to not break compatibility with logs data format
|
|
@@ -13,7 +12,6 @@ function startInternalContext(applicationId, session, parentContexts) {
|
|
|
13
12
|
return {
|
|
14
13
|
get: function get(startTime) {
|
|
15
14
|
var viewContext = parentContexts.findView(startTime);
|
|
16
|
-
|
|
17
15
|
if (session.isTracked() && viewContext) {
|
|
18
16
|
var actionContext = parentContexts.findAction(startTime);
|
|
19
17
|
return {
|