@cloudcare/rum-uniapp 1.0.1 → 2.0.1
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 +1 -1
- package/cjs/boot/buildEnv.js +1 -1
- package/cjs/boot/rum.entry.js +56 -1
- package/cjs/boot/rum.js +2 -2
- package/cjs/core/boundedBuffer.js +28 -0
- package/cjs/core/configuration.js +22 -1
- package/cjs/core/dataMap.js +5 -1
- package/cjs/core/transport.js +123 -69
- package/cjs/core/xhrProxy.js +3 -2
- package/cjs/helper/enums.js +11 -2
- package/cjs/helper/utils.js +189 -6
- package/cjs/rumEventsCollection/assembly.js +19 -2
- package/cjs/rumEventsCollection/page/index.js +1 -11
- package/cjs/rumEventsCollection/requestCollection.js +9 -2
- package/cjs/rumEventsCollection/resource/resourceCollection.js +21 -1
- package/cjs/rumEventsCollection/tracing/ddtraceTracer.js +50 -0
- package/cjs/rumEventsCollection/tracing/jaegerTracer.js +58 -0
- package/cjs/rumEventsCollection/tracing/skywalkingTracer.js +75 -0
- package/cjs/rumEventsCollection/tracing/tracer.js +108 -0
- package/cjs/rumEventsCollection/tracing/w3cTraceParentTracer.js +51 -0
- package/cjs/rumEventsCollection/tracing/zipkinMultiTracer.js +58 -0
- package/cjs/rumEventsCollection/tracing/zipkinSingleTracer.js +51 -0
- package/esm/boot/buildEnv.js +1 -1
- package/esm/boot/rum.entry.js +55 -2
- package/esm/boot/rum.js +2 -2
- package/esm/core/boundedBuffer.js +20 -0
- package/esm/core/configuration.js +24 -3
- package/esm/core/dataMap.js +5 -1
- package/esm/core/transport.js +120 -70
- package/esm/core/xhrProxy.js +3 -2
- package/esm/helper/enums.js +8 -0
- package/esm/helper/utils.js +168 -5
- package/esm/rumEventsCollection/assembly.js +20 -3
- package/esm/rumEventsCollection/page/index.js +1 -11
- package/esm/rumEventsCollection/requestCollection.js +8 -2
- package/esm/rumEventsCollection/resource/resourceCollection.js +22 -2
- package/esm/rumEventsCollection/tracing/ddtraceTracer.js +42 -0
- package/esm/rumEventsCollection/tracing/jaegerTracer.js +50 -0
- package/esm/rumEventsCollection/tracing/skywalkingTracer.js +66 -0
- package/esm/rumEventsCollection/tracing/tracer.js +90 -0
- package/esm/rumEventsCollection/tracing/w3cTraceParentTracer.js +43 -0
- package/esm/rumEventsCollection/tracing/zipkinMultiTracer.js +50 -0
- package/esm/rumEventsCollection/tracing/zipkinSingleTracer.js +43 -0
- package/package.json +5 -1
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
// === Generate a random 64-bit number in fixed-length hex format
|
|
2
|
+
function randomTraceId() {
|
|
3
|
+
var digits = '0123456789abcdef';
|
|
4
|
+
var n = '';
|
|
5
|
+
|
|
6
|
+
for (var i = 0; i < 16; i += 1) {
|
|
7
|
+
var rand = Math.floor(Math.random() * 16);
|
|
8
|
+
n += digits[rand];
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
return n;
|
|
12
|
+
}
|
|
13
|
+
/**
|
|
14
|
+
*
|
|
15
|
+
* @param {*} configuration 配置信息
|
|
16
|
+
*/
|
|
17
|
+
|
|
18
|
+
|
|
19
|
+
export function W3cTraceParentTracer(configuration) {
|
|
20
|
+
var rootSpanId = randomTraceId();
|
|
21
|
+
this._traceId = randomTraceId() + rootSpanId;
|
|
22
|
+
this._spanId = rootSpanId;
|
|
23
|
+
}
|
|
24
|
+
W3cTraceParentTracer.prototype = {
|
|
25
|
+
isTracingSupported: function isTracingSupported() {
|
|
26
|
+
return true;
|
|
27
|
+
},
|
|
28
|
+
getSpanId: function getSpanId() {
|
|
29
|
+
return this._spanId;
|
|
30
|
+
},
|
|
31
|
+
getTraceId: function getTraceId() {
|
|
32
|
+
return this._traceId;
|
|
33
|
+
},
|
|
34
|
+
getTraceParent: function getTraceParent() {
|
|
35
|
+
// '{version}-{traceId}-{spanId}-{sampleDecision}'
|
|
36
|
+
return '00-' + this._traceId + '-' + this._spanId + '-01';
|
|
37
|
+
},
|
|
38
|
+
makeTracingHeaders: function makeTracingHeaders() {
|
|
39
|
+
return {
|
|
40
|
+
'traceparent': this.getTraceParent()
|
|
41
|
+
};
|
|
42
|
+
}
|
|
43
|
+
};
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
// === Generate a random 64-bit number in fixed-length hex format
|
|
2
|
+
function randomTraceId() {
|
|
3
|
+
var digits = '0123456789abcdef';
|
|
4
|
+
var n = '';
|
|
5
|
+
|
|
6
|
+
for (var i = 0; i < 16; i += 1) {
|
|
7
|
+
var rand = Math.floor(Math.random() * 16);
|
|
8
|
+
n += digits[rand];
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
return n;
|
|
12
|
+
}
|
|
13
|
+
/**
|
|
14
|
+
*
|
|
15
|
+
* @param {*} configuration 配置信息
|
|
16
|
+
*/
|
|
17
|
+
|
|
18
|
+
|
|
19
|
+
export function ZipkinMultiTracer(configuration) {
|
|
20
|
+
var rootSpanId = randomTraceId();
|
|
21
|
+
|
|
22
|
+
if (configuration.traceId128Bit) {
|
|
23
|
+
// 128bit生成traceid
|
|
24
|
+
this._traceId = randomTraceId() + rootSpanId;
|
|
25
|
+
} else {
|
|
26
|
+
this._traceId = rootSpanId;
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
this._spanId = rootSpanId;
|
|
30
|
+
}
|
|
31
|
+
ZipkinMultiTracer.prototype = {
|
|
32
|
+
isTracingSupported: function isTracingSupported() {
|
|
33
|
+
return true;
|
|
34
|
+
},
|
|
35
|
+
getSpanId: function getSpanId() {
|
|
36
|
+
return this._spanId;
|
|
37
|
+
},
|
|
38
|
+
getTraceId: function getTraceId() {
|
|
39
|
+
return this._traceId;
|
|
40
|
+
},
|
|
41
|
+
makeTracingHeaders: function makeTracingHeaders() {
|
|
42
|
+
return {
|
|
43
|
+
'X-B3-TraceId': this.getTraceId(),
|
|
44
|
+
'X-B3-SpanId': this.getSpanId(),
|
|
45
|
+
// 'X-B3-ParentSpanId': '',
|
|
46
|
+
'X-B3-Sampled': '1' // 'X-B3-Flags': '0'
|
|
47
|
+
|
|
48
|
+
};
|
|
49
|
+
}
|
|
50
|
+
};
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
// === Generate a random 64-bit number in fixed-length hex format
|
|
2
|
+
function randomTraceId() {
|
|
3
|
+
var digits = '0123456789abcdef';
|
|
4
|
+
var n = '';
|
|
5
|
+
|
|
6
|
+
for (var i = 0; i < 16; i += 1) {
|
|
7
|
+
var rand = Math.floor(Math.random() * 16);
|
|
8
|
+
n += digits[rand];
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
return n;
|
|
12
|
+
}
|
|
13
|
+
/**
|
|
14
|
+
*
|
|
15
|
+
* @param {*} configuration 配置信息
|
|
16
|
+
*/
|
|
17
|
+
|
|
18
|
+
|
|
19
|
+
export function ZipkinSingleTracer(configuration) {
|
|
20
|
+
var rootSpanId = randomTraceId();
|
|
21
|
+
this._traceId = randomTraceId() + rootSpanId;
|
|
22
|
+
this._spanId = rootSpanId;
|
|
23
|
+
}
|
|
24
|
+
ZipkinSingleTracer.prototype = {
|
|
25
|
+
isTracingSupported: function isTracingSupported() {
|
|
26
|
+
return true;
|
|
27
|
+
},
|
|
28
|
+
getSpanId: function getSpanId() {
|
|
29
|
+
return this._spanId;
|
|
30
|
+
},
|
|
31
|
+
getTraceId: function getTraceId() {
|
|
32
|
+
return this._traceId;
|
|
33
|
+
},
|
|
34
|
+
getB3Str: function getB3Str() {
|
|
35
|
+
//{TraceId}-{SpanId}-{SamplingState}-{ParentSpanId}
|
|
36
|
+
return this._traceId + '-' + this._spanId + '-1';
|
|
37
|
+
},
|
|
38
|
+
makeTracingHeaders: function makeTracingHeaders() {
|
|
39
|
+
return {
|
|
40
|
+
'b3': this.getB3Str()
|
|
41
|
+
};
|
|
42
|
+
}
|
|
43
|
+
};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@cloudcare/rum-uniapp",
|
|
3
|
-
"version": "
|
|
3
|
+
"version": "2.0.1",
|
|
4
4
|
"main": "cjs/index.js",
|
|
5
5
|
"module": "esm/index.js",
|
|
6
6
|
"miniprogram": "cjs",
|
|
@@ -35,6 +35,10 @@
|
|
|
35
35
|
],
|
|
36
36
|
"author": "dataflux",
|
|
37
37
|
"license": "MIT",
|
|
38
|
+
"repository": {
|
|
39
|
+
"url": "https://github.com/DataFlux-cn/datakit-miniprogram-uniapp",
|
|
40
|
+
"type": "git"
|
|
41
|
+
},
|
|
38
42
|
"description": "DataFlux RUM 小程序 端数据指标监控",
|
|
39
43
|
"dependencies": {}
|
|
40
44
|
}
|