@cloudcare/browser-rum 3.0.17 → 3.0.19

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.
@@ -1,5 +1,6 @@
1
- import { assign, display, isPercentage, validateAndBuildConfiguration, isArray, TraceType, isNullUndefinedDefaultValue, DefaultPrivacyLevel, objectHasValue } from '@cloudcare/browser-core';
1
+ import { assign, display, isPercentage, validateAndBuildConfiguration, isArray, TraceType, isNullUndefinedDefaultValue, DefaultPrivacyLevel, objectHasValue, isMatchOption, getOrigin, each } from '@cloudcare/browser-core';
2
2
  import { buildEnv } from '../boot/buildEnv';
3
+ import { isTracingOption } from '../domain/tracing/tracer';
3
4
  export function validateAndBuildRumConfiguration(initConfiguration) {
4
5
  if (!initConfiguration.applicationId) {
5
6
  display.error('Application ID is not configured, no RUM data will be collected.');
@@ -17,19 +18,23 @@ export function validateAndBuildRumConfiguration(initConfiguration) {
17
18
  return;
18
19
  }
19
20
 
20
- if (initConfiguration.allowedTracingOrigins !== undefined) {
21
- if (!isArray(initConfiguration.allowedTracingOrigins)) {
22
- display.error('Allowed Tracing Origins should be an array');
23
- return;
24
- }
25
- }
21
+ var allowedTracingUrls = validateAndBuildTracingOptions(initConfiguration);
22
+
23
+ if (!allowedTracingUrls) {
24
+ return;
25
+ } // if (initConfiguration.allowedTracingOrigins !== undefined) {
26
+ // if (!isArray(initConfiguration.allowedTracingOrigins)) {
27
+ // display.error('Allowed Tracing Origins should be an array')
28
+ // return
29
+ // }
30
+ // }
31
+ // if (initConfiguration.allowedDDTracingOrigins !== undefined) {
32
+ // if (!isArray(initConfiguration.allowedDDTracingOrigins)) {
33
+ // display.error('Allowed Tracing Origins should be an array')
34
+ // return
35
+ // }
36
+ // }
26
37
 
27
- if (initConfiguration.allowedDDTracingOrigins !== undefined) {
28
- if (!isArray(initConfiguration.allowedDDTracingOrigins)) {
29
- display.error('Allowed Tracing Origins should be an array');
30
- return;
31
- }
32
- }
33
38
 
34
39
  if (initConfiguration.tracingSampleRate !== undefined && !isPercentage(initConfiguration.tracingSampleRate)) {
35
40
  display.error('Tracing Sample Rate should be a number between 0 and 100');
@@ -54,7 +59,7 @@ export function validateAndBuildRumConfiguration(initConfiguration) {
54
59
  actionNameAttribute: initConfiguration.actionNameAttribute,
55
60
  sessionReplaySampleRate: isNullUndefinedDefaultValue(initConfiguration.sessionReplaySampleRate, 100),
56
61
  tracingSampleRate: initConfiguration.tracingSampleRate,
57
- allowedTracingOrigins: isNullUndefinedDefaultValue(initConfiguration.allowedTracingOrigins || initConfiguration.allowedDDTracingOrigins, []),
62
+ allowedTracingUrls: allowedTracingUrls,
58
63
  excludedActivityUrls: isNullUndefinedDefaultValue(initConfiguration.excludedActivityUrls, []),
59
64
  trackUserInteractions: trackUserInteractions || trackFrustrations,
60
65
  trackFrustrations: trackFrustrations,
@@ -65,4 +70,111 @@ export function validateAndBuildRumConfiguration(initConfiguration) {
65
70
  // 是否需要对webview 发送数据,需要装我们对应ios sdk
66
71
  defaultPrivacyLevel: objectHasValue(DefaultPrivacyLevel, initConfiguration.defaultPrivacyLevel) ? initConfiguration.defaultPrivacyLevel : DefaultPrivacyLevel.MASK_USER_INPUT
67
72
  }, baseConfiguration, buildEnv);
73
+ }
74
+ /**
75
+ * Handles allowedTracingUrls and processes legacy allowedTracingOrigins
76
+ */
77
+
78
+ function validateAndBuildTracingOptions(initConfiguration) {
79
+ // Advise about parameters precedence.
80
+ if (initConfiguration.allowedTracingUrls !== undefined && initConfiguration.allowedTracingOrigins !== undefined) {
81
+ display.warn('Both allowedTracingUrls and allowedTracingOrigins (deprecated) have been defined. The parameter allowedTracingUrls will override allowedTracingOrigins.');
82
+ } // Handle allowedTracingUrls first
83
+
84
+
85
+ if (initConfiguration.allowedTracingUrls !== undefined) {
86
+ if (!isArray(initConfiguration.allowedTracingUrls)) {
87
+ display.error('Allowed Tracing URLs should be an array');
88
+ return;
89
+ } // if (initConfiguration.allowedTracingUrls.length !== 0 && initConfiguration.service === undefined) {
90
+ // display.error('Service needs to be configured when tracing is enabled')
91
+ // return
92
+ // }
93
+ // Convert from (MatchOption | TracingOption) to TracingOption, remove unknown properties
94
+
95
+
96
+ var tracingOptions = [];
97
+ each(initConfiguration.allowedTracingUrls, function (option) {
98
+ if (isMatchOption(option)) {
99
+ tracingOptions.push({
100
+ match: option,
101
+ traceType: isNullUndefinedDefaultValue(initConfiguration.traceType, TraceType.DDTRACE)
102
+ });
103
+ } else if (isTracingOption(option)) {
104
+ tracingOptions.push(option);
105
+ } else {
106
+ display.warn('Allowed Tracing Urls parameters should be a string, RegExp, function, or an object. Ignoring parameter', option);
107
+ }
108
+ });
109
+ return tracingOptions;
110
+ } // Handle conversion of allowedTracingOrigins to allowedTracingUrls
111
+
112
+
113
+ if (initConfiguration.allowedTracingOrigins !== undefined) {
114
+ if (!isArray(initConfiguration.allowedTracingOrigins)) {
115
+ display.error('Allowed Tracing Origins should be an array');
116
+ return;
117
+ }
118
+
119
+ var tracingOptions = [];
120
+ each(initConfiguration.allowedTracingOrigins, function (legacyMatchOption) {
121
+ var tracingOption = convertLegacyMatchOptionToTracingOption(legacyMatchOption, isNullUndefinedDefaultValue(initConfiguration.traceType, TraceType.DDTRACE));
122
+
123
+ if (tracingOption) {
124
+ tracingOptions.push(tracingOption);
125
+ }
126
+ });
127
+ return tracingOptions;
128
+ } // Handle conversion of allowedDDTracingOrigins to allowedTracingUrls
129
+
130
+
131
+ if (initConfiguration.allowedDDTracingOrigins !== undefined) {
132
+ if (!isArray(initConfiguration.allowedDDTracingOrigins)) {
133
+ display.error('Allowed Tracing Origins should be an array');
134
+ return;
135
+ }
136
+
137
+ var tracingOptions = [];
138
+ each(initConfiguration.allowedDDTracingOrigins, function (legacyMatchOption) {
139
+ var tracingOption = convertLegacyMatchOptionToTracingOption(legacyMatchOption, isNullUndefinedDefaultValue(initConfiguration.traceType, TraceType.DDTRACE));
140
+
141
+ if (tracingOption) {
142
+ tracingOptions.push(tracingOption);
143
+ }
144
+ });
145
+ return tracingOptions;
146
+ }
147
+
148
+ return [];
149
+ }
150
+ /**
151
+ * Converts parameters from the deprecated allowedTracingOrigins
152
+ * to allowedTracingUrls. Handles the change from origin to full URLs.
153
+ */
154
+
155
+
156
+ function convertLegacyMatchOptionToTracingOption(item, traceType) {
157
+ var match;
158
+
159
+ if (typeof item === 'string') {
160
+ match = item;
161
+ } else if (item instanceof RegExp) {
162
+ match = function match(url) {
163
+ return item.test(getOrigin(url));
164
+ };
165
+ } else if (typeof item === 'function') {
166
+ match = function match(url) {
167
+ return item(getOrigin(url));
168
+ };
169
+ }
170
+
171
+ if (match === undefined) {
172
+ display.warn('Allowed Tracing Origins parameters should be a string, RegExp or function. Ignoring parameter', item);
173
+ return undefined;
174
+ }
175
+
176
+ return {
177
+ match: match,
178
+ traceType: traceType
179
+ };
68
180
  }
@@ -1,49 +1,12 @@
1
- function TraceIdentifier() {
2
- this.buffer = new Uint8Array(8);
3
- getCrypto().getRandomValues(this.buffer);
4
- this.buffer[0] = this.buffer[0] & 0x7f;
5
- }
6
-
7
- TraceIdentifier.prototype = {
8
- // buffer: new Uint8Array(8),
9
- toString: function toString(radix) {
10
- var high = this.readInt32(0);
11
- var low = this.readInt32(4);
12
- var str = '';
13
-
14
- while (1) {
15
- var mod = high % radix * 4294967296 + low;
16
- high = Math.floor(high / radix);
17
- low = Math.floor(mod / radix);
18
- str = (mod % radix).toString(radix) + str;
19
-
20
- if (!high && !low) {
21
- break;
22
- }
23
- }
24
-
25
- return str;
26
- },
27
- toDecimalString: function toDecimalString() {
28
- return this.toString(10);
29
- },
30
- readInt32: function readInt32(offset) {
31
- return this.buffer[offset] * 16777216 + (this.buffer[offset + 1] << 16) + (this.buffer[offset + 2] << 8) + this.buffer[offset + 3];
32
- }
33
- };
34
-
35
- function getCrypto() {
36
- return window.crypto || window.msCrypto;
37
- }
1
+ import { TraceIdentifier, getCrypto } from './traceIdentifier';
38
2
  /**
39
3
  *
40
4
  * @param {*} configuration 配置信息
41
5
  */
42
6
 
43
-
44
7
  export function DDtraceTracer(traceSampled) {
45
- this._spanId = new TraceIdentifier().toDecimalString();
46
- this._traceId = new TraceIdentifier().toDecimalString();
8
+ this._spanId = new TraceIdentifier();
9
+ this._traceId = new TraceIdentifier();
47
10
  this._traceSampled = traceSampled;
48
11
  }
49
12
  DDtraceTracer.prototype = {
@@ -51,10 +14,10 @@ DDtraceTracer.prototype = {
51
14
  return getCrypto() !== undefined;
52
15
  },
53
16
  getSpanId: function getSpanId() {
54
- return this._spanId;
17
+ return this._spanId.toDecimalString();
55
18
  },
56
19
  getTraceId: function getTraceId() {
57
- return this._traceId;
20
+ return this._traceId.toDecimalString();
58
21
  },
59
22
  makeTracingHeaders: function makeTracingHeaders() {
60
23
  return {
@@ -1,47 +1,28 @@
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
- }
1
+ import { TraceIdentifier, getCrypto } from './traceIdentifier';
13
2
  /**
14
3
  *
15
4
  * @param {*} configuration 配置信息
16
5
  */
17
6
 
18
-
19
7
  export function JaegerTracer(configuration, traceSampled) {
20
- var rootSpanId = randomTraceId(); // this._traceId = randomTraceId() + rootSpanId // 默认用128bit,兼容其他配置
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;
8
+ this._traceId = new TraceIdentifier();
9
+ this._spanId = new TraceIdentifier();
30
10
  this._traceSampled = traceSampled;
11
+ this.is128Bit = configuration.traceId128Bit;
31
12
  }
32
13
  JaegerTracer.prototype = {
33
14
  isTracingSupported: function isTracingSupported() {
34
- return true;
15
+ return getCrypto() !== undefined;
35
16
  },
36
17
  getSpanId: function getSpanId() {
37
- return this._spanId;
18
+ return this._spanId.toPaddedHexadecimalString();
38
19
  },
39
20
  getTraceId: function getTraceId() {
40
- return this._traceId;
21
+ return this.is128Bit ? '0000000000000000' + this._traceId.toPaddedHexadecimalString() : this._traceId.toPaddedHexadecimalString();
41
22
  },
42
23
  getUberTraceId: function getUberTraceId() {
43
24
  //{trace-id}:{span-id}:{parent-span-id}:{flags}
44
- return this._traceId + ':' + this._spanId + ':' + '0' + ':' + (this._traceSampled ? '1' : '0');
25
+ return this.getTraceId() + ':' + this.getSpanId() + ':' + '0' + ':' + (this._traceSampled ? '1' : '0');
45
26
  },
46
27
  makeTracingHeaders: function makeTracingHeaders() {
47
28
  return {
@@ -0,0 +1,40 @@
1
+ export function TraceIdentifier() {
2
+ this.buffer = new Uint8Array(8);
3
+ getCrypto().getRandomValues(this.buffer);
4
+ this.buffer[0] = this.buffer[0] & 0x7f;
5
+ }
6
+ TraceIdentifier.prototype = {
7
+ // buffer: new Uint8Array(8),
8
+ toString: function toString(radix) {
9
+ var high = this.readInt32(0);
10
+ var low = this.readInt32(4);
11
+ var str = '';
12
+
13
+ do {
14
+ var mod = high % radix * 4294967296 + low;
15
+ high = Math.floor(high / radix);
16
+ low = Math.floor(mod / radix);
17
+ str = (mod % radix).toString(radix) + str;
18
+ } while (high || low);
19
+
20
+ return str;
21
+ },
22
+ toDecimalString: function toDecimalString() {
23
+ return this.toString(10);
24
+ },
25
+
26
+ /**
27
+ * Format used by OTel headers
28
+ */
29
+ toPaddedHexadecimalString() {
30
+ var traceId = this.toString(16);
31
+ return Array(17 - traceId.length).join('0') + traceId;
32
+ },
33
+
34
+ readInt32: function readInt32(offset) {
35
+ return this.buffer[offset] * 16777216 + (this.buffer[offset + 1] << 16) + (this.buffer[offset + 2] << 8) + this.buffer[offset + 3];
36
+ }
37
+ };
38
+ export function getCrypto() {
39
+ return window.crypto || window.msCrypto;
40
+ }
@@ -1,10 +1,14 @@
1
- import { objectEntries, each, shallowClone, isArray, TraceType, getOrigin, performDraw, isNumber } from '@cloudcare/browser-core';
1
+ import { objectEntries, each, shallowClone, isArray, TraceType, performDraw, isNumber, getType, find, isMatchOption, matchList, isString } from '@cloudcare/browser-core';
2
2
  import { DDtraceTracer } from './ddtraceTracer';
3
3
  import { SkyWalkingTracer } from './skywalkingTracer';
4
4
  import { JaegerTracer } from './jaegerTracer';
5
5
  import { ZipkinSingleTracer } from './zipkinSingleTracer';
6
6
  import { ZipkinMultiTracer } from './zipkinMultiTracer';
7
7
  import { W3cTraceParentTracer } from './w3cTraceParentTracer';
8
+ export function isTracingOption(item) {
9
+ var expectedItem = item;
10
+ return getType(expectedItem) === 'object' && isMatchOption(expectedItem.match) && isString(expectedItem.traceType);
11
+ }
8
12
  export function clearTracingIfNeeded(context) {
9
13
  if (context.status === 0 && !context.isAborted) {
10
14
  context.traceId = undefined;
@@ -59,28 +63,24 @@ export function startTracer(configuration, sessionManager) {
59
63
  }
60
64
  };
61
65
  }
66
+ export function injectHeadersIfTracingAllowed(configuration, context, sessionManager, inject) {
67
+ if (!sessionManager.findTrackedSession()) {
68
+ return;
69
+ }
62
70
 
63
- function isAllowedUrl(configuration, requestUrl) {
64
- var requestOrigin = getOrigin(requestUrl);
65
- var flag = false;
66
- each(configuration.allowedTracingOrigins, function (allowedOrigin) {
67
- if (requestOrigin === allowedOrigin || allowedOrigin instanceof RegExp && allowedOrigin.test(requestOrigin)) {
68
- flag = true;
69
- return false;
70
- }
71
+ var tracingOption = find(configuration.allowedTracingUrls, function (tracingOption) {
72
+ return matchList([tracingOption.match], context.url, true);
71
73
  });
72
- return flag;
73
- }
74
74
 
75
- export function injectHeadersIfTracingAllowed(configuration, context, sessionManager, inject) {
76
- if (!isAllowedUrl(configuration, context.url) || !configuration.traceType || !sessionManager.findTrackedSession()) {
75
+ if (!tracingOption) {
77
76
  return;
78
77
  }
79
78
 
80
79
  var traceSampled = !isNumber(configuration.tracingSampleRate) || performDraw(configuration.tracingSampleRate);
81
- var tracer;
80
+ var tracer,
81
+ traceType = tracingOption.traceType;
82
82
 
83
- switch (configuration.traceType) {
83
+ switch (traceType) {
84
84
  case TraceType.DDTRACE:
85
85
  tracer = new DDtraceTracer(traceSampled);
86
86
  break;
@@ -98,7 +98,11 @@ export function injectHeadersIfTracingAllowed(configuration, context, sessionMan
98
98
  break;
99
99
 
100
100
  case TraceType.W3C_TRACEPARENT:
101
- tracer = new W3cTraceParentTracer(configuration, traceSampled);
101
+ tracer = new W3cTraceParentTracer(traceSampled);
102
+ break;
103
+
104
+ case TraceType.W3C_TRACEPARENT_64:
105
+ tracer = new W3cTraceParentTracer(traceSampled, true);
102
106
  break;
103
107
 
104
108
  case TraceType.ZIPKIN_SINGLE_HEADER:
@@ -1,44 +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
- }
1
+ import { TraceIdentifier, getCrypto } from './traceIdentifier';
2
+ import { assign } from '@cloudcare/browser-core';
13
3
  /**
14
4
  *
15
- * @param {*} configuration 配置信息
5
+ * @param {*} traceSampled
6
+ * @param {*} isHexTraceId 是否需要转换成10进制上报数据
16
7
  */
17
8
 
18
-
19
- export function W3cTraceParentTracer(configuration, traceSampled) {
20
- var rootSpanId = randomTraceId();
21
- this._traceId = randomTraceId() + rootSpanId;
22
- this._spanId = rootSpanId;
9
+ export function W3cTraceParentTracer(traceSampled, isHexTraceId) {
10
+ this._traceId = new TraceIdentifier();
11
+ this._spanId = new TraceIdentifier();
23
12
  this._traceSampled = traceSampled;
13
+ this.isHexTraceId = isHexTraceId;
24
14
  }
25
15
  W3cTraceParentTracer.prototype = {
26
16
  isTracingSupported: function isTracingSupported() {
27
- return true;
17
+ return getCrypto() !== undefined;
28
18
  },
29
19
  getSpanId: function getSpanId() {
30
- return this._spanId;
20
+ return this.isHexTraceId ? this._spanId.toDecimalString() : this._spanId.toPaddedHexadecimalString();
31
21
  },
32
22
  getTraceId: function getTraceId() {
33
- return this._traceId;
23
+ return this.isHexTraceId ? this._traceId.toDecimalString() : '0000000000000000' + this._traceId.toPaddedHexadecimalString();
34
24
  },
35
25
  getTraceParent: function getTraceParent() {
36
26
  // '{version}-{traceId}-{spanId}-{sampleDecision}'
37
- return '00-' + this._traceId + '-' + this._spanId + '-' + (this._traceSampled ? '01' : '00');
27
+ return '00-0000000000000000' + this._traceId.toPaddedHexadecimalString() + '-' + this._spanId.toPaddedHexadecimalString() + '-' + (this._traceSampled ? '01' : '00');
38
28
  },
39
29
  makeTracingHeaders: function makeTracingHeaders() {
40
- return {
30
+ var baseHeaders = {
41
31
  traceparent: this.getTraceParent()
42
32
  };
33
+
34
+ if (this.isHexTraceId) {
35
+ return assign(baseHeaders, {
36
+ 'x-gc-trace-id': this.getTraceId(),
37
+ 'x-gc-span-id': this.getSpanId()
38
+ });
39
+ }
40
+
41
+ return baseHeaders;
43
42
  }
44
43
  };
@@ -1,48 +1,29 @@
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
- }
1
+ import { TraceIdentifier, getCrypto } from './traceIdentifier';
13
2
  /**
14
3
  *
15
4
  * @param {*} configuration 配置信息
16
5
  */
17
6
 
18
-
19
7
  export function ZipkinMultiTracer(configuration, traceSampled) {
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;
8
+ this._traceId = new TraceIdentifier();
9
+ this._spanId = new TraceIdentifier();
30
10
  this._traceSampled = traceSampled;
11
+ this.is128Bit = configuration.traceId128Bit;
31
12
  }
32
13
  ZipkinMultiTracer.prototype = {
33
14
  isTracingSupported: function isTracingSupported() {
34
- return true;
15
+ return getCrypto() !== undefined;
35
16
  },
36
17
  getSpanId: function getSpanId() {
37
- return this._spanId;
18
+ return this._spanId.toPaddedHexadecimalString();
38
19
  },
39
20
  getTraceId: function getTraceId() {
40
- return this._traceId;
21
+ return this.is128Bit ? '0000000000000000' + this._traceId.toPaddedHexadecimalString() : this._traceId.toPaddedHexadecimalString();
41
22
  },
42
23
  makeTracingHeaders: function makeTracingHeaders() {
43
24
  return {
44
- 'X-B3-TraceId': this.getTraceId(),
45
- 'X-B3-SpanId': this.getSpanId(),
25
+ 'X-B3-TraceId': this.getSpanId(),
26
+ 'X-B3-SpanId': this.getTraceId(),
46
27
  // 'X-B3-ParentSpanId': '',
47
28
  'X-B3-Sampled': this._traceSampled ? '1' : '0' // 'X-B3-Flags': '0'
48
29
 
@@ -1,40 +1,27 @@
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
- }
1
+ import { TraceIdentifier, getCrypto } from './traceIdentifier';
13
2
  /**
14
3
  *
15
4
  * @param {*} configuration 配置信息
16
5
  */
17
6
 
18
-
19
7
  export function ZipkinSingleTracer(configuration, traceSampled) {
20
- var rootSpanId = randomTraceId();
21
- this._traceId = randomTraceId() + rootSpanId;
22
- this._spanId = rootSpanId;
8
+ this._traceId = new TraceIdentifier();
9
+ this._spanId = new TraceIdentifier();
23
10
  this._traceSampled = traceSampled;
24
11
  }
25
12
  ZipkinSingleTracer.prototype = {
26
13
  isTracingSupported: function isTracingSupported() {
27
- return true;
14
+ return getCrypto() !== undefined;
28
15
  },
29
16
  getSpanId: function getSpanId() {
30
- return this._spanId;
17
+ return this._spanId.toPaddedHexadecimalString();
31
18
  },
32
19
  getTraceId: function getTraceId() {
33
- return this._traceId;
20
+ return this._traceId.toPaddedHexadecimalString();
34
21
  },
35
22
  getB3Str: function getB3Str() {
36
23
  //{TraceId}-{SpanId}-{SamplingState}-{ParentSpanId}
37
- return this._traceId + '-' + this._spanId + '-' + (this._traceSampled ? '1' : '0');
24
+ return this.getTraceId() + '-' + this.getSpanId() + '-' + (this._traceSampled ? '1' : '0');
38
25
  },
39
26
  makeTracingHeaders: function makeTracingHeaders() {
40
27
  return {
package/package.json CHANGED
@@ -1,10 +1,10 @@
1
1
  {
2
2
  "name": "@cloudcare/browser-rum",
3
- "version": "3.0.17",
3
+ "version": "3.0.19",
4
4
  "main": "cjs/index.js",
5
5
  "module": "esm/index.js",
6
6
  "dependencies": {
7
- "@cloudcare/browser-core": "2.0.15"
7
+ "@cloudcare/browser-core": "2.0.17"
8
8
  },
9
9
  "scripts": {
10
10
  "dev": "webpack serve --open --mode=development",
@@ -29,5 +29,5 @@
29
29
  "license": "MIT",
30
30
  "homepage": "https://github.com/CloudCare/dataflux-rum-sdk-javascript/blob/master/packages/rum/README.md",
31
31
  "description": "DataFlux RUM Web 端数据指标监控",
32
- "gitHead": "a62a6d650316cdd0471530a2954add77a21ebaad"
32
+ "gitHead": "ea5e097ee7a211e948b0766be016b50d671e4724"
33
33
  }