@cloudcare/browser-rum 3.3.0 → 3.3.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/bundle/dataflux-rum.js +1 -1
- package/cjs/boot/buildEnv.js +1 -1
- package/cjs/boot/recorderApi.js +44 -1
- package/cjs/boot/recorderApi.js.map +1 -1
- package/cjs/boot/rumPublicApi.js +11 -0
- package/cjs/boot/rumPublicApi.js.map +1 -1
- package/cjs/boot/startRecording.js +6 -1
- package/cjs/boot/startRecording.js.map +1 -1
- package/cjs/domain/deflate/deflateWorker.js +1 -1
- package/cjs/domain/replay/record/canvasEncodeWorker.js +1 -1
- package/cjs/domain/replay/record/mutationObserver.js +14 -1
- package/cjs/domain/replay/record/mutationObserver.js.map +1 -1
- package/cjs/domain/replay/record/record.js +39 -0
- package/cjs/domain/replay/record/record.js.map +1 -1
- package/cjs/domain/tracing/jaegerTracer.js +6 -6
- package/cjs/domain/tracing/jaegerTracer.js.map +1 -1
- package/cjs/domain/tracing/traceIdentifier.js +22 -0
- package/cjs/domain/tracing/traceIdentifier.js.map +1 -1
- package/cjs/domain/tracing/zipkinMultiTracer.js +6 -6
- package/cjs/domain/tracing/zipkinMultiTracer.js.map +1 -1
- package/cjs/domain/tracing/zipkinSingleTracer.js +6 -6
- package/cjs/domain/tracing/zipkinSingleTracer.js.map +1 -1
- package/esm/boot/buildEnv.js +1 -1
- package/esm/boot/recorderApi.js +44 -1
- package/esm/boot/recorderApi.js.map +1 -1
- package/esm/boot/rumPublicApi.js +11 -0
- package/esm/boot/rumPublicApi.js.map +1 -1
- package/esm/boot/startRecording.js +6 -1
- package/esm/boot/startRecording.js.map +1 -1
- package/esm/domain/deflate/deflateWorker.js +1 -1
- package/esm/domain/replay/record/canvasEncodeWorker.js +1 -1
- package/esm/domain/replay/record/mutationObserver.js +14 -1
- package/esm/domain/replay/record/mutationObserver.js.map +1 -1
- package/esm/domain/replay/record/record.js +39 -0
- package/esm/domain/replay/record/record.js.map +1 -1
- package/esm/domain/tracing/jaegerTracer.js +7 -7
- package/esm/domain/tracing/jaegerTracer.js.map +1 -1
- package/esm/domain/tracing/traceIdentifier.js +20 -0
- package/esm/domain/tracing/traceIdentifier.js.map +1 -1
- package/esm/domain/tracing/zipkinMultiTracer.js +7 -7
- package/esm/domain/tracing/zipkinMultiTracer.js.map +1 -1
- package/esm/domain/tracing/zipkinSingleTracer.js +7 -7
- package/esm/domain/tracing/zipkinSingleTracer.js.map +1 -1
- package/package.json +2 -2
- package/src/boot/recorderApi.js +47 -1
- package/src/boot/rumPublicApi.js +11 -0
- package/src/boot/startRecording.js +6 -1
- package/src/domain/replay/record/mutationObserver.js +14 -1
- package/src/domain/replay/record/record.js +46 -0
- package/src/domain/tracing/jaegerTracer.js +16 -9
- package/src/domain/tracing/traceIdentifier.js +24 -0
- package/src/domain/tracing/zipkinMultiTracer.js +16 -9
- package/src/domain/tracing/zipkinSingleTracer.js +14 -7
- package/types/index.d.ts +15 -0
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"jaegerTracer.js","names":["
|
|
1
|
+
{"version":3,"file":"jaegerTracer.js","names":["createRandomHexIdentifier","getCrypto","normalizeHexIdentifier","getType","JaegerTracer","configuration","traceSampled","_traceId","traceId128Bit","_spanId","_traceSampled","is128Bit","generateTraceId","customTraceId","prototype","isTracingSupported","undefined","getSpanId","getTraceId","getUberTraceId","makeTracingHeaders"],"sources":["../../../src/domain/tracing/jaegerTracer.js"],"sourcesContent":["import {\n createRandomHexIdentifier,\n getCrypto,\n normalizeHexIdentifier\n} from './traceIdentifier'\nimport { getType } from '@cloudcare/browser-core'\n/**\n *\n * @param {*} configuration\n */\nexport function JaegerTracer(configuration, traceSampled) {\n this._traceId = configuration.traceId128Bit\n ? createRandomHexIdentifier(16)\n : createRandomHexIdentifier(8)\n this._spanId = createRandomHexIdentifier(8)\n this._traceSampled = traceSampled\n this.is128Bit = configuration.traceId128Bit\n if (\n configuration.generateTraceId &&\n getType(configuration.generateTraceId) === 'function'\n ) {\n const customTraceId = normalizeHexIdentifier(\n configuration.generateTraceId(),\n [16, 32]\n )\n if (customTraceId) {\n this.customTraceId = customTraceId\n }\n }\n}\nJaegerTracer.prototype = {\n isTracingSupported: function () {\n return getCrypto() !== undefined\n },\n getSpanId: function () {\n return this._spanId\n },\n getTraceId: function () {\n if (this.customTraceId) {\n return this.customTraceId\n }\n return this._traceId\n },\n getUberTraceId: function () {\n //{trace-id}:{span-id}:{parent-span-id}:{flags}\n return (\n this.getTraceId() +\n ':' +\n this.getSpanId() +\n ':' +\n '0' +\n ':' +\n (this._traceSampled ? '1' : '0')\n )\n },\n makeTracingHeaders: function () {\n return {\n 'uber-trace-id': this.getUberTraceId()\n }\n }\n}\n"],"mappings":"AAAA,SACEA,yBAAyB,EACzBC,SAAS,EACTC,sBAAsB,QACjB,mBAAmB;AAC1B,SAASC,OAAO,QAAQ,yBAAyB;AACjD;AACA;AACA;AACA;AACA,OAAO,SAASC,YAAYA,CAACC,aAAa,EAAEC,YAAY,EAAE;EACxD,IAAI,CAACC,QAAQ,GAAGF,aAAa,CAACG,aAAa,GACvCR,yBAAyB,CAAC,EAAE,CAAC,GAC7BA,yBAAyB,CAAC,CAAC,CAAC;EAChC,IAAI,CAACS,OAAO,GAAGT,yBAAyB,CAAC,CAAC,CAAC;EAC3C,IAAI,CAACU,aAAa,GAAGJ,YAAY;EACjC,IAAI,CAACK,QAAQ,GAAGN,aAAa,CAACG,aAAa;EAC3C,IACEH,aAAa,CAACO,eAAe,IAC7BT,OAAO,CAACE,aAAa,CAACO,eAAe,CAAC,KAAK,UAAU,EACrD;IACA,IAAMC,aAAa,GAAGX,sBAAsB,CAC1CG,aAAa,CAACO,eAAe,CAAC,CAAC,EAC/B,CAAC,EAAE,EAAE,EAAE,CACT,CAAC;IACD,IAAIC,aAAa,EAAE;MACjB,IAAI,CAACA,aAAa,GAAGA,aAAa;IACpC;EACF;AACF;AACAT,YAAY,CAACU,SAAS,GAAG;EACvBC,kBAAkB,EAAE,SAApBA,kBAAkBA,CAAA,EAAc;IAC9B,OAAOd,SAAS,CAAC,CAAC,KAAKe,SAAS;EAClC,CAAC;EACDC,SAAS,EAAE,SAAXA,SAASA,CAAA,EAAc;IACrB,OAAO,IAAI,CAACR,OAAO;EACrB,CAAC;EACDS,UAAU,EAAE,SAAZA,UAAUA,CAAA,EAAc;IACtB,IAAI,IAAI,CAACL,aAAa,EAAE;MACtB,OAAO,IAAI,CAACA,aAAa;IAC3B;IACA,OAAO,IAAI,CAACN,QAAQ;EACtB,CAAC;EACDY,cAAc,EAAE,SAAhBA,cAAcA,CAAA,EAAc;IAC1B;IACA,OACE,IAAI,CAACD,UAAU,CAAC,CAAC,GACjB,GAAG,GACH,IAAI,CAACD,SAAS,CAAC,CAAC,GAChB,GAAG,GACH,GAAG,GACH,GAAG,IACF,IAAI,CAACP,aAAa,GAAG,GAAG,GAAG,GAAG,CAAC;EAEpC,CAAC;EACDU,kBAAkB,EAAE,SAApBA,kBAAkBA,CAAA,EAAc;IAC9B,OAAO;MACL,eAAe,EAAE,IAAI,CAACD,cAAc,CAAC;IACvC,CAAC;EACH;AACF,CAAC","ignoreList":[]}
|
|
@@ -34,4 +34,24 @@ TraceIdentifier.prototype = {
|
|
|
34
34
|
export function getCrypto() {
|
|
35
35
|
return window.crypto || window.msCrypto;
|
|
36
36
|
}
|
|
37
|
+
export function createRandomHexIdentifier(byteLength) {
|
|
38
|
+
var buffer = new Uint8Array(byteLength);
|
|
39
|
+
getCrypto().getRandomValues(buffer);
|
|
40
|
+
var parts = [];
|
|
41
|
+
for (var i = 0; i < buffer.length; i += 1) {
|
|
42
|
+
var hex = buffer[i].toString(16);
|
|
43
|
+
parts.push(hex.length === 1 ? '0' + hex : hex);
|
|
44
|
+
}
|
|
45
|
+
return parts.join('');
|
|
46
|
+
}
|
|
47
|
+
export function normalizeHexIdentifier(value, allowedLengths) {
|
|
48
|
+
if (typeof value !== 'string') {
|
|
49
|
+
return undefined;
|
|
50
|
+
}
|
|
51
|
+
var normalized = value.toLowerCase();
|
|
52
|
+
if (allowedLengths.indexOf(normalized.length) === -1) {
|
|
53
|
+
return undefined;
|
|
54
|
+
}
|
|
55
|
+
return /^[0-9a-f]+$/.test(normalized) ? normalized : undefined;
|
|
56
|
+
}
|
|
37
57
|
//# sourceMappingURL=traceIdentifier.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"traceIdentifier.js","names":["TraceIdentifier","buffer","Uint8Array","getCrypto","getRandomValues","prototype","toString","radix","high","readInt32","low","str","mod","Math","floor","toDecimalString","toPaddedHexadecimalString","traceId","Array","length","join","offset","window","crypto","msCrypto"],"sources":["../../../src/domain/tracing/traceIdentifier.js"],"sourcesContent":["export function TraceIdentifier() {\n this.buffer = new Uint8Array(8)\n getCrypto().getRandomValues(this.buffer)\n this.buffer[0] = this.buffer[0] & 0x7f\n}\n\nTraceIdentifier.prototype = {\n // buffer: new Uint8Array(8),\n toString: function (radix) {\n var high = this.readInt32(0)\n var low = this.readInt32(4)\n var str = ''\n\n do {\n var mod = (high % radix) * 4294967296 + low\n high = Math.floor(high / radix)\n low = Math.floor(mod / radix)\n str = (mod % radix).toString(radix) + str\n } while (high || low)\n return str\n },\n toDecimalString: function () {\n return this.toString(10)\n },\n /**\n * Format used by OTel headers\n */\n toPaddedHexadecimalString() {\n var traceId = this.toString(16)\n return Array(17 - traceId.length).join('0') + traceId\n },\n readInt32: function (offset) {\n return (\n this.buffer[offset] * 16777216 +\n (this.buffer[offset + 1] << 16) +\n (this.buffer[offset + 2] << 8) +\n this.buffer[offset + 3]\n )\n }\n}\nexport function getCrypto() {\n return window.crypto || window.msCrypto\n}\n"],"mappings":"AAAA,OAAO,SAASA,eAAeA,CAAA,EAAG;EAChC,IAAI,CAACC,MAAM,GAAG,IAAIC,UAAU,CAAC,CAAC,CAAC;EAC/BC,SAAS,CAAC,CAAC,CAACC,eAAe,CAAC,IAAI,CAACH,MAAM,CAAC;EACxC,I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AM,GAAG,CAAC,CAAC,IAAI,EAAE,CAAC,IAC9B,IAAI,CAACpB,MAAM,CAACoB,MAAM,GAAG,CAAC,CAAC,IAAI,CAAC,CAAC,GAC9B,IAAI,CAACpB,MAAM,CAACoB,MAAM,GAAG,CAAC,CAAC;EAE3B;AACF,CAAC;AACD,OAAO,SAASlB,SAASA,CAAA,EAAG;EAC1B,OAAOmB,MAAM,CAACC,MAAM,IAAID,MAAM,CAACE,QAAQ;AACzC","ignoreList":[]}
|
|
1
|
+
{"version":3,"file":"traceIdentifier.js","names":["TraceIdentifier","buffer","Uint8Array","getCrypto","getRandomValues","prototype","toString","radix","high","readInt32","low","str","mod","Math","floor","toDecimalString","toPaddedHexadecimalString","traceId","Array","length","join","offset","window","crypto","msCrypto","createRandomHexIdentifier","byteLength","parts","i","hex","push","normalizeHexIdentifier","value","allowedLengths","undefined","normalized","toLowerCase","indexOf","test"],"sources":["../../../src/domain/tracing/traceIdentifier.js"],"sourcesContent":["export function TraceIdentifier() {\n this.buffer = new Uint8Array(8)\n getCrypto().getRandomValues(this.buffer)\n this.buffer[0] = this.buffer[0] & 0x7f\n}\n\nTraceIdentifier.prototype = {\n // buffer: new Uint8Array(8),\n toString: function (radix) {\n var high = this.readInt32(0)\n var low = this.readInt32(4)\n var str = ''\n\n do {\n var mod = (high % radix) * 4294967296 + low\n high = Math.floor(high / radix)\n low = Math.floor(mod / radix)\n str = (mod % radix).toString(radix) + str\n } while (high || low)\n return str\n },\n toDecimalString: function () {\n return this.toString(10)\n },\n /**\n * Format used by OTel headers\n */\n toPaddedHexadecimalString() {\n var traceId = this.toString(16)\n return Array(17 - traceId.length).join('0') + traceId\n },\n readInt32: function (offset) {\n return (\n this.buffer[offset] * 16777216 +\n (this.buffer[offset + 1] << 16) +\n (this.buffer[offset + 2] << 8) +\n this.buffer[offset + 3]\n )\n }\n}\nexport function getCrypto() {\n return window.crypto || window.msCrypto\n}\n\nexport function createRandomHexIdentifier(byteLength) {\n var buffer = new Uint8Array(byteLength)\n getCrypto().getRandomValues(buffer)\n var parts = []\n for (var i = 0; i < buffer.length; i += 1) {\n var hex = buffer[i].toString(16)\n parts.push(hex.length === 1 ? '0' + hex : hex)\n }\n return parts.join('')\n}\n\nexport function normalizeHexIdentifier(value, allowedLengths) {\n if (typeof value !== 'string') {\n return undefined\n }\n\n var normalized = value.toLowerCase()\n if (allowedLengths.indexOf(normalized.length) === -1) {\n return undefined\n }\n\n return /^[0-9a-f]+$/.test(normalized) ? normalized : undefined\n}\n"],"mappings":"AAAA,OAAO,SAASA,eAAeA,CAAA,EAAG;EAChC,IAAI,CAACC,MAAM,GAAG,IAAIC,UAAU,CAAC,CAAC,CAAC;EAC/BC,SAAS,CAAC,CAAC,CAACC,eAAe,CAAC,IAAI,CAACH,MAAM,CAAC;EACxC,IAAI,CAACA,MAAM,CAAC,CAAC,CAAC,GAAG,IAAI,CAACA,MAAM,CAAC,CAAC,CAAC,GAAG,IAAI;AACxC;AAEAD,eAAe,CAACK,SAAS,GAAG;EAC1B;EACAC,QAAQ,EAAE,SAAVA,QAAQA,CAAYC,KAAK,EAAE;IACzB,IAAIC,IAAI,GAAG,IAAI,CAACC,SAAS,CAAC,CAAC,CAAC;IAC5B,IAAIC,GAAG,GAAG,IAAI,CAACD,SAAS,CAAC,CAAC,CAAC;IAC3B,IAAIE,GAAG,GAAG,EAAE;IAEZ,GAAG;MACD,IAAIC,GAAG,GAAIJ,IAAI,GAAGD,KAAK,GAAI,UAAU,GAAGG,GAAG;MAC3CF,IAAI,GAAGK,IAAI,CAACC,KAAK,CAACN,IAAI,GAAGD,KAAK,CAAC;MAC/BG,GAAG,GAAGG,IAAI,CAACC,KAAK,CAACF,GAAG,GAAGL,KAAK,CAAC;MAC7BI,GAAG,GAAG,CAACC,GAAG,GAAGL,KAAK,EAAED,QAAQ,CAACC,KAAK,CAAC,GAAGI,GAAG;IAC3C,CAAC,QAAQH,IAAI,IAAIE,GAAG;IACpB,OAAOC,GAAG;EACZ,CAAC;EACD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K,CAAC,GAAG,GAAG,GAAGU,GAAG,GAAGA,GAAG,CAAC;EAChD;EACA,OAAOF,KAAK,CAACP,IAAI,CAAC,EAAE,CAAC;AACvB;AAEA,OAAO,SAASW,sBAAsBA,CAACC,KAAK,EAAEC,cAAc,EAAE;EAC5D,IAAI,OAAOD,KAAK,KAAK,QAAQ,EAAE;IAC7B,OAAOE,SAAS;EAClB;EAEA,IAAIC,UAAU,GAAGH,KAAK,CAACI,WAAW,CAAC,CAAC;EACpC,IAAIH,cAAc,CAACI,OAAO,CAACF,UAAU,CAAChB,MAAM,CAAC,KAAK,CAAC,CAAC,EAAE;IACpD,OAAOe,SAAS;EAClB;EAEA,OAAO,aAAa,CAACI,IAAI,CAACH,UAAU,CAAC,GAAGA,UAAU,GAAGD,SAAS;AAChE","ignoreList":[]}
|
|
@@ -1,17 +1,17 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { createRandomHexIdentifier, getCrypto, normalizeHexIdentifier } from './traceIdentifier';
|
|
2
2
|
import { getType } from '@cloudcare/browser-core';
|
|
3
3
|
/**
|
|
4
4
|
*
|
|
5
5
|
* @param {*} configuration
|
|
6
6
|
*/
|
|
7
7
|
export function ZipkinMultiTracer(configuration, traceSampled) {
|
|
8
|
-
this._traceId =
|
|
9
|
-
this._spanId =
|
|
8
|
+
this._traceId = configuration.traceId128Bit ? createRandomHexIdentifier(16) : createRandomHexIdentifier(8);
|
|
9
|
+
this._spanId = createRandomHexIdentifier(8);
|
|
10
10
|
this._traceSampled = traceSampled;
|
|
11
11
|
this.is128Bit = configuration.traceId128Bit;
|
|
12
12
|
if (configuration.generateTraceId && getType(configuration.generateTraceId) === 'function') {
|
|
13
|
-
var customTraceId = configuration.generateTraceId();
|
|
14
|
-
if (
|
|
13
|
+
var customTraceId = normalizeHexIdentifier(configuration.generateTraceId(), [16, 32]);
|
|
14
|
+
if (customTraceId) {
|
|
15
15
|
this.customTraceId = customTraceId;
|
|
16
16
|
}
|
|
17
17
|
}
|
|
@@ -21,13 +21,13 @@ ZipkinMultiTracer.prototype = {
|
|
|
21
21
|
return getCrypto() !== undefined;
|
|
22
22
|
},
|
|
23
23
|
getSpanId: function getSpanId() {
|
|
24
|
-
return this._spanId
|
|
24
|
+
return this._spanId;
|
|
25
25
|
},
|
|
26
26
|
getTraceId: function getTraceId() {
|
|
27
27
|
if (this.customTraceId) {
|
|
28
28
|
return this.customTraceId;
|
|
29
29
|
}
|
|
30
|
-
return this.
|
|
30
|
+
return this._traceId;
|
|
31
31
|
},
|
|
32
32
|
makeTracingHeaders: function makeTracingHeaders() {
|
|
33
33
|
return {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"zipkinMultiTracer.js","names":["
|
|
1
|
+
{"version":3,"file":"zipkinMultiTracer.js","names":["createRandomHexIdentifier","getCrypto","normalizeHexIdentifier","getType","ZipkinMultiTracer","configuration","traceSampled","_traceId","traceId128Bit","_spanId","_traceSampled","is128Bit","generateTraceId","customTraceId","prototype","isTracingSupported","undefined","getSpanId","getTraceId","makeTracingHeaders"],"sources":["../../../src/domain/tracing/zipkinMultiTracer.js"],"sourcesContent":["import {\n createRandomHexIdentifier,\n getCrypto,\n normalizeHexIdentifier\n} from './traceIdentifier'\nimport { getType } from '@cloudcare/browser-core'\n/**\n *\n * @param {*} configuration\n */\nexport function ZipkinMultiTracer(configuration, traceSampled) {\n this._traceId = configuration.traceId128Bit\n ? createRandomHexIdentifier(16)\n : createRandomHexIdentifier(8)\n this._spanId = createRandomHexIdentifier(8)\n this._traceSampled = traceSampled\n this.is128Bit = configuration.traceId128Bit\n if (\n configuration.generateTraceId &&\n getType(configuration.generateTraceId) === 'function'\n ) {\n const customTraceId = normalizeHexIdentifier(\n configuration.generateTraceId(),\n [16, 32]\n )\n if (customTraceId) {\n this.customTraceId = customTraceId\n }\n }\n}\nZipkinMultiTracer.prototype = {\n isTracingSupported: function () {\n return getCrypto() !== undefined\n },\n getSpanId: function () {\n return this._spanId\n },\n getTraceId: function () {\n if (this.customTraceId) {\n return this.customTraceId\n }\n return this._traceId\n },\n\n makeTracingHeaders: function () {\n return {\n 'X-B3-TraceId': this.getTraceId(),\n 'X-B3-SpanId': this.getSpanId(),\n // 'X-B3-ParentSpanId': '',\n 'X-B3-Sampled': this._traceSampled ? '1' : '0'\n // 'X-B3-Flags': '0'\n }\n }\n}\n"],"mappings":"AAAA,SACEA,yBAAyB,EACzBC,SAAS,EACTC,sBAAsB,QACjB,mBAAmB;AAC1B,SAASC,OAAO,QAAQ,yBAAyB;AACjD;AACA;AACA;AACA;AACA,OAAO,SAASC,iBAAiBA,CAACC,aAAa,EAAEC,YAAY,EAAE;EAC7D,IAAI,CAACC,QAAQ,GAAGF,aAAa,CAACG,aAAa,GACvCR,yBAAyB,CAAC,EAAE,CAAC,GAC7BA,yBAAyB,CAAC,CAAC,CAAC;EAChC,IAAI,CAACS,OAAO,GAAGT,yBAAyB,CAAC,CAAC,CAAC;EAC3C,IAAI,CAACU,aAAa,GAAGJ,YAAY;EACjC,IAAI,CAACK,QAAQ,GAAGN,aAAa,CAACG,aAAa;EAC3C,IACEH,aAAa,CAACO,eAAe,IAC7BT,OAAO,CAACE,aAAa,CAACO,eAAe,CAAC,KAAK,UAAU,EACrD;IACA,IAAMC,aAAa,GAAGX,sBAAsB,CAC1CG,aAAa,CAACO,eAAe,CAAC,CAAC,EAC/B,CAAC,EAAE,EAAE,EAAE,CACT,CAAC;IACD,IAAIC,aAAa,EAAE;MACjB,IAAI,CAACA,aAAa,GAAGA,aAAa;IACpC;EACF;AACF;AACAT,iBAAiB,CAACU,SAAS,GAAG;EAC5BC,kBAAkB,EAAE,SAApBA,kBAAkBA,CAAA,EAAc;IAC9B,OAAOd,SAAS,CAAC,CAAC,KAAKe,SAAS;EAClC,CAAC;EACDC,SAAS,EAAE,SAAXA,SAASA,CAAA,EAAc;IACrB,OAAO,IAAI,CAACR,OAAO;EACrB,CAAC;EACDS,UAAU,EAAE,SAAZA,UAAUA,CAAA,EAAc;IACtB,IAAI,IAAI,CAACL,aAAa,EAAE;MACtB,OAAO,IAAI,CAACA,aAAa;IAC3B;IACA,OAAO,IAAI,CAACN,QAAQ;EACtB,CAAC;EAEDY,kBAAkB,EAAE,SAApBA,kBAAkBA,CAAA,EAAc;IAC9B,OAAO;MACL,cAAc,EAAE,IAAI,CAACD,UAAU,CAAC,CAAC;MACjC,aAAa,EAAE,IAAI,CAACD,SAAS,CAAC,CAAC;MAC/B;MACA,cAAc,EAAE,IAAI,CAACP,aAAa,GAAG,GAAG,GAAG;MAC3C;IACF,CAAC;EACH;AACF,CAAC","ignoreList":[]}
|
|
@@ -1,16 +1,16 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { createRandomHexIdentifier, getCrypto, normalizeHexIdentifier } from './traceIdentifier';
|
|
2
2
|
import { getType } from '@cloudcare/browser-core';
|
|
3
3
|
/**
|
|
4
4
|
*
|
|
5
5
|
* @param {*} configuration
|
|
6
6
|
*/
|
|
7
7
|
export function ZipkinSingleTracer(configuration, traceSampled) {
|
|
8
|
-
this._traceId =
|
|
9
|
-
this._spanId =
|
|
8
|
+
this._traceId = createRandomHexIdentifier(8);
|
|
9
|
+
this._spanId = createRandomHexIdentifier(8);
|
|
10
10
|
this._traceSampled = traceSampled;
|
|
11
11
|
if (configuration.generateTraceId && getType(configuration.generateTraceId) === 'function') {
|
|
12
|
-
var customTraceId = configuration.generateTraceId();
|
|
13
|
-
if (
|
|
12
|
+
var customTraceId = normalizeHexIdentifier(configuration.generateTraceId(), [16, 32]);
|
|
13
|
+
if (customTraceId) {
|
|
14
14
|
this.customTraceId = customTraceId;
|
|
15
15
|
}
|
|
16
16
|
}
|
|
@@ -20,13 +20,13 @@ ZipkinSingleTracer.prototype = {
|
|
|
20
20
|
return getCrypto() !== undefined;
|
|
21
21
|
},
|
|
22
22
|
getSpanId: function getSpanId() {
|
|
23
|
-
return this._spanId
|
|
23
|
+
return this._spanId;
|
|
24
24
|
},
|
|
25
25
|
getTraceId: function getTraceId() {
|
|
26
26
|
if (this.customTraceId) {
|
|
27
27
|
return this.customTraceId;
|
|
28
28
|
}
|
|
29
|
-
return this._traceId
|
|
29
|
+
return this._traceId;
|
|
30
30
|
},
|
|
31
31
|
getB3Str: function getB3Str() {
|
|
32
32
|
//{TraceId}-{SpanId}-{SamplingState}-{ParentSpanId}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"zipkinSingleTracer.js","names":["
|
|
1
|
+
{"version":3,"file":"zipkinSingleTracer.js","names":["createRandomHexIdentifier","getCrypto","normalizeHexIdentifier","getType","ZipkinSingleTracer","configuration","traceSampled","_traceId","_spanId","_traceSampled","generateTraceId","customTraceId","prototype","isTracingSupported","undefined","getSpanId","getTraceId","getB3Str","makeTracingHeaders","b3"],"sources":["../../../src/domain/tracing/zipkinSingleTracer.js"],"sourcesContent":["import {\n createRandomHexIdentifier,\n getCrypto,\n normalizeHexIdentifier\n} from './traceIdentifier'\nimport { getType } from '@cloudcare/browser-core'\n/**\n *\n * @param {*} configuration\n */\nexport function ZipkinSingleTracer(configuration, traceSampled) {\n this._traceId = createRandomHexIdentifier(8)\n this._spanId = createRandomHexIdentifier(8)\n this._traceSampled = traceSampled\n if (\n configuration.generateTraceId &&\n getType(configuration.generateTraceId) === 'function'\n ) {\n const customTraceId = normalizeHexIdentifier(\n configuration.generateTraceId(),\n [16, 32]\n )\n if (customTraceId) {\n this.customTraceId = customTraceId\n }\n }\n}\nZipkinSingleTracer.prototype = {\n isTracingSupported: function () {\n return getCrypto() !== undefined\n },\n getSpanId: function () {\n return this._spanId\n },\n getTraceId: function () {\n if (this.customTraceId) {\n return this.customTraceId\n }\n return this._traceId\n },\n getB3Str: function () {\n //{TraceId}-{SpanId}-{SamplingState}-{ParentSpanId}\n return (\n this.getTraceId() +\n '-' +\n this.getSpanId() +\n '-' +\n (this._traceSampled ? '1' : '0')\n )\n },\n makeTracingHeaders: function () {\n return {\n b3: this.getB3Str()\n }\n }\n}\n"],"mappings":"AAAA,SACEA,yBAAyB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A,kBAAkBA,CAAA,EAAc;IAC9B,OAAO;MACLC,EAAE,EAAE,IAAI,CAACF,QAAQ,CAAC;IACpB,CAAC;EACH;AACF,CAAC","ignoreList":[]}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@cloudcare/browser-rum",
|
|
3
|
-
"version": "3.3.
|
|
3
|
+
"version": "3.3.1",
|
|
4
4
|
"main": "cjs/index.js",
|
|
5
5
|
"module": "esm/index.js",
|
|
6
6
|
"types": "types/index.d.ts",
|
|
@@ -36,5 +36,5 @@
|
|
|
36
36
|
"author": "dataflux",
|
|
37
37
|
"license": "MIT",
|
|
38
38
|
"homepage": "https://github.com/GuanceCloud/datakit-js/README.md",
|
|
39
|
-
"gitHead": "
|
|
39
|
+
"gitHead": "e939575b77d81a7a981c1753b0013272eab90a6a"
|
|
40
40
|
}
|
package/src/boot/recorderApi.js
CHANGED
|
@@ -58,6 +58,12 @@ export function makeRecorderApi(startRecordingImpl, createDeflateWorkerImpl) {
|
|
|
58
58
|
getCanvasMutationHistoryForDebug: function () {
|
|
59
59
|
return undefined
|
|
60
60
|
},
|
|
61
|
+
getLastDomMutationForDebug: function () {
|
|
62
|
+
return undefined
|
|
63
|
+
},
|
|
64
|
+
getDomMutationHistoryForDebug: function () {
|
|
65
|
+
return undefined
|
|
66
|
+
},
|
|
61
67
|
getLastReplaySegmentFlushForDebug: function () {
|
|
62
68
|
return undefined
|
|
63
69
|
},
|
|
@@ -67,6 +73,7 @@ export function makeRecorderApi(startRecordingImpl, createDeflateWorkerImpl) {
|
|
|
67
73
|
getReplayPerformanceForDebug: function () {
|
|
68
74
|
return undefined
|
|
69
75
|
},
|
|
76
|
+
flushReplayMutationsForDebug: noop,
|
|
70
77
|
getReplayStats: function () {
|
|
71
78
|
return undefined
|
|
72
79
|
},
|
|
@@ -109,6 +116,12 @@ export function makeRecorderApi(startRecordingImpl, createDeflateWorkerImpl) {
|
|
|
109
116
|
var getCanvasMutationHistoryForDebug = function () {
|
|
110
117
|
return undefined
|
|
111
118
|
}
|
|
119
|
+
var getLastDomMutationForDebug = function () {
|
|
120
|
+
return undefined
|
|
121
|
+
}
|
|
122
|
+
var getDomMutationHistoryForDebug = function () {
|
|
123
|
+
return undefined
|
|
124
|
+
}
|
|
112
125
|
var getLastReplaySegmentFlushForDebug = function () {
|
|
113
126
|
return undefined
|
|
114
127
|
}
|
|
@@ -118,6 +131,7 @@ export function makeRecorderApi(startRecordingImpl, createDeflateWorkerImpl) {
|
|
|
118
131
|
var getReplayPerformanceForDebug = function () {
|
|
119
132
|
return undefined
|
|
120
133
|
}
|
|
134
|
+
var flushReplayMutationsForDebug = noop
|
|
121
135
|
return {
|
|
122
136
|
start: function (options) {
|
|
123
137
|
startStrategy(options)
|
|
@@ -226,12 +240,18 @@ export function makeRecorderApi(startRecordingImpl, createDeflateWorkerImpl) {
|
|
|
226
240
|
recordingImpl.getLastCanvasMutationForDebug || noop,
|
|
227
241
|
getCanvasMutationHistoryForDebug:
|
|
228
242
|
recordingImpl.getCanvasMutationHistoryForDebug || noop,
|
|
243
|
+
getLastDomMutationForDebug:
|
|
244
|
+
recordingImpl.getLastDomMutationForDebug || noop,
|
|
245
|
+
getDomMutationHistoryForDebug:
|
|
246
|
+
recordingImpl.getDomMutationHistoryForDebug || noop,
|
|
229
247
|
getLastReplaySegmentFlushForDebug:
|
|
230
248
|
recordingImpl.getLastReplaySegmentFlushForDebug || noop,
|
|
231
249
|
getReplaySegmentFlushHistoryForDebug:
|
|
232
250
|
recordingImpl.getReplaySegmentFlushHistoryForDebug || noop,
|
|
233
251
|
getReplayPerformanceForDebug:
|
|
234
|
-
recordingImpl.getReplayPerformanceForDebug || noop
|
|
252
|
+
recordingImpl.getReplayPerformanceForDebug || noop,
|
|
253
|
+
flushReplayMutationsForDebug:
|
|
254
|
+
recordingImpl.flushReplayMutationsForDebug || noop
|
|
235
255
|
}
|
|
236
256
|
})
|
|
237
257
|
}
|
|
@@ -291,6 +311,18 @@ export function makeRecorderApi(startRecordingImpl, createDeflateWorkerImpl) {
|
|
|
291
311
|
}
|
|
292
312
|
return undefined
|
|
293
313
|
}
|
|
314
|
+
getLastDomMutationForDebug = function () {
|
|
315
|
+
if (state.status === RecorderStatus.Started) {
|
|
316
|
+
return state.getLastDomMutationForDebug()
|
|
317
|
+
}
|
|
318
|
+
return undefined
|
|
319
|
+
}
|
|
320
|
+
getDomMutationHistoryForDebug = function () {
|
|
321
|
+
if (state.status === RecorderStatus.Started) {
|
|
322
|
+
return state.getDomMutationHistoryForDebug()
|
|
323
|
+
}
|
|
324
|
+
return undefined
|
|
325
|
+
}
|
|
294
326
|
getLastReplaySegmentFlushForDebug = function () {
|
|
295
327
|
if (state.status === RecorderStatus.Started) {
|
|
296
328
|
return state.getLastReplaySegmentFlushForDebug()
|
|
@@ -309,6 +341,11 @@ export function makeRecorderApi(startRecordingImpl, createDeflateWorkerImpl) {
|
|
|
309
341
|
}
|
|
310
342
|
return undefined
|
|
311
343
|
}
|
|
344
|
+
flushReplayMutationsForDebug = function () {
|
|
345
|
+
if (state.status === RecorderStatus.Started) {
|
|
346
|
+
state.flushReplayMutationsForDebug()
|
|
347
|
+
}
|
|
348
|
+
}
|
|
312
349
|
if (state.status === RecorderStatus.IntentToStart) {
|
|
313
350
|
startStrategy()
|
|
314
351
|
}
|
|
@@ -337,12 +374,21 @@ export function makeRecorderApi(startRecordingImpl, createDeflateWorkerImpl) {
|
|
|
337
374
|
getCanvasMutationHistoryForDebug: function () {
|
|
338
375
|
return getCanvasMutationHistoryForDebug()
|
|
339
376
|
},
|
|
377
|
+
getLastDomMutationForDebug: function () {
|
|
378
|
+
return getLastDomMutationForDebug()
|
|
379
|
+
},
|
|
380
|
+
getDomMutationHistoryForDebug: function () {
|
|
381
|
+
return getDomMutationHistoryForDebug()
|
|
382
|
+
},
|
|
340
383
|
getReplaySegmentFlushHistoryForDebug: function () {
|
|
341
384
|
return getReplaySegmentFlushHistoryForDebug()
|
|
342
385
|
},
|
|
343
386
|
getReplayPerformanceForDebug: function () {
|
|
344
387
|
return getReplayPerformanceForDebug()
|
|
345
388
|
},
|
|
389
|
+
flushReplayMutationsForDebug: function () {
|
|
390
|
+
flushReplayMutationsForDebug()
|
|
391
|
+
},
|
|
346
392
|
isRecording: function () {
|
|
347
393
|
return (
|
|
348
394
|
getDeflateWorkerStatus() === DeflateWorkerStatus.Initialized &&
|
package/src/boot/rumPublicApi.js
CHANGED
|
@@ -316,6 +316,12 @@ export function makeRumPublicApi(startRumImpl, recorderApi, options) {
|
|
|
316
316
|
getCanvasMutationHistoryForDebug: monitor(function () {
|
|
317
317
|
return recorderApi.getCanvasMutationHistoryForDebug()
|
|
318
318
|
}),
|
|
319
|
+
getLastDomMutationForDebug: monitor(function () {
|
|
320
|
+
return recorderApi.getLastDomMutationForDebug()
|
|
321
|
+
}),
|
|
322
|
+
getDomMutationHistoryForDebug: monitor(function () {
|
|
323
|
+
return recorderApi.getDomMutationHistoryForDebug()
|
|
324
|
+
}),
|
|
319
325
|
getLastReplaySegmentFlushForDebug: monitor(function () {
|
|
320
326
|
return recorderApi.getLastReplaySegmentFlushForDebug()
|
|
321
327
|
}),
|
|
@@ -325,6 +331,11 @@ export function makeRumPublicApi(startRumImpl, recorderApi, options) {
|
|
|
325
331
|
getReplayPerformanceForDebug: monitor(function () {
|
|
326
332
|
return recorderApi.getReplayPerformanceForDebug()
|
|
327
333
|
}),
|
|
334
|
+
flushReplayMutationsForDebug: monitor(function () {
|
|
335
|
+
if (recorderApi.flushReplayMutationsForDebug) {
|
|
336
|
+
recorderApi.flushReplayMutationsForDebug()
|
|
337
|
+
}
|
|
338
|
+
}),
|
|
328
339
|
createResourceTrackerId: monitor(function () {
|
|
329
340
|
return resourceTrackerManager.createTrackerId()
|
|
330
341
|
}),
|
|
@@ -137,6 +137,8 @@ export function startRecording(
|
|
|
137
137
|
var getLastCanvasMutationForDebug = _record.getLastCanvasMutationForDebug
|
|
138
138
|
var getCanvasMutationHistoryForDebug =
|
|
139
139
|
_record.getCanvasMutationHistoryForDebug
|
|
140
|
+
var getLastDomMutationForDebug = _record.getLastDomMutationForDebug
|
|
141
|
+
var getDomMutationHistoryForDebug = _record.getDomMutationHistoryForDebug
|
|
140
142
|
var getReplayPerformanceForDebug = function () {
|
|
141
143
|
return cloneReplayPerformanceForDebug(
|
|
142
144
|
_record.getReplayPerformanceForDebug
|
|
@@ -188,10 +190,13 @@ export function startRecording(
|
|
|
188
190
|
getAutoCanvasSnapshotDebugHistoryForDebug,
|
|
189
191
|
getLastCanvasMutationForDebug: getLastCanvasMutationForDebug,
|
|
190
192
|
getCanvasMutationHistoryForDebug: getCanvasMutationHistoryForDebug,
|
|
193
|
+
getLastDomMutationForDebug: getLastDomMutationForDebug,
|
|
194
|
+
getDomMutationHistoryForDebug: getDomMutationHistoryForDebug,
|
|
191
195
|
getLastReplaySegmentFlushForDebug: getLastReplaySegmentFlushForDebug,
|
|
192
196
|
getReplaySegmentFlushHistoryForDebug:
|
|
193
197
|
getReplaySegmentFlushHistoryForDebug,
|
|
194
|
-
getReplayPerformanceForDebug: getReplayPerformanceForDebug
|
|
198
|
+
getReplayPerformanceForDebug: getReplayPerformanceForDebug,
|
|
199
|
+
flushReplayMutationsForDebug: flushMutations
|
|
195
200
|
}
|
|
196
201
|
}
|
|
197
202
|
|
|
@@ -589,6 +589,11 @@ function createMutationTasksController(
|
|
|
589
589
|
}
|
|
590
590
|
|
|
591
591
|
var parentNode = getParentNode(task.rootNode)
|
|
592
|
+
var parentPendingRootTask = findPendingRootTask(parentNode)
|
|
593
|
+
if (parentPendingRootTask && parentPendingRootTask !== task) {
|
|
594
|
+
cancelPendingRootTask(task)
|
|
595
|
+
return
|
|
596
|
+
}
|
|
592
597
|
var parentNodePrivacyLevel = getNodePrivacyLevel(
|
|
593
598
|
parentNode,
|
|
594
599
|
configuration.defaultPrivacyLevel
|
|
@@ -625,7 +630,15 @@ function createMutationTasksController(
|
|
|
625
630
|
if (!task || task.generation !== generation) {
|
|
626
631
|
return
|
|
627
632
|
}
|
|
628
|
-
if (node === task.rootNode
|
|
633
|
+
if (node === task.rootNode) {
|
|
634
|
+
if (task.rootNode.isConnected) {
|
|
635
|
+
refreshPendingRootTask(task)
|
|
636
|
+
return
|
|
637
|
+
}
|
|
638
|
+
cancelPendingRootTask(task)
|
|
639
|
+
return
|
|
640
|
+
}
|
|
641
|
+
if (!task.rootNode.isConnected) {
|
|
629
642
|
cancelPendingRootTask(task)
|
|
630
643
|
return
|
|
631
644
|
}
|
|
@@ -119,6 +119,11 @@ function flushPendingMutations() {
|
|
|
119
119
|
)
|
|
120
120
|
)
|
|
121
121
|
mutationPayloads.forEach(function (mutationPayload) {
|
|
122
|
+
lastDomMutationForDebug = cloneDomMutationDebugResult(mutationPayload)
|
|
123
|
+
pushCanvasDebugHistoryEntry(
|
|
124
|
+
domMutationHistoryForDebug,
|
|
125
|
+
lastDomMutationForDebug
|
|
126
|
+
)
|
|
122
127
|
emit(
|
|
123
128
|
assembleIncrementalSnapshot(IncrementalSource.Mutation, mutationPayload)
|
|
124
129
|
)
|
|
@@ -136,6 +141,8 @@ function flushPendingMutations() {
|
|
|
136
141
|
var autoCanvasSnapshotDebugHistoryForDebug = []
|
|
137
142
|
var lastCanvasMutationForDebug
|
|
138
143
|
var canvasMutationHistoryForDebug = []
|
|
144
|
+
var lastDomMutationForDebug
|
|
145
|
+
var domMutationHistoryForDebug = []
|
|
139
146
|
var shouldUseCanvasCommandCapture = shouldUseCommandCapture(
|
|
140
147
|
options.configuration
|
|
141
148
|
)
|
|
@@ -381,6 +388,12 @@ function flushPendingMutations() {
|
|
|
381
388
|
getCanvasMutationHistoryForDebug: function () {
|
|
382
389
|
return canvasMutationHistoryForDebug.map(cloneCanvasMutationDebugResult)
|
|
383
390
|
},
|
|
391
|
+
getLastDomMutationForDebug: function () {
|
|
392
|
+
return cloneDomMutationDebugResult(lastDomMutationForDebug)
|
|
393
|
+
},
|
|
394
|
+
getDomMutationHistoryForDebug: function () {
|
|
395
|
+
return domMutationHistoryForDebug.map(cloneDomMutationDebugResult)
|
|
396
|
+
},
|
|
384
397
|
getReplayPerformanceForDebug: function () {
|
|
385
398
|
return cloneReplayPerformanceStats(replayPerformanceStats)
|
|
386
399
|
},
|
|
@@ -812,3 +825,36 @@ function cloneCanvasMutationDebugResult(result) {
|
|
|
812
825
|
|
|
813
826
|
return clonedResult
|
|
814
827
|
}
|
|
828
|
+
|
|
829
|
+
function cloneDomMutationDebugResult(result) {
|
|
830
|
+
if (!result) {
|
|
831
|
+
return result
|
|
832
|
+
}
|
|
833
|
+
|
|
834
|
+
return {
|
|
835
|
+
timestamp:
|
|
836
|
+
typeof result.timestamp === 'number' ? result.timestamp : timeStampNow(),
|
|
837
|
+
adds: (result.adds || []).map(cloneDebugValue),
|
|
838
|
+
removes: (result.removes || []).map(cloneDebugValue),
|
|
839
|
+
texts: (result.texts || []).map(cloneDebugValue),
|
|
840
|
+
attributes: (result.attributes || []).map(cloneDebugValue),
|
|
841
|
+
addsCount: (result.adds || []).length,
|
|
842
|
+
removesCount: (result.removes || []).length,
|
|
843
|
+
textsCount: (result.texts || []).length,
|
|
844
|
+
attributesCount: (result.attributes || []).length
|
|
845
|
+
}
|
|
846
|
+
}
|
|
847
|
+
|
|
848
|
+
function cloneDebugValue(value) {
|
|
849
|
+
if (!value || typeof value !== 'object') {
|
|
850
|
+
return value
|
|
851
|
+
}
|
|
852
|
+
if (Array.isArray(value)) {
|
|
853
|
+
return value.map(cloneDebugValue)
|
|
854
|
+
}
|
|
855
|
+
|
|
856
|
+
return Object.keys(value).reduce(function (accumulator, key) {
|
|
857
|
+
accumulator[key] = cloneDebugValue(value[key])
|
|
858
|
+
return accumulator
|
|
859
|
+
}, {})
|
|
860
|
+
}
|
|
@@ -1,20 +1,29 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import {
|
|
2
|
+
createRandomHexIdentifier,
|
|
3
|
+
getCrypto,
|
|
4
|
+
normalizeHexIdentifier
|
|
5
|
+
} from './traceIdentifier'
|
|
2
6
|
import { getType } from '@cloudcare/browser-core'
|
|
3
7
|
/**
|
|
4
8
|
*
|
|
5
9
|
* @param {*} configuration
|
|
6
10
|
*/
|
|
7
11
|
export function JaegerTracer(configuration, traceSampled) {
|
|
8
|
-
this._traceId =
|
|
9
|
-
|
|
12
|
+
this._traceId = configuration.traceId128Bit
|
|
13
|
+
? createRandomHexIdentifier(16)
|
|
14
|
+
: createRandomHexIdentifier(8)
|
|
15
|
+
this._spanId = createRandomHexIdentifier(8)
|
|
10
16
|
this._traceSampled = traceSampled
|
|
11
17
|
this.is128Bit = configuration.traceId128Bit
|
|
12
18
|
if (
|
|
13
19
|
configuration.generateTraceId &&
|
|
14
20
|
getType(configuration.generateTraceId) === 'function'
|
|
15
21
|
) {
|
|
16
|
-
const customTraceId =
|
|
17
|
-
|
|
22
|
+
const customTraceId = normalizeHexIdentifier(
|
|
23
|
+
configuration.generateTraceId(),
|
|
24
|
+
[16, 32]
|
|
25
|
+
)
|
|
26
|
+
if (customTraceId) {
|
|
18
27
|
this.customTraceId = customTraceId
|
|
19
28
|
}
|
|
20
29
|
}
|
|
@@ -24,15 +33,13 @@ JaegerTracer.prototype = {
|
|
|
24
33
|
return getCrypto() !== undefined
|
|
25
34
|
},
|
|
26
35
|
getSpanId: function () {
|
|
27
|
-
return this._spanId
|
|
36
|
+
return this._spanId
|
|
28
37
|
},
|
|
29
38
|
getTraceId: function () {
|
|
30
39
|
if (this.customTraceId) {
|
|
31
40
|
return this.customTraceId
|
|
32
41
|
}
|
|
33
|
-
return this.
|
|
34
|
-
? '0000000000000000' + this._traceId.toPaddedHexadecimalString()
|
|
35
|
-
: this._traceId.toPaddedHexadecimalString()
|
|
42
|
+
return this._traceId
|
|
36
43
|
},
|
|
37
44
|
getUberTraceId: function () {
|
|
38
45
|
//{trace-id}:{span-id}:{parent-span-id}:{flags}
|
|
@@ -41,3 +41,27 @@ TraceIdentifier.prototype = {
|
|
|
41
41
|
export function getCrypto() {
|
|
42
42
|
return window.crypto || window.msCrypto
|
|
43
43
|
}
|
|
44
|
+
|
|
45
|
+
export function createRandomHexIdentifier(byteLength) {
|
|
46
|
+
var buffer = new Uint8Array(byteLength)
|
|
47
|
+
getCrypto().getRandomValues(buffer)
|
|
48
|
+
var parts = []
|
|
49
|
+
for (var i = 0; i < buffer.length; i += 1) {
|
|
50
|
+
var hex = buffer[i].toString(16)
|
|
51
|
+
parts.push(hex.length === 1 ? '0' + hex : hex)
|
|
52
|
+
}
|
|
53
|
+
return parts.join('')
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
export function normalizeHexIdentifier(value, allowedLengths) {
|
|
57
|
+
if (typeof value !== 'string') {
|
|
58
|
+
return undefined
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
var normalized = value.toLowerCase()
|
|
62
|
+
if (allowedLengths.indexOf(normalized.length) === -1) {
|
|
63
|
+
return undefined
|
|
64
|
+
}
|
|
65
|
+
|
|
66
|
+
return /^[0-9a-f]+$/.test(normalized) ? normalized : undefined
|
|
67
|
+
}
|
|
@@ -1,20 +1,29 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import {
|
|
2
|
+
createRandomHexIdentifier,
|
|
3
|
+
getCrypto,
|
|
4
|
+
normalizeHexIdentifier
|
|
5
|
+
} from './traceIdentifier'
|
|
2
6
|
import { getType } from '@cloudcare/browser-core'
|
|
3
7
|
/**
|
|
4
8
|
*
|
|
5
9
|
* @param {*} configuration
|
|
6
10
|
*/
|
|
7
11
|
export function ZipkinMultiTracer(configuration, traceSampled) {
|
|
8
|
-
this._traceId =
|
|
9
|
-
|
|
12
|
+
this._traceId = configuration.traceId128Bit
|
|
13
|
+
? createRandomHexIdentifier(16)
|
|
14
|
+
: createRandomHexIdentifier(8)
|
|
15
|
+
this._spanId = createRandomHexIdentifier(8)
|
|
10
16
|
this._traceSampled = traceSampled
|
|
11
17
|
this.is128Bit = configuration.traceId128Bit
|
|
12
18
|
if (
|
|
13
19
|
configuration.generateTraceId &&
|
|
14
20
|
getType(configuration.generateTraceId) === 'function'
|
|
15
21
|
) {
|
|
16
|
-
const customTraceId =
|
|
17
|
-
|
|
22
|
+
const customTraceId = normalizeHexIdentifier(
|
|
23
|
+
configuration.generateTraceId(),
|
|
24
|
+
[16, 32]
|
|
25
|
+
)
|
|
26
|
+
if (customTraceId) {
|
|
18
27
|
this.customTraceId = customTraceId
|
|
19
28
|
}
|
|
20
29
|
}
|
|
@@ -24,15 +33,13 @@ ZipkinMultiTracer.prototype = {
|
|
|
24
33
|
return getCrypto() !== undefined
|
|
25
34
|
},
|
|
26
35
|
getSpanId: function () {
|
|
27
|
-
return this._spanId
|
|
36
|
+
return this._spanId
|
|
28
37
|
},
|
|
29
38
|
getTraceId: function () {
|
|
30
39
|
if (this.customTraceId) {
|
|
31
40
|
return this.customTraceId
|
|
32
41
|
}
|
|
33
|
-
return this.
|
|
34
|
-
? '0000000000000000' + this._traceId.toPaddedHexadecimalString()
|
|
35
|
-
: this._traceId.toPaddedHexadecimalString()
|
|
42
|
+
return this._traceId
|
|
36
43
|
},
|
|
37
44
|
|
|
38
45
|
makeTracingHeaders: function () {
|
|
@@ -1,19 +1,26 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import {
|
|
2
|
+
createRandomHexIdentifier,
|
|
3
|
+
getCrypto,
|
|
4
|
+
normalizeHexIdentifier
|
|
5
|
+
} from './traceIdentifier'
|
|
2
6
|
import { getType } from '@cloudcare/browser-core'
|
|
3
7
|
/**
|
|
4
8
|
*
|
|
5
9
|
* @param {*} configuration
|
|
6
10
|
*/
|
|
7
11
|
export function ZipkinSingleTracer(configuration, traceSampled) {
|
|
8
|
-
this._traceId =
|
|
9
|
-
this._spanId =
|
|
12
|
+
this._traceId = createRandomHexIdentifier(8)
|
|
13
|
+
this._spanId = createRandomHexIdentifier(8)
|
|
10
14
|
this._traceSampled = traceSampled
|
|
11
15
|
if (
|
|
12
16
|
configuration.generateTraceId &&
|
|
13
17
|
getType(configuration.generateTraceId) === 'function'
|
|
14
18
|
) {
|
|
15
|
-
const customTraceId =
|
|
16
|
-
|
|
19
|
+
const customTraceId = normalizeHexIdentifier(
|
|
20
|
+
configuration.generateTraceId(),
|
|
21
|
+
[16, 32]
|
|
22
|
+
)
|
|
23
|
+
if (customTraceId) {
|
|
17
24
|
this.customTraceId = customTraceId
|
|
18
25
|
}
|
|
19
26
|
}
|
|
@@ -23,13 +30,13 @@ ZipkinSingleTracer.prototype = {
|
|
|
23
30
|
return getCrypto() !== undefined
|
|
24
31
|
},
|
|
25
32
|
getSpanId: function () {
|
|
26
|
-
return this._spanId
|
|
33
|
+
return this._spanId
|
|
27
34
|
},
|
|
28
35
|
getTraceId: function () {
|
|
29
36
|
if (this.customTraceId) {
|
|
30
37
|
return this.customTraceId
|
|
31
38
|
}
|
|
32
|
-
return this._traceId
|
|
39
|
+
return this._traceId
|
|
33
40
|
},
|
|
34
41
|
getB3Str: function () {
|
|
35
42
|
//{TraceId}-{SpanId}-{SamplingState}-{ParentSpanId}
|