@cloudcare/browser-rum 3.3.0 → 3.3.3
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/perStartRum.js +11 -7
- package/cjs/boot/perStartRum.js.map +1 -1
- package/cjs/boot/recorderApi.js +39 -43
- package/cjs/boot/recorderApi.js.map +1 -1
- package/cjs/boot/recorderApiStub.js +53 -0
- package/cjs/boot/recorderApiStub.js.map +1 -0
- package/cjs/boot/rum.entry.js +6 -7
- package/cjs/boot/rum.entry.js.map +1 -1
- package/cjs/boot/rum.slim.entry.js +13 -0
- package/cjs/boot/rum.slim.entry.js.map +1 -0
- package/cjs/boot/rumEntryFactory.js +15 -0
- package/cjs/boot/rumEntryFactory.js.map +1 -0
- package/cjs/boot/rumPublicApi.js +8 -46
- package/cjs/boot/rumPublicApi.js.map +1 -1
- package/cjs/boot/rumRecorderApiStub.js +19 -0
- package/cjs/boot/rumRecorderApiStub.js.map +1 -0
- package/cjs/boot/rumSlimConfiguration.js +16 -0
- package/cjs/boot/rumSlimConfiguration.js.map +1 -0
- package/cjs/boot/sessionReplayPublicApi.js +62 -0
- package/cjs/boot/sessionReplayPublicApi.js.map +1 -0
- package/cjs/boot/startRecording.js +6 -1
- package/cjs/boot/startRecording.js.map +1 -1
- package/cjs/domain/deflate/deflateEncoder.js +2 -4
- package/cjs/domain/deflate/deflateEncoder.js.map +1 -1
- package/cjs/domain/deflate/deflateWorker.js +1 -1
- package/cjs/domain/encoderStreamId.js +11 -0
- package/cjs/domain/encoderStreamId.js.map +1 -0
- 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/cjs/transport/startRumBatch.js +2 -2
- package/cjs/transport/startRumBatch.js.map +1 -1
- package/esm/boot/buildEnv.js +1 -1
- package/esm/boot/perStartRum.js +11 -7
- package/esm/boot/perStartRum.js.map +1 -1
- package/esm/boot/recorderApi.js +39 -43
- package/esm/boot/recorderApi.js.map +1 -1
- package/esm/boot/recorderApiStub.js +47 -0
- package/esm/boot/recorderApiStub.js.map +1 -0
- package/esm/boot/rum.entry.js +6 -7
- package/esm/boot/rum.entry.js.map +1 -1
- package/esm/boot/rum.slim.entry.js +7 -0
- package/esm/boot/rum.slim.entry.js.map +1 -0
- package/esm/boot/rumEntryFactory.js +9 -0
- package/esm/boot/rumEntryFactory.js.map +1 -0
- package/esm/boot/rumPublicApi.js +8 -46
- package/esm/boot/rumPublicApi.js.map +1 -1
- package/esm/boot/rumRecorderApiStub.js +13 -0
- package/esm/boot/rumRecorderApiStub.js.map +1 -0
- package/esm/boot/rumSlimConfiguration.js +10 -0
- package/esm/boot/rumSlimConfiguration.js.map +1 -0
- package/esm/boot/sessionReplayPublicApi.js +56 -0
- package/esm/boot/sessionReplayPublicApi.js.map +1 -0
- package/esm/boot/startRecording.js +6 -1
- package/esm/boot/startRecording.js.map +1 -1
- package/esm/domain/deflate/deflateEncoder.js +2 -4
- package/esm/domain/deflate/deflateEncoder.js.map +1 -1
- package/esm/domain/deflate/deflateWorker.js +1 -1
- package/esm/domain/encoderStreamId.js +5 -0
- package/esm/domain/encoderStreamId.js.map +1 -0
- 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/esm/transport/startRumBatch.js +2 -2
- package/esm/transport/startRumBatch.js.map +1 -1
- package/package.json +2 -2
- package/src/boot/perStartRum.js +11 -7
- package/src/boot/recorderApi.js +42 -43
- package/src/boot/recorderApiStub.js +47 -0
- package/src/boot/rum.entry.js +6 -8
- package/src/boot/rum.slim.entry.js +7 -0
- package/src/boot/rumEntryFactory.js +10 -0
- package/src/boot/rumPublicApi.js +14 -46
- package/src/boot/rumRecorderApiStub.js +14 -0
- package/src/boot/rumSlimConfiguration.js +11 -0
- package/src/boot/sessionReplayPublicApi.js +57 -0
- package/src/boot/startRecording.js +6 -1
- package/src/domain/deflate/deflateEncoder.js +2 -4
- package/src/domain/encoderStreamId.js +5 -0
- 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/src/transport/startRumBatch.js +2 -2
- package/types/index.d.ts +15 -0
|
@@ -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}
|
|
@@ -3,7 +3,7 @@ import {
|
|
|
3
3
|
RumEventType,
|
|
4
4
|
startBatchWithReplica
|
|
5
5
|
} from '@cloudcare/browser-core'
|
|
6
|
-
import {
|
|
6
|
+
import { EncoderStreamId } from '../domain/encoderStreamId'
|
|
7
7
|
export function startRumBatch(
|
|
8
8
|
configuration,
|
|
9
9
|
lifeCycle,
|
|
@@ -17,7 +17,7 @@ export function startRumBatch(
|
|
|
17
17
|
configuration,
|
|
18
18
|
{
|
|
19
19
|
endpoint: configuration.rumEndpoint,
|
|
20
|
-
encoder: createEncoder(
|
|
20
|
+
encoder: createEncoder(EncoderStreamId.RUM)
|
|
21
21
|
},
|
|
22
22
|
reportError,
|
|
23
23
|
pageExitObservable,
|
package/types/index.d.ts
CHANGED
|
@@ -84,6 +84,18 @@ export interface CanvasMutationDebugResult {
|
|
|
84
84
|
export interface CanvasMutationDebugHistoryResult
|
|
85
85
|
extends CanvasMutationDebugResult {}
|
|
86
86
|
|
|
87
|
+
export interface DomMutationDebugResult {
|
|
88
|
+
timestamp: number
|
|
89
|
+
adds: object[]
|
|
90
|
+
removes: object[]
|
|
91
|
+
texts: object[]
|
|
92
|
+
attributes: object[]
|
|
93
|
+
addsCount: number
|
|
94
|
+
removesCount: number
|
|
95
|
+
textsCount: number
|
|
96
|
+
attributesCount: number
|
|
97
|
+
}
|
|
98
|
+
|
|
87
99
|
export interface ReplaySegmentFlushDebugResult {
|
|
88
100
|
sequence: number
|
|
89
101
|
creationReason: string
|
|
@@ -189,6 +201,8 @@ export declare const datafluxRum: {
|
|
|
189
201
|
getCanvasMutationHistoryForDebug: () =>
|
|
190
202
|
| CanvasMutationDebugHistoryResult[]
|
|
191
203
|
| undefined
|
|
204
|
+
getLastDomMutationForDebug: () => DomMutationDebugResult | undefined
|
|
205
|
+
getDomMutationHistoryForDebug: () => DomMutationDebugResult[] | undefined
|
|
192
206
|
getLastReplaySegmentFlushForDebug: () =>
|
|
193
207
|
| ReplaySegmentFlushDebugResult
|
|
194
208
|
| undefined
|
|
@@ -198,6 +212,7 @@ export declare const datafluxRum: {
|
|
|
198
212
|
getReplayPerformanceForDebug: () =>
|
|
199
213
|
| ReplayPerformanceDebugResult
|
|
200
214
|
| undefined
|
|
215
|
+
flushReplayMutationsForDebug: () => void
|
|
201
216
|
createResourceTrackerId: () => string
|
|
202
217
|
setResourceContext: (trackerId: string, context: Context) => void
|
|
203
218
|
appendResourceContext: (trackerId: string, context: Context) => void
|