@cloudcare/browser-rum 2.2.1 → 2.2.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.
Files changed (34) hide show
  1. package/README.md +2 -1
  2. package/bundle/dataflux-rum.js +1 -1
  3. package/cjs/boot/buildEnv.js +1 -1
  4. package/cjs/domain/configuration.js +7 -0
  5. package/cjs/domain/rumEventsCollection/resource/resourceCollection.js +1 -1
  6. package/cjs/domain/tracing/ddtraceTracer.js +4 -4
  7. package/cjs/domain/tracing/jaegerTracer.js +4 -3
  8. package/cjs/domain/tracing/skywalkingTracer.js +11 -10
  9. package/cjs/domain/tracing/tracer.js +9 -6
  10. package/cjs/domain/tracing/w3cTraceParentTracer.js +5 -4
  11. package/cjs/domain/tracing/zipkinMultiTracer.js +4 -3
  12. package/cjs/domain/tracing/zipkinSingleTracer.js +5 -4
  13. package/esm/boot/buildEnv.js +1 -1
  14. package/esm/boot/rumPublicApi.js +1 -1
  15. package/esm/domain/configuration.js +6 -0
  16. package/esm/domain/rumEventsCollection/resource/resourceCollection.js +1 -1
  17. package/esm/domain/tracing/ddtraceTracer.js +4 -4
  18. package/esm/domain/tracing/jaegerTracer.js +4 -3
  19. package/esm/domain/tracing/skywalkingTracer.js +11 -10
  20. package/esm/domain/tracing/tracer.js +10 -7
  21. package/esm/domain/tracing/w3cTraceParentTracer.js +5 -4
  22. package/esm/domain/tracing/zipkinMultiTracer.js +4 -3
  23. package/esm/domain/tracing/zipkinSingleTracer.js +5 -4
  24. package/package.json +3 -3
  25. package/src/boot/rumPublicApi.js +30 -45
  26. package/src/domain/configuration.js +8 -0
  27. package/src/domain/rumEventsCollection/resource/resourceCollection.js +15 -11
  28. package/src/domain/tracing/ddtraceTracer.js +11 -11
  29. package/src/domain/tracing/jaegerTracer.js +36 -28
  30. package/src/domain/tracing/skywalkingTracer.js +94 -53
  31. package/src/domain/tracing/tracer.js +14 -7
  32. package/src/domain/tracing/w3cTraceParentTracer.js +35 -27
  33. package/src/domain/tracing/zipkinMultiTracer.js +29 -28
  34. package/src/domain/tracing/zipkinSingleTracer.js +34 -27
@@ -1,40 +1,48 @@
1
1
  // === Generate a random 64-bit number in fixed-length hex format
2
2
  function randomTraceId() {
3
- var digits = '0123456789abcdef';
4
- var n = '';
3
+ var digits = '0123456789abcdef'
4
+ var n = ''
5
5
  for (var i = 0; i < 16; i += 1) {
6
- var rand = Math.floor(Math.random() * 16);
7
- n += digits[rand];
6
+ var rand = Math.floor(Math.random() * 16)
7
+ n += digits[rand]
8
8
  }
9
- return n;
9
+ return n
10
10
  }
11
11
 
12
12
  /**
13
- *
13
+ *
14
14
  * @param {*} configuration 配置信息
15
15
  */
16
- export function W3cTraceParentTracer(configuration) {
17
- var rootSpanId = randomTraceId();
16
+ export function W3cTraceParentTracer(configuration, traceSampled) {
17
+ var rootSpanId = randomTraceId()
18
18
  this._traceId = randomTraceId() + rootSpanId
19
19
  this._spanId = rootSpanId
20
+ this._traceSampled = traceSampled
20
21
  }
21
22
  W3cTraceParentTracer.prototype = {
22
- isTracingSupported: function() {
23
- return true
24
- },
25
- getSpanId:function() {
26
- return this._spanId
27
- },
28
- getTraceId: function() {
29
- return this._traceId
30
- },
31
- getTraceParent: function() {
32
- // '{version}-{traceId}-{spanId}-{sampleDecision}'
33
- return '00-' + this._traceId + '-' + this._spanId + '-01'
34
- },
35
- makeTracingHeaders: function() {
36
- return {
37
- 'traceparent': this.getTraceParent()
38
- }
39
- }
40
- }
23
+ isTracingSupported: function () {
24
+ return true
25
+ },
26
+ getSpanId: function () {
27
+ return this._spanId
28
+ },
29
+ getTraceId: function () {
30
+ return this._traceId
31
+ },
32
+ getTraceParent: function () {
33
+ // '{version}-{traceId}-{spanId}-{sampleDecision}'
34
+ return (
35
+ '00-' +
36
+ this._traceId +
37
+ '-' +
38
+ this._spanId +
39
+ '-' +
40
+ (this._traceSampled ? '01' : '00')
41
+ )
42
+ },
43
+ makeTracingHeaders: function () {
44
+ return {
45
+ traceparent: this.getTraceParent()
46
+ }
47
+ }
48
+ }
@@ -1,20 +1,20 @@
1
1
  // === Generate a random 64-bit number in fixed-length hex format
2
2
  function randomTraceId() {
3
- var digits = '0123456789abcdef';
4
- var n = '';
3
+ var digits = '0123456789abcdef'
4
+ var n = ''
5
5
  for (var i = 0; i < 16; i += 1) {
6
- var rand = Math.floor(Math.random() * 16);
7
- n += digits[rand];
6
+ var rand = Math.floor(Math.random() * 16)
7
+ n += digits[rand]
8
8
  }
9
- return n;
9
+ return n
10
10
  }
11
11
 
12
12
  /**
13
- *
13
+ *
14
14
  * @param {*} configuration 配置信息
15
15
  */
16
- export function ZipkinMultiTracer(configuration) {
17
- var rootSpanId = randomTraceId();
16
+ export function ZipkinMultiTracer(configuration, traceSampled) {
17
+ var rootSpanId = randomTraceId()
18
18
  if (configuration.traceId128Bit) {
19
19
  // 128bit生成traceid
20
20
  this._traceId = randomTraceId() + rootSpanId
@@ -22,25 +22,26 @@ function randomTraceId() {
22
22
  this._traceId = rootSpanId
23
23
  }
24
24
  this._spanId = rootSpanId
25
+ this._traceSampled = traceSampled
25
26
  }
26
27
  ZipkinMultiTracer.prototype = {
27
- isTracingSupported: function() {
28
- return true
29
- },
30
- getSpanId:function() {
31
- return this._spanId
32
- },
33
- getTraceId: function() {
34
- return this._traceId
35
- },
36
-
37
- makeTracingHeaders: function() {
38
- return {
39
- 'X-B3-TraceId': this.getTraceId(),
40
- 'X-B3-SpanId': this.getSpanId(),
41
- // 'X-B3-ParentSpanId': '',
42
- 'X-B3-Sampled': '1',
43
- // 'X-B3-Flags': '0'
44
- }
45
- }
46
- }
28
+ isTracingSupported: function () {
29
+ return true
30
+ },
31
+ getSpanId: function () {
32
+ return this._spanId
33
+ },
34
+ getTraceId: function () {
35
+ return this._traceId
36
+ },
37
+
38
+ makeTracingHeaders: function () {
39
+ return {
40
+ 'X-B3-TraceId': this.getTraceId(),
41
+ 'X-B3-SpanId': this.getSpanId(),
42
+ // 'X-B3-ParentSpanId': '',
43
+ 'X-B3-Sampled': this._traceSampled ? '1' : '0'
44
+ // 'X-B3-Flags': '0'
45
+ }
46
+ }
47
+ }
@@ -1,40 +1,47 @@
1
1
  // === Generate a random 64-bit number in fixed-length hex format
2
2
  function randomTraceId() {
3
- var digits = '0123456789abcdef';
4
- var n = '';
3
+ var digits = '0123456789abcdef'
4
+ var n = ''
5
5
  for (var i = 0; i < 16; i += 1) {
6
- var rand = Math.floor(Math.random() * 16);
7
- n += digits[rand];
6
+ var rand = Math.floor(Math.random() * 16)
7
+ n += digits[rand]
8
8
  }
9
- return n;
9
+ return n
10
10
  }
11
11
 
12
12
  /**
13
- *
13
+ *
14
14
  * @param {*} configuration 配置信息
15
15
  */
16
- export function ZipkinSingleTracer(configuration) {
17
- var rootSpanId = randomTraceId();
16
+ export function ZipkinSingleTracer(configuration, traceSampled) {
17
+ var rootSpanId = randomTraceId()
18
18
  this._traceId = randomTraceId() + rootSpanId
19
19
  this._spanId = rootSpanId
20
+ this._traceSampled = traceSampled
20
21
  }
21
22
  ZipkinSingleTracer.prototype = {
22
- isTracingSupported: function() {
23
- return true
24
- },
25
- getSpanId:function() {
26
- return this._spanId
27
- },
28
- getTraceId: function() {
29
- return this._traceId
30
- },
31
- getB3Str: function() {
32
- //{TraceId}-{SpanId}-{SamplingState}-{ParentSpanId}
33
- return this._traceId + '-' + this._spanId + '-1'
34
- },
35
- makeTracingHeaders: function() {
36
- return {
37
- 'b3': this.getB3Str()
38
- }
39
- }
40
- }
23
+ isTracingSupported: function () {
24
+ return true
25
+ },
26
+ getSpanId: function () {
27
+ return this._spanId
28
+ },
29
+ getTraceId: function () {
30
+ return this._traceId
31
+ },
32
+ getB3Str: function () {
33
+ //{TraceId}-{SpanId}-{SamplingState}-{ParentSpanId}
34
+ return (
35
+ this._traceId +
36
+ '-' +
37
+ this._spanId +
38
+ '-' +
39
+ (this._traceSampled ? '1' : '0')
40
+ )
41
+ },
42
+ makeTracingHeaders: function () {
43
+ return {
44
+ b3: this.getB3Str()
45
+ }
46
+ }
47
+ }