@cloudcare/rum-uniapp 2.1.18 → 2.1.20
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 +4 -13
- 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 +33 -145
- package/cjs/helper/utils.js +92 -306
- package/cjs/index.js +0 -1
- package/cjs/rumEventsCollection/action/actionCollection.js +0 -9
- package/cjs/rumEventsCollection/action/trackActions.js +6 -28
- package/cjs/rumEventsCollection/app/appCollection.js +0 -6
- package/cjs/rumEventsCollection/app/index.js +14 -26
- 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 +5 -43
- 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 +1 -6
- 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 +30 -130
- package/esm/helper/utils.js +27 -125
- package/esm/rumEventsCollection/action/actionCollection.js +0 -4
- package/esm/rumEventsCollection/action/trackActions.js +6 -20
- package/esm/rumEventsCollection/app/appCollection.js +0 -1
- package/esm/rumEventsCollection/app/index.js +12 -18
- 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 +5 -37
- 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 +6 -3
|
@@ -4,30 +4,22 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
6
|
exports.startViewCollection = startViewCollection;
|
|
7
|
-
|
|
8
7
|
var _index = require("./index");
|
|
9
|
-
|
|
10
8
|
var _enums = require("../../helper/enums");
|
|
11
|
-
|
|
12
9
|
var _utils = require("../../helper/utils");
|
|
13
|
-
|
|
14
10
|
var _lifeCycle = require("../../core/lifeCycle");
|
|
15
|
-
|
|
16
11
|
function startViewCollection(lifeCycle, configuration, Vue) {
|
|
17
12
|
lifeCycle.subscribe(_lifeCycle.LifeCycleEventType.VIEW_UPDATED, function (view) {
|
|
18
13
|
lifeCycle.notify(_lifeCycle.LifeCycleEventType.RAW_RUM_EVENT_COLLECTED, processViewUpdate(view));
|
|
19
14
|
});
|
|
20
15
|
return (0, _index.rewritePage)(configuration, lifeCycle, Vue);
|
|
21
16
|
}
|
|
22
|
-
|
|
23
17
|
function processViewUpdate(view) {
|
|
24
18
|
var apdexLevel;
|
|
25
|
-
|
|
26
19
|
if (view.fmp) {
|
|
27
20
|
apdexLevel = parseInt(Number(view.fmp) / 1000);
|
|
28
21
|
apdexLevel = apdexLevel > 9 ? 9 : apdexLevel;
|
|
29
22
|
}
|
|
30
|
-
|
|
31
23
|
var viewEvent = {
|
|
32
24
|
_dd: {
|
|
33
25
|
documentVersion: view.documentVersion
|
|
@@ -3,20 +3,13 @@
|
|
|
3
3
|
Object.defineProperty(exports, "__esModule", {
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
|
+
exports.VIEW_CONTEXT_TIME_OUT_DELAY = exports.CLEAR_OLD_CONTEXTS_INTERVAL = void 0;
|
|
6
7
|
exports.startParentContexts = startParentContexts;
|
|
7
|
-
exports.CLEAR_OLD_CONTEXTS_INTERVAL = exports.VIEW_CONTEXT_TIME_OUT_DELAY = void 0;
|
|
8
|
-
|
|
9
8
|
var _enums = require("../helper/enums");
|
|
10
|
-
|
|
11
9
|
var _utils = require("../helper/utils");
|
|
12
|
-
|
|
13
10
|
var _lifeCycle = require("../core/lifeCycle");
|
|
14
|
-
|
|
15
|
-
var
|
|
16
|
-
exports.VIEW_CONTEXT_TIME_OUT_DELAY = VIEW_CONTEXT_TIME_OUT_DELAY;
|
|
17
|
-
var CLEAR_OLD_CONTEXTS_INTERVAL = _enums.ONE_MINUTE;
|
|
18
|
-
exports.CLEAR_OLD_CONTEXTS_INTERVAL = CLEAR_OLD_CONTEXTS_INTERVAL;
|
|
19
|
-
|
|
11
|
+
var VIEW_CONTEXT_TIME_OUT_DELAY = exports.VIEW_CONTEXT_TIME_OUT_DELAY = 4 * _enums.ONE_HOUR;
|
|
12
|
+
var CLEAR_OLD_CONTEXTS_INTERVAL = exports.CLEAR_OLD_CONTEXTS_INTERVAL = _enums.ONE_MINUTE;
|
|
20
13
|
function startParentContexts(lifeCycle) {
|
|
21
14
|
var currentView;
|
|
22
15
|
var currentAction;
|
|
@@ -53,7 +46,6 @@ function startParentContexts(lifeCycle) {
|
|
|
53
46
|
startTime: currentAction.startClocks
|
|
54
47
|
});
|
|
55
48
|
}
|
|
56
|
-
|
|
57
49
|
currentAction = undefined;
|
|
58
50
|
});
|
|
59
51
|
lifeCycle.subscribe(_lifeCycle.LifeCycleEventType.AUTO_ACTION_DISCARDED, function () {
|
|
@@ -68,15 +60,12 @@ function startParentContexts(lifeCycle) {
|
|
|
68
60
|
var clearOldContextsInterval = setInterval(function () {
|
|
69
61
|
clearOldContexts(previousViews, VIEW_CONTEXT_TIME_OUT_DELAY);
|
|
70
62
|
}, CLEAR_OLD_CONTEXTS_INTERVAL);
|
|
71
|
-
|
|
72
63
|
function clearOldContexts(previousContexts, timeOutDelay) {
|
|
73
64
|
var oldTimeThreshold = (0, _utils.now)() - timeOutDelay;
|
|
74
|
-
|
|
75
65
|
while (previousContexts.length > 0 && previousContexts[previousContexts.length - 1].startTime < oldTimeThreshold) {
|
|
76
66
|
previousContexts.pop();
|
|
77
67
|
}
|
|
78
68
|
}
|
|
79
|
-
|
|
80
69
|
function buildCurrentActionContext() {
|
|
81
70
|
return {
|
|
82
71
|
userAction: {
|
|
@@ -84,7 +73,6 @@ function startParentContexts(lifeCycle) {
|
|
|
84
73
|
}
|
|
85
74
|
};
|
|
86
75
|
}
|
|
87
|
-
|
|
88
76
|
function buildCurrentViewContext() {
|
|
89
77
|
return {
|
|
90
78
|
page: {
|
|
@@ -94,22 +82,18 @@ function startParentContexts(lifeCycle) {
|
|
|
94
82
|
}
|
|
95
83
|
};
|
|
96
84
|
}
|
|
97
|
-
|
|
98
85
|
function findContext(buildContext, previousContexts, currentContext, startTime) {
|
|
99
86
|
if (startTime === undefined) {
|
|
100
87
|
return currentContext ? buildContext() : undefined;
|
|
101
88
|
}
|
|
102
|
-
|
|
103
89
|
if (currentContext && startTime >= currentContext.startTime) {
|
|
104
90
|
return buildContext();
|
|
105
91
|
}
|
|
106
|
-
|
|
107
92
|
var flag = undefined;
|
|
108
93
|
(0, _utils.each)(previousContexts, function (previousContext) {
|
|
109
94
|
if (startTime > previousContext.endTime) {
|
|
110
95
|
return false;
|
|
111
96
|
}
|
|
112
|
-
|
|
113
97
|
if (startTime >= previousContext.startTime) {
|
|
114
98
|
flag = previousContext.context;
|
|
115
99
|
return false;
|
|
@@ -117,7 +101,6 @@ function startParentContexts(lifeCycle) {
|
|
|
117
101
|
});
|
|
118
102
|
return flag;
|
|
119
103
|
}
|
|
120
|
-
|
|
121
104
|
var parentContexts = {
|
|
122
105
|
findView: function findView(startTime) {
|
|
123
106
|
return findContext(buildCurrentViewContext, previousViews, currentView, startTime);
|
|
@@ -4,15 +4,11 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
6
|
exports.startPagePerformanceObservable = startPagePerformanceObservable;
|
|
7
|
-
|
|
8
7
|
var _lifeCycle = require("../core/lifeCycle");
|
|
9
|
-
|
|
10
8
|
var _sdk = require("../core/sdk");
|
|
11
|
-
|
|
12
9
|
function startPagePerformanceObservable(lifeCycle, configuration) {
|
|
13
10
|
if (!!_sdk.tracker.getPerformance) {
|
|
14
11
|
var performance = _sdk.tracker.getPerformance();
|
|
15
|
-
|
|
16
12
|
if (!performance || typeof performance.createObserver !== 'function') return;
|
|
17
13
|
var observer = performance.createObserver(function (entryList) {
|
|
18
14
|
lifeCycle.notify(_lifeCycle.LifeCycleEventType.PERFORMANCE_ENTRY_COLLECTED, entryList.getEntries());
|
|
@@ -4,29 +4,20 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
6
|
exports.startRequestCollection = startRequestCollection;
|
|
7
|
-
exports.trackXhr = trackXhr;
|
|
8
7
|
exports.trackDownload = trackDownload;
|
|
9
|
-
|
|
8
|
+
exports.trackXhr = trackXhr;
|
|
10
9
|
var _xhrProxy = require("../core/xhrProxy");
|
|
11
|
-
|
|
12
10
|
var _downloadProxy = require("../core/downloadProxy");
|
|
13
|
-
|
|
14
11
|
var _lifeCycle = require("../core/lifeCycle");
|
|
15
|
-
|
|
16
12
|
var _utils = require("../helper/utils");
|
|
17
|
-
|
|
18
13
|
var _resourceUtils = require("../rumEventsCollection/resource/resourceUtils");
|
|
19
|
-
|
|
20
14
|
var _tracer = require("../rumEventsCollection/tracing/tracer");
|
|
21
|
-
|
|
22
15
|
var nextRequestIndex = 1;
|
|
23
|
-
|
|
24
16
|
function startRequestCollection(lifeCycle, configuration) {
|
|
25
17
|
var tracer = (0, _tracer.startTracer)(configuration);
|
|
26
18
|
trackXhr(lifeCycle, configuration, tracer);
|
|
27
19
|
trackDownload(lifeCycle, configuration);
|
|
28
20
|
}
|
|
29
|
-
|
|
30
21
|
function parseHeader(header) {
|
|
31
22
|
// 大小写兼容
|
|
32
23
|
if (!(0, _utils.isObject)(header)) return header;
|
|
@@ -36,7 +27,6 @@ function parseHeader(header) {
|
|
|
36
27
|
});
|
|
37
28
|
return res;
|
|
38
29
|
}
|
|
39
|
-
|
|
40
30
|
function getHeaderString(header) {
|
|
41
31
|
if (!(0, _utils.isObject)(header)) return header;
|
|
42
32
|
var headerStr = '';
|
|
@@ -45,7 +35,6 @@ function getHeaderString(header) {
|
|
|
45
35
|
});
|
|
46
36
|
return headerStr;
|
|
47
37
|
}
|
|
48
|
-
|
|
49
38
|
function trackXhr(lifeCycle, configuration, tracer) {
|
|
50
39
|
var xhrProxy = (0, _xhrProxy.startXhrProxy)(configuration);
|
|
51
40
|
xhrProxy.beforeSend(function (context) {
|
|
@@ -77,7 +66,6 @@ function trackXhr(lifeCycle, configuration, tracer) {
|
|
|
77
66
|
});
|
|
78
67
|
return xhrProxy;
|
|
79
68
|
}
|
|
80
|
-
|
|
81
69
|
function trackDownload(lifeCycle, configuration) {
|
|
82
70
|
var dwonloadProxy = (0, _downloadProxy.startDownloadProxy)(configuration);
|
|
83
71
|
dwonloadProxy.beforeSend(function (context) {
|
|
@@ -105,7 +93,6 @@ function trackDownload(lifeCycle, configuration) {
|
|
|
105
93
|
});
|
|
106
94
|
return dwonloadProxy;
|
|
107
95
|
}
|
|
108
|
-
|
|
109
96
|
function getNextRequestIndex() {
|
|
110
97
|
var result = nextRequestIndex;
|
|
111
98
|
nextRequestIndex += 1;
|
|
@@ -4,23 +4,16 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
6
|
exports.startResourceCollection = startResourceCollection;
|
|
7
|
-
|
|
8
7
|
var _resourceUtils = require("./resourceUtils");
|
|
9
|
-
|
|
10
8
|
var _lifeCycle = require("../../core/lifeCycle");
|
|
11
|
-
|
|
12
9
|
var _utils = require("../../helper/utils");
|
|
13
|
-
|
|
14
10
|
var _jsonStringify = require("../../helper/jsonStringify");
|
|
15
|
-
|
|
16
11
|
var _enums = require("../../helper/enums");
|
|
17
|
-
|
|
18
12
|
function startResourceCollection(lifeCycle, configuration) {
|
|
19
13
|
lifeCycle.subscribe(_lifeCycle.LifeCycleEventType.REQUEST_COMPLETED, function (request) {
|
|
20
14
|
lifeCycle.notify(_lifeCycle.LifeCycleEventType.RAW_RUM_EVENT_COLLECTED, processRequest(request));
|
|
21
15
|
});
|
|
22
16
|
}
|
|
23
|
-
|
|
24
17
|
function processRequest(request) {
|
|
25
18
|
var type = request.type;
|
|
26
19
|
var timing = request.performance;
|
|
@@ -49,14 +42,11 @@ function processRequest(request) {
|
|
|
49
42
|
rawRumEvent: resourceEvent
|
|
50
43
|
};
|
|
51
44
|
}
|
|
52
|
-
|
|
53
45
|
function computeRequestTracingInfo(request) {
|
|
54
46
|
var hasBeenTraced = request.traceId && request.spanId;
|
|
55
|
-
|
|
56
47
|
if (!hasBeenTraced) {
|
|
57
48
|
return undefined;
|
|
58
49
|
}
|
|
59
|
-
|
|
60
50
|
return {
|
|
61
51
|
_dd: {
|
|
62
52
|
spanId: request.spanId,
|
|
@@ -67,7 +57,6 @@ function computeRequestTracingInfo(request) {
|
|
|
67
57
|
}
|
|
68
58
|
};
|
|
69
59
|
}
|
|
70
|
-
|
|
71
60
|
function computePerformanceEntryMetrics(timing) {
|
|
72
61
|
return {
|
|
73
62
|
resource: (0, _utils.extend2Lev)({}, {
|
|
@@ -3,34 +3,30 @@
|
|
|
3
3
|
Object.defineProperty(exports, "__esModule", {
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
|
-
exports.computePerformanceResourceDuration = computePerformanceResourceDuration;
|
|
7
6
|
exports.computePerformanceResourceDetails = computePerformanceResourceDetails;
|
|
8
|
-
exports.
|
|
7
|
+
exports.computePerformanceResourceDuration = computePerformanceResourceDuration;
|
|
9
8
|
exports.computeSize = computeSize;
|
|
10
9
|
exports.isAllowedRequestUrl = isAllowedRequestUrl;
|
|
11
|
-
|
|
10
|
+
exports.toValidEntry = toValidEntry;
|
|
12
11
|
var _utils = require("../../helper/utils");
|
|
13
|
-
|
|
14
12
|
var _configuration = require("../../core/configuration");
|
|
15
|
-
|
|
16
13
|
function areInOrder() {
|
|
17
14
|
var numbers = (0, _utils.toArray)(arguments);
|
|
18
|
-
|
|
19
15
|
for (var i = 1; i < numbers.length; i += 1) {
|
|
20
16
|
if (numbers[i - 1] > numbers[i]) {
|
|
21
17
|
return false;
|
|
22
18
|
}
|
|
23
19
|
}
|
|
24
|
-
|
|
25
20
|
return true;
|
|
26
21
|
}
|
|
27
|
-
|
|
28
22
|
function computePerformanceResourceDuration(entry) {
|
|
29
23
|
// Safari duration is always 0 on timings blocked by cross origin policies.
|
|
30
24
|
if (entry.startTime < entry.responseEnd) {
|
|
31
25
|
return (0, _utils.msToNs)(entry.responseEnd - entry.startTime);
|
|
32
26
|
}
|
|
33
|
-
}
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
// interface PerformanceResourceDetails {
|
|
34
30
|
// redirect?: PerformanceResourceDetailsElement
|
|
35
31
|
// dns?: PerformanceResourceDetailsElement
|
|
36
32
|
// connect?: PerformanceResourceDetailsElement
|
|
@@ -52,75 +48,90 @@ function computePerformanceResourceDuration(entry) {
|
|
|
52
48
|
// page_trans float 内容传输时间 responseEnd - responseStart
|
|
53
49
|
// page_dom float DOM解析耗时 domInteractive - responseEnd
|
|
54
50
|
// page_resource_load_time float 资源加载时间 loadEventStart - domContentLoadedEventEnd
|
|
51
|
+
|
|
55
52
|
// navigationStart:当前浏览器窗口的前一个网页关闭,发生unload事件时的Unix毫秒时间戳。如果没有前一个网页,则等于fetchStart属性。
|
|
53
|
+
|
|
56
54
|
// · unloadEventStart:如果前一个网页与当前网页属于同一个域名,则返回前一个网页的unload事件发生时的Unix毫秒时间戳。如果没有前一个网页,或者之前的网页跳转不是在同一个域名内,则返回值为0。
|
|
55
|
+
|
|
57
56
|
// · unloadEventEnd:如果前一个网页与当前网页属于同一个域名,则返回前一个网页unload事件的回调函数结束时的Unix毫秒时间戳。如果没有前一个网页,或者之前的网页跳转不是在同一个域名内,则返回值为0。
|
|
57
|
+
|
|
58
58
|
// · redirectStart:返回第一个HTTP跳转开始时的Unix毫秒时间戳。如果没有跳转,或者不是同一个域名内部的跳转,则返回值为0。
|
|
59
|
+
|
|
59
60
|
// · redirectEnd:返回最后一个HTTP跳转结束时(即跳转回应的最后一个字节接受完成时)的Unix毫秒时间戳。如果没有跳转,或者不是同一个域名内部的跳转,则返回值为0。
|
|
61
|
+
|
|
60
62
|
// · fetchStart:返回浏览器准备使用HTTP请求读取文档时的Unix毫秒时间戳。该事件在网页查询本地缓存之前发生。
|
|
63
|
+
|
|
61
64
|
// · domainLookupStart:返回域名查询开始时的Unix毫秒时间戳。如果使用持久连接,或者信息是从本地缓存获取的,则返回值等同于fetchStart属性的值。
|
|
65
|
+
|
|
62
66
|
// · domainLookupEnd:返回域名查询结束时的Unix毫秒时间戳。如果使用持久连接,或者信息是从本地缓存获取的,则返回值等同于fetchStart属性的值。
|
|
67
|
+
|
|
63
68
|
// · connectStart:返回HTTP请求开始向服务器发送时的Unix毫秒时间戳。如果使用持久连接(persistent connection),则返回值等同于fetchStart属性的值。
|
|
69
|
+
|
|
64
70
|
// · connectEnd:返回浏览器与服务器之间的连接建立时的Unix毫秒时间戳。如果建立的是持久连接,则返回值等同于fetchStart属性的值。连接建立指的是所有握手和认证过程全部结束。
|
|
71
|
+
|
|
65
72
|
// · secureConnectionStart:返回浏览器与服务器开始安全链接的握手时的Unix毫秒时间戳。如果当前网页不要求安全连接,则返回0。
|
|
73
|
+
|
|
66
74
|
// · requestStart:返回浏览器向服务器发出HTTP请求时(或开始读取本地缓存时)的Unix毫秒时间戳。
|
|
75
|
+
|
|
67
76
|
// · responseStart:返回浏览器从服务器收到(或从本地缓存读取)第一个字节时的Unix毫秒时间戳。
|
|
77
|
+
|
|
68
78
|
// · responseEnd:返回浏览器从服务器收到(或从本地缓存读取)最后一个字节时(如果在此之前HTTP连接已经关闭,则返回关闭时)的Unix毫秒时间戳。
|
|
79
|
+
|
|
69
80
|
// · domLoading:返回当前网页DOM结构开始解析时(即Document.readyState属性变为“loading”、相应的readystatechange事件触发时)的Unix毫秒时间戳。
|
|
81
|
+
|
|
70
82
|
// · domInteractive:返回当前网页DOM结构结束解析、开始加载内嵌资源时(即Document.readyState属性变为“interactive”、相应的readystatechange事件触发时)的Unix毫秒时间戳。
|
|
83
|
+
|
|
71
84
|
// · domContentLoadedEventStart:返回当前网页DOMContentLoaded事件发生时(即DOM结构解析完毕、所有脚本开始运行时)的Unix毫秒时间戳。
|
|
85
|
+
|
|
72
86
|
// · domContentLoadedEventEnd:返回当前网页所有需要执行的脚本执行完成时的Unix毫秒时间戳。
|
|
87
|
+
|
|
73
88
|
// · domComplete:返回当前网页DOM结构生成时(即Document.readyState属性变为“complete”,以及相应的readystatechange事件发生时)的Unix毫秒时间戳。
|
|
74
|
-
// · loadEventStart:返回当前网页load事件的回调函数开始时的Unix毫秒时间戳。如果该事件还没有发生,返回0。
|
|
75
|
-
// · loadEventEnd:返回当前网页load事件的回调函数运行结束时的Unix毫秒时间戳。如果该事件还没有发生,返回0
|
|
76
89
|
|
|
90
|
+
// · loadEventStart:返回当前网页load事件的回调函数开始时的Unix毫秒时间戳。如果该事件还没有发生,返回0。
|
|
77
91
|
|
|
92
|
+
// · loadEventEnd:返回当前网页load事件的回调函数运行结束时的Unix毫秒时间戳。如果该事件还没有发生,返回0
|
|
78
93
|
function computePerformanceResourceDetails(entry) {
|
|
79
94
|
var validEntry = toValidEntry(entry);
|
|
80
|
-
|
|
81
95
|
if (!validEntry) {
|
|
82
96
|
return undefined;
|
|
83
97
|
}
|
|
84
|
-
|
|
85
98
|
var startTime = validEntry.startTime,
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
99
|
+
fetchStart = validEntry.fetchStart,
|
|
100
|
+
redirectStart = validEntry.redirectStart,
|
|
101
|
+
redirectEnd = validEntry.redirectEnd,
|
|
102
|
+
domainLookupStart = validEntry.domainLookupStart || validEntry.domainLookUpStart,
|
|
103
|
+
domainLookupEnd = validEntry.domainLookupEnd || validEntry.domainLookUpEnd,
|
|
104
|
+
connectStart = validEntry.connectStart,
|
|
105
|
+
SSLconnectionStart = validEntry.SSLconnectionStart,
|
|
106
|
+
SSLconnectionEnd = validEntry.SSLconnectionEnd,
|
|
107
|
+
connectEnd = validEntry.connectEnd,
|
|
108
|
+
requestStart = validEntry.requestStart,
|
|
109
|
+
responseStart = validEntry.responseStart,
|
|
110
|
+
responseEnd = validEntry.responseEnd;
|
|
98
111
|
var details = {
|
|
99
112
|
firstbyte: formatTiming(startTime, domainLookupStart, responseStart),
|
|
100
113
|
trans: formatTiming(startTime, responseStart, responseEnd),
|
|
101
114
|
ttfb: formatTiming(startTime, requestStart, responseStart)
|
|
102
|
-
};
|
|
103
|
-
|
|
115
|
+
};
|
|
116
|
+
// Make sure a connection occurred
|
|
104
117
|
if (connectEnd !== fetchStart) {
|
|
105
|
-
details.tcp = formatTiming(startTime, connectStart, connectEnd);
|
|
118
|
+
details.tcp = formatTiming(startTime, connectStart, connectEnd);
|
|
106
119
|
|
|
120
|
+
// Make sure a secure connection occurred
|
|
107
121
|
if (areInOrder(connectStart, SSLconnectionStart, SSLconnectionEnd)) {
|
|
108
122
|
details.ssl = formatTiming(startTime, SSLconnectionStart, SSLconnectionEnd);
|
|
109
123
|
}
|
|
110
|
-
}
|
|
111
|
-
|
|
124
|
+
}
|
|
112
125
|
|
|
126
|
+
// Make sure a domain lookup occurred
|
|
113
127
|
if (domainLookupEnd !== fetchStart) {
|
|
114
128
|
details.dns = formatTiming(startTime, domainLookupStart, domainLookupEnd);
|
|
115
129
|
}
|
|
116
|
-
|
|
117
130
|
if (hasRedirection(entry)) {
|
|
118
131
|
details.redirect = formatTiming(startTime, redirectStart, redirectEnd);
|
|
119
132
|
}
|
|
120
|
-
|
|
121
133
|
return details;
|
|
122
134
|
}
|
|
123
|
-
|
|
124
135
|
function toValidEntry(entry) {
|
|
125
136
|
// Ensure timings are in the right order. On top of filtering out potential invalid
|
|
126
137
|
// RumPerformanceResourceTiming, it will ignore entries from requests where timings cannot be
|
|
@@ -142,32 +153,29 @@ function toValidEntry(entry) {
|
|
|
142
153
|
if (!areInOrder(entry.startTime, entry.fetchStart, entry.domainLookupStart, entry.domainLookupEnd, entry.connectStart, entry.connectEnd, entry.requestStart, entry.responseStart, entry.responseEnd)) {
|
|
143
154
|
return undefined;
|
|
144
155
|
}
|
|
145
|
-
|
|
146
156
|
if (!hasRedirection(entry)) {
|
|
147
157
|
return entry;
|
|
148
158
|
}
|
|
149
|
-
|
|
150
159
|
var redirectStart = entry.redirectStart;
|
|
151
|
-
var redirectEnd = entry.redirectEnd;
|
|
160
|
+
var redirectEnd = entry.redirectEnd;
|
|
161
|
+
// Firefox doesn't provide redirect timings on cross origin requests.
|
|
152
162
|
// Provide a default for those.
|
|
153
|
-
|
|
154
163
|
if (redirectStart < entry.startTime) {
|
|
155
164
|
redirectStart = entry.startTime;
|
|
156
165
|
}
|
|
157
|
-
|
|
158
166
|
if (redirectEnd < entry.startTime) {
|
|
159
167
|
redirectEnd = entry.fetchStart;
|
|
160
|
-
}
|
|
161
|
-
|
|
168
|
+
}
|
|
162
169
|
|
|
170
|
+
// Make sure redirect timings are in order
|
|
163
171
|
if (!areInOrder(entry.startTime, redirectStart, redirectEnd, entry.fetchStart)) {
|
|
164
172
|
return undefined;
|
|
165
173
|
}
|
|
166
|
-
|
|
167
174
|
return (0, _utils.extend)({}, entry, {
|
|
168
175
|
redirectEnd: redirectEnd,
|
|
169
176
|
redirectStart: redirectStart
|
|
170
|
-
});
|
|
177
|
+
});
|
|
178
|
+
// return {
|
|
171
179
|
// ...entry,
|
|
172
180
|
// redirectEnd,
|
|
173
181
|
// redirectStart
|
|
@@ -178,20 +186,16 @@ function hasRedirection(entry) {
|
|
|
178
186
|
// The only time fetchStart is different than startTime is if a redirection occurred.
|
|
179
187
|
return entry.fetchStart !== entry.startTime;
|
|
180
188
|
}
|
|
181
|
-
|
|
182
189
|
function formatTiming(origin, start, end) {
|
|
183
190
|
return (0, _utils.msToNs)(end - start);
|
|
184
191
|
}
|
|
185
|
-
|
|
186
192
|
function computeSize(entry) {
|
|
187
193
|
// Make sure a request actually occurred
|
|
188
194
|
if (entry.startTime < entry.responseStart) {
|
|
189
195
|
return entry.receivedBytedCount;
|
|
190
196
|
}
|
|
191
|
-
|
|
192
197
|
return undefined;
|
|
193
198
|
}
|
|
194
|
-
|
|
195
199
|
function isAllowedRequestUrl(configuration, url) {
|
|
196
200
|
return url && !(0, _configuration.isIntakeRequest)(url, configuration);
|
|
197
201
|
}
|
|
@@ -4,37 +4,27 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
6
|
exports.startSetDataColloction = startSetDataColloction;
|
|
7
|
-
|
|
8
7
|
var _lifeCycle = require("../core/lifeCycle");
|
|
9
|
-
|
|
10
8
|
var _utils = require("../helper/utils");
|
|
11
|
-
|
|
12
9
|
var _sdk = require("../core/sdk");
|
|
13
|
-
|
|
14
10
|
function resetSetData(data, callback, lifeCycle, mpInstance) {
|
|
15
11
|
var pendingStartTimestamp = (0, _utils.now)();
|
|
16
|
-
|
|
17
12
|
var _callback = function _callback() {
|
|
18
13
|
lifeCycle.notify(_lifeCycle.LifeCycleEventType.PAGE_SET_DATA_UPDATE, {
|
|
19
14
|
pendingStartTimestamp: pendingStartTimestamp,
|
|
20
15
|
updateEndTimestamp: (0, _utils.now)()
|
|
21
16
|
});
|
|
22
|
-
|
|
23
17
|
if (typeof callback === 'function') {
|
|
24
18
|
callback.call(mpInstance);
|
|
25
19
|
}
|
|
26
20
|
};
|
|
27
|
-
|
|
28
21
|
return _callback;
|
|
29
22
|
}
|
|
30
|
-
|
|
31
23
|
function proxyPage(pageOptions, lifeCycle) {
|
|
32
24
|
var userDefinedMethod = pageOptions['onLoad'];
|
|
33
|
-
|
|
34
25
|
pageOptions['onLoad'] = function () {
|
|
35
26
|
var mpInstance = this.$scope;
|
|
36
27
|
var setData = mpInstance.setData;
|
|
37
|
-
|
|
38
28
|
if (typeof setData === 'function') {
|
|
39
29
|
try {
|
|
40
30
|
// 这里暂时这么处理 只读属性 会抛出错误
|
|
@@ -51,15 +41,12 @@ function proxyPage(pageOptions, lifeCycle) {
|
|
|
51
41
|
});
|
|
52
42
|
}
|
|
53
43
|
}
|
|
54
|
-
|
|
55
44
|
return userDefinedMethod && userDefinedMethod.apply(this, arguments);
|
|
56
45
|
};
|
|
57
46
|
}
|
|
58
|
-
|
|
59
47
|
function startSetDataColloction(lifeCycle, Vue) {
|
|
60
48
|
if (Vue && Vue.extend) {
|
|
61
49
|
var originVueExtend = Vue.extend;
|
|
62
|
-
|
|
63
50
|
Vue.extend = function (vueOptions) {
|
|
64
51
|
proxyPage(vueOptions, lifeCycle);
|
|
65
52
|
return originVueExtend.call(this, vueOptions);
|
|
@@ -67,14 +54,11 @@ function startSetDataColloction(lifeCycle, Vue) {
|
|
|
67
54
|
} else {
|
|
68
55
|
if (!_sdk.tracker) return;
|
|
69
56
|
var originCreatePage = _sdk.tracker.createPage;
|
|
70
|
-
|
|
71
57
|
_sdk.tracker.createPage = function (pageOptions) {
|
|
72
58
|
proxyPage(pageOptions, lifeCycle);
|
|
73
59
|
return originCreatePage.call(this, pageOptions);
|
|
74
60
|
};
|
|
75
|
-
|
|
76
61
|
var originCreateComponent = _sdk.tracker.createComponent;
|
|
77
|
-
|
|
78
62
|
_sdk.tracker.createComponent = function (component) {
|
|
79
63
|
proxyPage(component, lifeCycle);
|
|
80
64
|
return originCreateComponent.call(this, component);
|
|
@@ -4,30 +4,24 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
6
|
exports.DDtraceTracer = DDtraceTracer;
|
|
7
|
-
|
|
8
7
|
// === Generate a random 64-bit number in fixed-length hex format
|
|
9
8
|
function randomTraceId() {
|
|
10
9
|
var digits = '0123456789abcdef';
|
|
11
10
|
var n = '';
|
|
12
|
-
|
|
13
11
|
for (var i = 0; i < 19; i += 1) {
|
|
14
12
|
var rand = Math.floor(Math.random() * 10);
|
|
15
13
|
n += digits[rand];
|
|
16
14
|
}
|
|
17
|
-
|
|
18
15
|
return n;
|
|
19
16
|
}
|
|
20
17
|
/**
|
|
21
18
|
*
|
|
22
19
|
* @param {*} configuration 配置信息
|
|
23
20
|
*/
|
|
24
|
-
|
|
25
|
-
|
|
26
21
|
function DDtraceTracer(configuration) {
|
|
27
22
|
this._spanId = randomTraceId();
|
|
28
23
|
this._traceId = randomTraceId();
|
|
29
24
|
}
|
|
30
|
-
|
|
31
25
|
DDtraceTracer.prototype = {
|
|
32
26
|
isTracingSupported: function isTracingSupported() {
|
|
33
27
|
return true;
|
|
@@ -4,38 +4,32 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
6
|
exports.JaegerTracer = JaegerTracer;
|
|
7
|
-
|
|
8
7
|
// === Generate a random 64-bit number in fixed-length hex format
|
|
9
8
|
function randomTraceId() {
|
|
10
9
|
var digits = '0123456789abcdef';
|
|
11
10
|
var n = '';
|
|
12
|
-
|
|
13
11
|
for (var i = 0; i < 16; i += 1) {
|
|
14
12
|
var rand = Math.floor(Math.random() * 16);
|
|
15
13
|
n += digits[rand];
|
|
16
14
|
}
|
|
17
|
-
|
|
18
15
|
return n;
|
|
19
16
|
}
|
|
17
|
+
|
|
20
18
|
/**
|
|
21
19
|
*
|
|
22
20
|
* @param {*} configuration 配置信息
|
|
23
21
|
*/
|
|
24
|
-
|
|
25
|
-
|
|
26
22
|
function JaegerTracer(configuration) {
|
|
27
|
-
var rootSpanId = randomTraceId();
|
|
28
|
-
|
|
23
|
+
var rootSpanId = randomTraceId();
|
|
24
|
+
// this._traceId = randomTraceId() + rootSpanId // 默认用128bit,兼容其他配置
|
|
29
25
|
if (configuration.traceId128Bit) {
|
|
30
26
|
// 128bit生成traceid
|
|
31
27
|
this._traceId = randomTraceId() + rootSpanId;
|
|
32
28
|
} else {
|
|
33
29
|
this._traceId = rootSpanId;
|
|
34
30
|
}
|
|
35
|
-
|
|
36
31
|
this._spanId = rootSpanId;
|
|
37
32
|
}
|
|
38
|
-
|
|
39
33
|
JaegerTracer.prototype = {
|
|
40
34
|
isTracingSupported: function isTracingSupported() {
|
|
41
35
|
return true;
|
|
@@ -4,27 +4,23 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
6
|
exports.SkyWalkingTracer = SkyWalkingTracer;
|
|
7
|
-
|
|
8
7
|
var _utils = require("../../helper/utils");
|
|
9
|
-
|
|
10
8
|
// start SkyWalking
|
|
11
9
|
function uuid() {
|
|
12
10
|
return 'xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx'.replace(/[xy]/g, function (c) {
|
|
13
11
|
/* tslint:disable */
|
|
14
12
|
var r = Math.random() * 16 | 0;
|
|
15
13
|
/* tslint:disable */
|
|
16
|
-
|
|
17
14
|
var v = c === 'x' ? r : r & 0x3 | 0x8;
|
|
18
15
|
return v.toString(16);
|
|
19
16
|
});
|
|
20
17
|
}
|
|
18
|
+
|
|
21
19
|
/**
|
|
22
20
|
*
|
|
23
21
|
* @param {*} configuration 配置信息
|
|
24
22
|
* @param {*} requestUrl 请求的url
|
|
25
23
|
*/
|
|
26
|
-
|
|
27
|
-
|
|
28
24
|
function SkyWalkingTracer(configuration, requestUrl) {
|
|
29
25
|
this._spanId = uuid();
|
|
30
26
|
this._traceId = uuid();
|
|
@@ -33,7 +29,6 @@ function SkyWalkingTracer(configuration, requestUrl) {
|
|
|
33
29
|
this._version = configuration.version;
|
|
34
30
|
this._urlParse = (0, _utils.urlParse)(requestUrl).getParse();
|
|
35
31
|
}
|
|
36
|
-
|
|
37
32
|
SkyWalkingTracer.prototype = {
|
|
38
33
|
isTracingSupported: function isTracingSupported() {
|
|
39
34
|
if (this._env && this._version && this._urlParse) return true;
|
|
@@ -53,15 +48,13 @@ SkyWalkingTracer.prototype = {
|
|
|
53
48
|
var instance = String((0, _utils.base64Encode)(this._version));
|
|
54
49
|
var activePage = (0, _utils.getActivePage)();
|
|
55
50
|
var endpointPage = '';
|
|
56
|
-
|
|
57
51
|
if (activePage && activePage.route) {
|
|
58
52
|
endpointPage = activePage.route;
|
|
59
53
|
}
|
|
60
|
-
|
|
61
54
|
var endpoint = String((0, _utils.base64Encode)(endpointPage));
|
|
62
55
|
var peer = String((0, _utils.base64Encode)(this._urlParse.Host));
|
|
63
|
-
var index = '0';
|
|
64
|
-
|
|
56
|
+
var index = '0';
|
|
57
|
+
// var values = `${1}-${traceIdStr}-${segmentId}-${index}-${service}-${instance}-${endpoint}-${peer}`;
|
|
65
58
|
return '1-' + traceIdStr + '-' + segmentId + '-' + index + '-' + service + '-' + instance + '-' + endpoint + '-' + peer;
|
|
66
59
|
} catch (err) {
|
|
67
60
|
return '';
|