@datadog/mobile-react-native 1.3.1 → 1.5.0

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 (165) hide show
  1. package/DatadogSDKReactNative.podspec +2 -2
  2. package/android/build.gradle +5 -5
  3. package/android/src/main/kotlin/com/datadog/reactnative/DatadogSDKWrapper.kt +4 -0
  4. package/android/src/main/kotlin/com/datadog/reactnative/DatadogWrapper.kt +6 -0
  5. package/android/src/main/kotlin/com/datadog/reactnative/DdSdk.kt +155 -92
  6. package/android/src/main/kotlin/com/datadog/reactnative/DdSdkConfiguration.kt +2 -0
  7. package/android/src/main/kotlin/com/datadog/reactnative/DdSdkConfigurationExt.kt +16 -0
  8. package/android/src/test/kotlin/com/datadog/reactnative/DdSdkTest.kt +293 -30
  9. package/android/src/test/kotlin/com/datadog/tools/unit/DdSdkConfigurationExt.kt +5 -0
  10. package/android/src/test/kotlin/com/datadog/tools/unit/MapExt.kt +7 -0
  11. package/android/src/test/kotlin/com/datadog/tools/unit/forge/DdSdkConfigurationForgeryFactory.kt +2 -1
  12. package/android/src/test/kotlin/com/datadog/tools/unit/forge/TelemetryConfigurationEventForgeryFactory.kt +10 -0
  13. package/datadog-sourcemaps.gradle +55 -7
  14. package/ios/Sources/DdSdk.m +4 -0
  15. package/ios/Sources/DdSdk.swift +19 -2
  16. package/ios/Sources/DdSdkConfiguration.swift +6 -0
  17. package/ios/Sources/RNDdSdkConfiguration.swift +44 -0
  18. package/jest/mock.js +1 -1
  19. package/lib/commonjs/DdSdkReactNative.js +3 -3
  20. package/lib/commonjs/DdSdkReactNative.js.map +1 -1
  21. package/lib/commonjs/DdSdkReactNativeConfiguration.js +34 -2
  22. package/lib/commonjs/DdSdkReactNativeConfiguration.js.map +1 -1
  23. package/lib/commonjs/index.js +12 -0
  24. package/lib/commonjs/index.js.map +1 -1
  25. package/lib/commonjs/nativeModulesTypes.js.map +1 -1
  26. package/lib/commonjs/rum/instrumentation/resourceTracking/DdRumResourceTracking.js +5 -5
  27. package/lib/commonjs/rum/instrumentation/resourceTracking/DdRumResourceTracking.js.map +1 -1
  28. package/lib/commonjs/rum/instrumentation/resourceTracking/distributedTracing/distributedTracing.js +101 -0
  29. package/lib/commonjs/rum/instrumentation/resourceTracking/distributedTracing/distributedTracing.js.map +1 -0
  30. package/lib/commonjs/rum/instrumentation/resourceTracking/distributedTracing/distributedTracingHeaders.js +136 -0
  31. package/lib/commonjs/rum/instrumentation/resourceTracking/distributedTracing/distributedTracingHeaders.js.map +1 -0
  32. package/lib/commonjs/rum/instrumentation/resourceTracking/{domain → distributedTracing}/firstPartyHosts.js +39 -6
  33. package/lib/commonjs/rum/instrumentation/resourceTracking/distributedTracing/firstPartyHosts.js.map +1 -0
  34. package/lib/commonjs/rum/instrumentation/resourceTracking/{implementation → requestProxy/XHRProxy}/DatadogRumResource/ResourceReporter.js +4 -4
  35. package/lib/commonjs/rum/instrumentation/resourceTracking/requestProxy/XHRProxy/DatadogRumResource/ResourceReporter.js.map +1 -0
  36. package/lib/commonjs/rum/instrumentation/resourceTracking/requestProxy/XHRProxy/DatadogRumResource/internalDevResourceBlocklist.js.map +1 -0
  37. package/lib/commonjs/rum/instrumentation/resourceTracking/{implementation → requestProxy/XHRProxy}/URLHostParser.js +2 -2
  38. package/lib/commonjs/rum/instrumentation/resourceTracking/{implementation → requestProxy/XHRProxy}/URLHostParser.js.map +1 -1
  39. package/lib/commonjs/rum/instrumentation/resourceTracking/{implementation → requestProxy/XHRProxy}/XHRProxy.js +15 -24
  40. package/lib/commonjs/rum/instrumentation/resourceTracking/requestProxy/XHRProxy/XHRProxy.js.map +1 -0
  41. package/lib/commonjs/rum/instrumentation/resourceTracking/{implementation → requestProxy/XHRProxy}/responseSize.js +2 -2
  42. package/lib/commonjs/rum/instrumentation/resourceTracking/requestProxy/XHRProxy/responseSize.js.map +1 -0
  43. package/lib/commonjs/rum/instrumentation/resourceTracking/requestProxy/interfaces/RequestProxy.js.map +1 -0
  44. package/lib/commonjs/rum/types.js +19 -1
  45. package/lib/commonjs/rum/types.js.map +1 -1
  46. package/lib/commonjs/types.js +2 -1
  47. package/lib/commonjs/types.js.map +1 -1
  48. package/lib/commonjs/version.js +1 -1
  49. package/lib/commonjs/version.js.map +1 -1
  50. package/lib/module/DdSdkReactNative.js +4 -4
  51. package/lib/module/DdSdkReactNative.js.map +1 -1
  52. package/lib/module/DdSdkReactNativeConfiguration.js +30 -1
  53. package/lib/module/DdSdkReactNativeConfiguration.js.map +1 -1
  54. package/lib/module/index.js +3 -3
  55. package/lib/module/index.js.map +1 -1
  56. package/lib/module/nativeModulesTypes.js.map +1 -1
  57. package/lib/module/rum/instrumentation/resourceTracking/DdRumResourceTracking.js +6 -6
  58. package/lib/module/rum/instrumentation/resourceTracking/DdRumResourceTracking.js.map +1 -1
  59. package/lib/module/rum/instrumentation/resourceTracking/distributedTracing/distributedTracing.js +93 -0
  60. package/lib/module/rum/instrumentation/resourceTracking/distributedTracing/distributedTracing.js.map +1 -0
  61. package/lib/module/rum/instrumentation/resourceTracking/distributedTracing/distributedTracingHeaders.js +115 -0
  62. package/lib/module/rum/instrumentation/resourceTracking/distributedTracing/distributedTracingHeaders.js.map +1 -0
  63. package/lib/module/rum/instrumentation/resourceTracking/{domain → distributedTracing}/firstPartyHosts.js +37 -3
  64. package/lib/module/rum/instrumentation/resourceTracking/distributedTracing/firstPartyHosts.js.map +1 -0
  65. package/lib/module/rum/instrumentation/resourceTracking/{implementation → requestProxy/XHRProxy}/DatadogRumResource/ResourceReporter.js +4 -4
  66. package/lib/module/rum/instrumentation/resourceTracking/requestProxy/XHRProxy/DatadogRumResource/ResourceReporter.js.map +1 -0
  67. package/lib/module/rum/instrumentation/resourceTracking/requestProxy/XHRProxy/DatadogRumResource/internalDevResourceBlocklist.js.map +1 -0
  68. package/lib/module/rum/instrumentation/resourceTracking/{implementation → requestProxy/XHRProxy}/URLHostParser.js +2 -2
  69. package/lib/module/rum/instrumentation/resourceTracking/requestProxy/XHRProxy/URLHostParser.js.map +1 -0
  70. package/lib/module/rum/instrumentation/resourceTracking/{implementation → requestProxy/XHRProxy}/XHRProxy.js +13 -18
  71. package/lib/module/rum/instrumentation/resourceTracking/requestProxy/XHRProxy/XHRProxy.js.map +1 -0
  72. package/lib/module/rum/instrumentation/resourceTracking/{implementation → requestProxy/XHRProxy}/responseSize.js +2 -2
  73. package/lib/module/rum/instrumentation/resourceTracking/requestProxy/XHRProxy/responseSize.js.map +1 -0
  74. package/lib/module/rum/instrumentation/resourceTracking/requestProxy/interfaces/RequestProxy.js.map +1 -0
  75. package/lib/module/rum/types.js +16 -0
  76. package/lib/module/rum/types.js.map +1 -1
  77. package/lib/module/types.js +2 -1
  78. package/lib/module/types.js.map +1 -1
  79. package/lib/module/version.js +1 -1
  80. package/lib/module/version.js.map +1 -1
  81. package/lib/typescript/DdSdkReactNativeConfiguration.d.ts +16 -3
  82. package/lib/typescript/index.d.ts +3 -3
  83. package/lib/typescript/nativeModulesTypes.d.ts +5 -0
  84. package/lib/typescript/rum/instrumentation/resourceTracking/DdRumResourceTracking.d.ts +2 -1
  85. package/lib/typescript/rum/instrumentation/resourceTracking/distributedTracing/distributedTracing.d.ts +45 -0
  86. package/lib/typescript/rum/instrumentation/resourceTracking/distributedTracing/distributedTracingHeaders.d.ts +21 -0
  87. package/lib/typescript/rum/instrumentation/resourceTracking/distributedTracing/firstPartyHosts.d.ts +8 -0
  88. package/lib/typescript/rum/instrumentation/resourceTracking/{implementation → requestProxy/XHRProxy}/DatadogRumResource/ResourceReporter.d.ts +1 -1
  89. package/lib/typescript/rum/instrumentation/resourceTracking/{implementation → requestProxy/XHRProxy}/DatadogRumResource/internalDevResourceBlocklist.d.ts +1 -1
  90. package/lib/typescript/rum/instrumentation/resourceTracking/{implementation → requestProxy/XHRProxy}/URLHostParser.d.ts +1 -1
  91. package/lib/typescript/rum/instrumentation/resourceTracking/{implementation → requestProxy/XHRProxy}/XHRProxy.d.ts +2 -7
  92. package/lib/typescript/rum/instrumentation/resourceTracking/{domain → requestProxy}/interfaces/RequestProxy.d.ts +6 -1
  93. package/lib/typescript/rum/instrumentation/resourceTracking/{domain → requestProxy}/interfaces/RumResource.d.ts +1 -1
  94. package/lib/typescript/rum/types.d.ts +17 -0
  95. package/lib/typescript/types.d.ts +2 -1
  96. package/lib/typescript/version.d.ts +1 -1
  97. package/package.json +76 -76
  98. package/src/DdSdkReactNative.tsx +9 -4
  99. package/src/DdSdkReactNativeConfiguration.tsx +44 -4
  100. package/src/__tests__/DdSdkReactNative.test.tsx +16 -4
  101. package/src/__tests__/DdSdkReactNativeConfiguration.test.ts +7 -2
  102. package/src/index.tsx +6 -3
  103. package/src/nativeModulesTypes.ts +6 -0
  104. package/src/rum/__tests__/DdRum.test.ts +17 -1
  105. package/src/rum/instrumentation/resourceTracking/DdRumResourceTracking.tsx +10 -7
  106. package/src/rum/instrumentation/resourceTracking/__tests__/DdRumResourceTracking.test.ts +13 -2
  107. package/src/rum/instrumentation/resourceTracking/distributedTracing/__tests__/distributedTracing.test.ts +71 -0
  108. package/src/rum/instrumentation/resourceTracking/distributedTracing/__tests__/firstPartyHosts.test.ts +34 -0
  109. package/src/rum/instrumentation/resourceTracking/distributedTracing/distributedTracing.tsx +131 -0
  110. package/src/rum/instrumentation/resourceTracking/distributedTracing/distributedTracingHeaders.ts +141 -0
  111. package/src/rum/instrumentation/resourceTracking/{domain → distributedTracing}/firstPartyHosts.ts +42 -7
  112. package/src/rum/instrumentation/resourceTracking/{implementation → requestProxy/XHRProxy}/DatadogRumResource/ResourceReporter.ts +6 -6
  113. package/src/rum/instrumentation/resourceTracking/{implementation → requestProxy/XHRProxy}/DatadogRumResource/__tests__/ResourceReporter.test.ts +2 -2
  114. package/src/rum/instrumentation/resourceTracking/{implementation → requestProxy/XHRProxy}/DatadogRumResource/__tests__/__utils__/ResourceMockFactory.ts +1 -1
  115. package/src/rum/instrumentation/resourceTracking/{implementation → requestProxy/XHRProxy}/DatadogRumResource/internalDevResourceBlocklist.ts +1 -1
  116. package/src/rum/instrumentation/resourceTracking/{implementation → requestProxy/XHRProxy}/URLHostParser.ts +3 -3
  117. package/src/rum/instrumentation/resourceTracking/{implementation → requestProxy/XHRProxy}/XHRProxy.ts +13 -28
  118. package/src/rum/instrumentation/resourceTracking/{implementation → requestProxy/XHRProxy}/__tests__/XHRProxy.test.ts +257 -79
  119. package/src/rum/instrumentation/resourceTracking/{implementation → requestProxy/XHRProxy}/responseSize.ts +2 -2
  120. package/src/rum/instrumentation/resourceTracking/{domain → requestProxy}/interfaces/RequestProxy.ts +8 -1
  121. package/src/rum/instrumentation/resourceTracking/{domain → requestProxy}/interfaces/RumResource.ts +1 -1
  122. package/src/rum/types.ts +19 -0
  123. package/src/sdk/DatadogProvider/__tests__/initialization.test.tsx +1 -0
  124. package/src/sdk/DatadogProvider/__tests__/initializationModes.test.tsx +1 -1
  125. package/src/types.tsx +1 -0
  126. package/src/version.ts +1 -1
  127. package/lib/commonjs/rum/instrumentation/resourceTracking/domain/distributedTracing.js +0 -83
  128. package/lib/commonjs/rum/instrumentation/resourceTracking/domain/distributedTracing.js.map +0 -1
  129. package/lib/commonjs/rum/instrumentation/resourceTracking/domain/firstPartyHosts.js.map +0 -1
  130. package/lib/commonjs/rum/instrumentation/resourceTracking/domain/interfaces/RequestProxy.js.map +0 -1
  131. package/lib/commonjs/rum/instrumentation/resourceTracking/implementation/DatadogRumResource/ResourceReporter.js.map +0 -1
  132. package/lib/commonjs/rum/instrumentation/resourceTracking/implementation/DatadogRumResource/internalDevResourceBlocklist.js.map +0 -1
  133. package/lib/commonjs/rum/instrumentation/resourceTracking/implementation/XHRProxy.js.map +0 -1
  134. package/lib/commonjs/rum/instrumentation/resourceTracking/implementation/responseSize.js.map +0 -1
  135. package/lib/module/rum/instrumentation/resourceTracking/domain/distributedTracing.js +0 -71
  136. package/lib/module/rum/instrumentation/resourceTracking/domain/distributedTracing.js.map +0 -1
  137. package/lib/module/rum/instrumentation/resourceTracking/domain/firstPartyHosts.js.map +0 -1
  138. package/lib/module/rum/instrumentation/resourceTracking/domain/interfaces/RequestProxy.js.map +0 -1
  139. package/lib/module/rum/instrumentation/resourceTracking/implementation/DatadogRumResource/ResourceReporter.js.map +0 -1
  140. package/lib/module/rum/instrumentation/resourceTracking/implementation/DatadogRumResource/internalDevResourceBlocklist.js.map +0 -1
  141. package/lib/module/rum/instrumentation/resourceTracking/implementation/URLHostParser.js.map +0 -1
  142. package/lib/module/rum/instrumentation/resourceTracking/implementation/XHRProxy.js.map +0 -1
  143. package/lib/module/rum/instrumentation/resourceTracking/implementation/responseSize.js.map +0 -1
  144. package/lib/typescript/rum/instrumentation/resourceTracking/domain/distributedTracing.d.ts +0 -19
  145. package/lib/typescript/rum/instrumentation/resourceTracking/domain/firstPartyHosts.d.ts +0 -6
  146. package/src/rum/instrumentation/resourceTracking/domain/__tests__/distributedTracing.test.ts +0 -31
  147. package/src/rum/instrumentation/resourceTracking/domain/__tests__/firstPartyHosts.test.ts +0 -22
  148. package/src/rum/instrumentation/resourceTracking/domain/distributedTracing.tsx +0 -89
  149. /package/lib/commonjs/rum/instrumentation/resourceTracking/{implementation → requestProxy/XHRProxy}/DatadogRumResource/internalDevResourceBlocklist.js +0 -0
  150. /package/lib/commonjs/rum/instrumentation/resourceTracking/{implementation → requestProxy/XHRProxy}/DatadogRumResource/resourceTiming.js +0 -0
  151. /package/lib/commonjs/rum/instrumentation/resourceTracking/{implementation → requestProxy/XHRProxy}/DatadogRumResource/resourceTiming.js.map +0 -0
  152. /package/lib/commonjs/rum/instrumentation/resourceTracking/{domain → requestProxy}/interfaces/RequestProxy.js +0 -0
  153. /package/lib/commonjs/rum/instrumentation/resourceTracking/{domain → requestProxy}/interfaces/RumResource.js +0 -0
  154. /package/lib/commonjs/rum/instrumentation/resourceTracking/{domain → requestProxy}/interfaces/RumResource.js.map +0 -0
  155. /package/lib/module/rum/instrumentation/resourceTracking/{implementation → requestProxy/XHRProxy}/DatadogRumResource/internalDevResourceBlocklist.js +0 -0
  156. /package/lib/module/rum/instrumentation/resourceTracking/{implementation → requestProxy/XHRProxy}/DatadogRumResource/resourceTiming.js +0 -0
  157. /package/lib/module/rum/instrumentation/resourceTracking/{implementation → requestProxy/XHRProxy}/DatadogRumResource/resourceTiming.js.map +0 -0
  158. /package/lib/module/rum/instrumentation/resourceTracking/{domain → requestProxy}/interfaces/RequestProxy.js +0 -0
  159. /package/lib/module/rum/instrumentation/resourceTracking/{domain → requestProxy}/interfaces/RumResource.js +0 -0
  160. /package/lib/module/rum/instrumentation/resourceTracking/{domain → requestProxy}/interfaces/RumResource.js.map +0 -0
  161. /package/lib/typescript/rum/instrumentation/resourceTracking/{implementation → requestProxy/XHRProxy}/DatadogRumResource/resourceTiming.d.ts +0 -0
  162. /package/lib/typescript/rum/instrumentation/resourceTracking/{implementation → requestProxy/XHRProxy}/responseSize.d.ts +0 -0
  163. /package/src/rum/instrumentation/resourceTracking/{implementation → requestProxy/XHRProxy}/DatadogRumResource/__tests__/internalDevResourceBlocklist.test.ts +0 -0
  164. /package/src/rum/instrumentation/resourceTracking/{implementation → requestProxy/XHRProxy}/DatadogRumResource/resourceTiming.ts +0 -0
  165. /package/src/rum/instrumentation/resourceTracking/{implementation → requestProxy/XHRProxy}/__tests__/URLHostParser.test.ts +0 -0
@@ -4,7 +4,7 @@
4
4
  * Copyright 2016-Present Datadog, Inc.
5
5
  */
6
6
 
7
- import type { RUMResource } from '../../../../domain/interfaces/RumResource';
7
+ import type { RUMResource } from '../../../../interfaces/RumResource';
8
8
 
9
9
  /**
10
10
  * This method returns a new object each time to avoid overriding the same object
@@ -4,7 +4,7 @@
4
4
  * Copyright 2016-Present Datadog, Inc.
5
5
  */
6
6
 
7
- import type { RUMResource } from '../../domain/interfaces/RumResource';
7
+ import type { RUMResource } from '../../interfaces/RumResource';
8
8
 
9
9
  /**
10
10
  * Expo sends all console.* calls to the packager. As we log all API calls
@@ -4,9 +4,9 @@
4
4
  * Copyright 2016-Present Datadog, Inc.
5
5
  */
6
6
 
7
- import { InternalLog } from '../../../../InternalLog';
8
- import { SdkVerbosity } from '../../../../SdkVerbosity';
9
- import type { Hostname } from '../domain/firstPartyHosts';
7
+ import { InternalLog } from '../../../../../InternalLog';
8
+ import { SdkVerbosity } from '../../../../../SdkVerbosity';
9
+ import type { Hostname } from '../../distributedTracing/firstPartyHosts';
10
10
 
11
11
  // matches what is between the first "://" and the next "/", ":" or whitespace
12
12
  const hostRegex = '^.+://([^:/\\s]+)';
@@ -4,22 +4,17 @@
4
4
  * Copyright 2016-Present Datadog, Inc.
5
5
  */
6
6
 
7
- import Timer from '../../../../Timer';
8
- import type { DdRumResourceTracingAttributes } from '../domain/distributedTracing';
9
- import { getTracingAttributes } from '../domain/distributedTracing';
10
- import type { RequestProxyOptions } from '../domain/interfaces/RequestProxy';
11
- import { RequestProxy } from '../domain/interfaces/RequestProxy';
7
+ import Timer from '../../../../../Timer';
8
+ import { getTracingHeaders } from '../../distributedTracing/distributedTracingHeaders';
9
+ import type { DdRumResourceTracingAttributes } from '../../distributedTracing/distributedTracing';
10
+ import { getTracingAttributes } from '../../distributedTracing/distributedTracing';
11
+ import type { RequestProxyOptions } from '../interfaces/RequestProxy';
12
+ import { RequestProxy } from '../interfaces/RequestProxy';
12
13
 
13
14
  import type { ResourceReporter } from './DatadogRumResource/ResourceReporter';
14
15
  import { URLHostParser } from './URLHostParser';
15
16
  import { calculateResponseSize } from './responseSize';
16
17
 
17
- export const TRACE_ID_HEADER_KEY = 'x-datadog-trace-id';
18
- export const PARENT_ID_HEADER_KEY = 'x-datadog-parent-id';
19
- export const ORIGIN_HEADER_KEY = 'x-datadog-origin';
20
- export const SAMPLING_PRIORITY_HEADER_KEY = 'x-datadog-sampling-priority';
21
- export const ORIGIN_RUM = 'rum';
22
-
23
18
  const RESPONSE_START_LABEL = 'response_start';
24
19
 
25
20
  interface DdRumXhr extends XMLHttpRequest {
@@ -77,7 +72,7 @@ const proxyOpen = (
77
72
  context: RequestProxyOptions
78
73
  ): void => {
79
74
  const originalXhrOpen = xhrType.prototype.open;
80
- const firstPartyHostsRegex = context.firstPartyHostsRegex;
75
+ const firstPartyHostsRegexMap = context.firstPartyHostsRegexMap;
81
76
  const tracingSamplingRate = context.tracingSamplingRate;
82
77
 
83
78
  xhrType.prototype.open = function (
@@ -95,7 +90,7 @@ const proxyOpen = (
95
90
  timer: new Timer(),
96
91
  tracingAttributes: getTracingAttributes({
97
92
  hostname,
98
- firstPartyHostsRegex,
93
+ firstPartyHostsRegexMap,
99
94
  tracingSamplingRate
100
95
  })
101
96
  };
@@ -112,23 +107,13 @@ const proxySend = (providers: XHRProxyProviders): void => {
112
107
  if (this._datadog_xhr) {
113
108
  // keep track of start time
114
109
  this._datadog_xhr.timer.start();
115
- this.setRequestHeader(ORIGIN_HEADER_KEY, ORIGIN_RUM);
116
110
 
117
- const tracingAttributes = this._datadog_xhr.tracingAttributes;
118
- this.setRequestHeader(
119
- SAMPLING_PRIORITY_HEADER_KEY,
120
- tracingAttributes.samplingPriorityHeader
111
+ const tracingHeaders = getTracingHeaders(
112
+ this._datadog_xhr.tracingAttributes
121
113
  );
122
- if (tracingAttributes.tracingStrategy !== 'DISCARD') {
123
- this.setRequestHeader(
124
- TRACE_ID_HEADER_KEY,
125
- tracingAttributes.traceId
126
- );
127
- this.setRequestHeader(
128
- PARENT_ID_HEADER_KEY,
129
- tracingAttributes.spanId
130
- );
131
- }
114
+ tracingHeaders.forEach(({ header, value }) => {
115
+ this.setRequestHeader(header, value);
116
+ });
132
117
  }
133
118
 
134
119
  proxyOnReadyStateChange(this, providers);
@@ -6,28 +6,34 @@
6
6
 
7
7
  import { Platform, NativeModules } from 'react-native';
8
8
 
9
- import { InternalLog } from '../../../../../InternalLog';
10
- import { SdkVerbosity } from '../../../../../SdkVerbosity';
11
- import { BufferSingleton } from '../../../../../sdk/DatadogProvider/Buffer/BufferSingleton';
12
- import { DdRum } from '../../../../DdRum';
13
- import { XMLHttpRequestMock } from '../../__tests__/__utils__/XMLHttpRequestMock';
14
- import { firstPartyHostsRegexBuilder } from '../../domain/firstPartyHosts';
15
- import { ResourceReporter } from '../DatadogRumResource/ResourceReporter';
9
+ import { InternalLog } from '../../../../../../InternalLog';
10
+ import { SdkVerbosity } from '../../../../../../SdkVerbosity';
11
+ import { BufferSingleton } from '../../../../../../sdk/DatadogProvider/Buffer/BufferSingleton';
12
+ import { DdRum } from '../../../../../DdRum';
13
+ import { PropagatorType } from '../../../../../types';
14
+ import { XMLHttpRequestMock } from '../../../__tests__/__utils__/XMLHttpRequestMock';
16
15
  import {
17
16
  PARENT_ID_HEADER_KEY,
18
17
  TRACE_ID_HEADER_KEY,
19
- ORIGIN_RUM,
20
- ORIGIN_HEADER_KEY,
21
18
  SAMPLING_PRIORITY_HEADER_KEY,
22
- XHRProxy
23
- } from '../XHRProxy';
19
+ TRACECONTEXT_HEADER_KEY,
20
+ B3_HEADER_KEY,
21
+ B3_MULTI_TRACE_ID_HEADER_KEY,
22
+ B3_MULTI_SPAN_ID_HEADER_KEY,
23
+ B3_MULTI_SAMPLED_HEADER_KEY,
24
+ ORIGIN_RUM,
25
+ ORIGIN_HEADER_KEY
26
+ } from '../../../distributedTracing/distributedTracingHeaders';
27
+ import { firstPartyHostsRegexMapBuilder } from '../../../distributedTracing/firstPartyHosts';
28
+ import { ResourceReporter } from '../DatadogRumResource/ResourceReporter';
29
+ import { XHRProxy } from '../XHRProxy';
24
30
  import {
25
31
  calculateResponseSize,
26
32
  RESOURCE_SIZE_ERROR_MESSAGE
27
33
  } from '../responseSize';
28
34
 
29
35
  jest.useFakeTimers();
30
- jest.mock('../../../../../InternalLog');
36
+ jest.mock('../../../../../../InternalLog');
31
37
  const mockedInternalLog = (InternalLog as unknown) as {
32
38
  log: jest.MockedFunction<typeof InternalLog.log>;
33
39
  };
@@ -76,10 +82,10 @@ describe('XHRPr', () => {
76
82
  it('intercepts XHR request when startTracking() + XHR.open() + XHR.send()', async () => {
77
83
  // GIVEN
78
84
  const method = 'GET';
79
- const url = 'https://api.example.com/v2/user';
85
+ const url = 'https://api.example.com:443/v2/user';
80
86
  xhrProxy.onTrackingStart({
81
87
  tracingSamplingRate: 100,
82
- firstPartyHostsRegex: firstPartyHostsRegexBuilder([])
88
+ firstPartyHostsRegexMap: firstPartyHostsRegexMapBuilder([])
83
89
  });
84
90
 
85
91
  // WHEN
@@ -116,7 +122,7 @@ describe('XHRPr', () => {
116
122
  const url = 'https://api.example.com/v2/user';
117
123
  xhrProxy.onTrackingStart({
118
124
  tracingSamplingRate: 100,
119
- firstPartyHostsRegex: firstPartyHostsRegexBuilder([])
125
+ firstPartyHostsRegexMap: firstPartyHostsRegexMapBuilder([])
120
126
  });
121
127
 
122
128
  // WHEN
@@ -153,7 +159,7 @@ describe('XHRPr', () => {
153
159
  const url = 'https://api.example.com/v2/user';
154
160
  xhrProxy.onTrackingStart({
155
161
  tracingSamplingRate: 100,
156
- firstPartyHostsRegex: firstPartyHostsRegexBuilder([])
162
+ firstPartyHostsRegexMap: firstPartyHostsRegexMapBuilder([])
157
163
  });
158
164
 
159
165
  // WHEN
@@ -184,14 +190,17 @@ describe('XHRPr', () => {
184
190
  });
185
191
 
186
192
  describe('request headers', () => {
187
- it('adds the span id in the request headers when startTracking() + XHR.open() + XHR.send()', async () => {
193
+ it('adds the span id and trace Id in the request headers when startTracking() + XHR.open() + XHR.send()', async () => {
188
194
  // GIVEN
189
195
  const method = 'GET';
190
196
  const url = 'https://api.example.com/v2/user';
191
197
  xhrProxy.onTrackingStart({
192
198
  tracingSamplingRate: 100,
193
- firstPartyHostsRegex: firstPartyHostsRegexBuilder([
194
- 'api.example.com'
199
+ firstPartyHostsRegexMap: firstPartyHostsRegexMapBuilder([
200
+ {
201
+ match: 'api.example.com',
202
+ propagatorTypes: [PropagatorType.DATADOG]
203
+ }
195
204
  ])
196
205
  });
197
206
 
@@ -207,17 +216,23 @@ describe('XHRPr', () => {
207
216
  const spanId = xhr.requestHeaders[PARENT_ID_HEADER_KEY];
208
217
  expect(spanId).toBeDefined();
209
218
  expect(spanId).toMatch(/[1-9].+/);
219
+ const traceId = xhr.requestHeaders[TRACE_ID_HEADER_KEY];
220
+ expect(traceId).toBeDefined();
221
+ expect(traceId).toMatch(/[1-9].+/);
222
+
223
+ expect(traceId !== spanId).toBeTruthy();
224
+
225
+ expect(xhr.requestHeaders[SAMPLING_PRIORITY_HEADER_KEY]).toBe('1');
226
+ expect(xhr.requestHeaders[ORIGIN_HEADER_KEY]).toBe(ORIGIN_RUM);
210
227
  });
211
228
 
212
- it('adds the trace id in the request headers when startTracking() + XHR.open() + XHR.send()', async () => {
229
+ it('does not generate spanId and traceId in request headers when no first party hosts are provided', async () => {
213
230
  // GIVEN
214
231
  const method = 'GET';
215
232
  const url = 'https://api.example.com/v2/user';
216
233
  xhrProxy.onTrackingStart({
217
234
  tracingSamplingRate: 100,
218
- firstPartyHostsRegex: firstPartyHostsRegexBuilder([
219
- 'api.example.com'
220
- ])
235
+ firstPartyHostsRegexMap: firstPartyHostsRegexMapBuilder([])
221
236
  });
222
237
 
223
238
  // WHEN
@@ -229,20 +244,25 @@ describe('XHRPr', () => {
229
244
  await flushPromises();
230
245
 
231
246
  // THEN
232
- const traceId = xhr.requestHeaders[TRACE_ID_HEADER_KEY];
233
- expect(traceId).toBeDefined();
234
- expect(traceId).toMatch(/[1-9].+/);
247
+ expect(xhr.requestHeaders[TRACE_ID_HEADER_KEY]).toBeUndefined();
248
+ expect(xhr.requestHeaders[PARENT_ID_HEADER_KEY]).toBeUndefined();
235
249
  });
236
250
 
237
- it('generates different ids for spanId and traceId in request headers', async () => {
251
+ it('does not generate spanId and traceId in request headers when the url does not match first party hosts', async () => {
238
252
  // GIVEN
239
253
  const method = 'GET';
240
- const url = 'https://api.example.com:443/v2/user';
254
+ const url = 'https://api.example.com/v2/user';
241
255
  xhrProxy.onTrackingStart({
242
256
  tracingSamplingRate: 100,
243
- firstPartyHostsRegex: firstPartyHostsRegexBuilder([
244
- 'something.fr',
245
- 'example.com'
257
+ firstPartyHostsRegexMap: firstPartyHostsRegexMapBuilder([
258
+ {
259
+ match: 'google.com',
260
+ propagatorTypes: [PropagatorType.DATADOG]
261
+ },
262
+ {
263
+ match: 'api.example.co',
264
+ propagatorTypes: [PropagatorType.DATADOG]
265
+ }
246
266
  ])
247
267
  });
248
268
 
@@ -255,18 +275,22 @@ describe('XHRPr', () => {
255
275
  await flushPromises();
256
276
 
257
277
  // THEN
258
- const traceId = xhr.requestHeaders[TRACE_ID_HEADER_KEY];
259
- const spanId = xhr.requestHeaders[PARENT_ID_HEADER_KEY];
260
- expect(traceId !== spanId).toBeTruthy();
278
+ expect(xhr.requestHeaders[TRACE_ID_HEADER_KEY]).toBeUndefined();
279
+ expect(xhr.requestHeaders[PARENT_ID_HEADER_KEY]).toBeUndefined();
261
280
  });
262
281
 
263
- it('does not generate spanId and traceId in request headers when no first party hosts are provided', async () => {
282
+ it('does not crash when provided URL is not a valid one', async () => {
264
283
  // GIVEN
265
284
  const method = 'GET';
266
- const url = 'https://api.example.com/v2/user';
285
+ const url = 'crash';
267
286
  xhrProxy.onTrackingStart({
268
287
  tracingSamplingRate: 100,
269
- firstPartyHostsRegex: firstPartyHostsRegexBuilder([])
288
+ firstPartyHostsRegexMap: firstPartyHostsRegexMapBuilder([
289
+ {
290
+ match: 'example.com',
291
+ propagatorTypes: [PropagatorType.DATADOG]
292
+ }
293
+ ])
270
294
  });
271
295
 
272
296
  // WHEN
@@ -282,17 +306,20 @@ describe('XHRPr', () => {
282
306
  expect(xhr.requestHeaders[PARENT_ID_HEADER_KEY]).toBeUndefined();
283
307
  });
284
308
 
285
- it('does not generate spanId and traceId in request headers when no the url does not match first party hosts', async () => {
309
+ it('generates spanId and traceId with 0 sampling priority in request headers when trace is not sampled', async () => {
286
310
  // GIVEN
287
311
  const method = 'GET';
288
312
  const url = 'https://api.example.com/v2/user';
289
313
  xhrProxy.onTrackingStart({
290
- tracingSamplingRate: 100,
291
- firstPartyHostsRegex: firstPartyHostsRegexBuilder([
292
- 'google.com',
293
- 'api.example.co'
314
+ tracingSamplingRate: 50,
315
+ firstPartyHostsRegexMap: firstPartyHostsRegexMapBuilder([
316
+ {
317
+ match: 'api.example.com',
318
+ propagatorTypes: [PropagatorType.DATADOG]
319
+ }
294
320
  ])
295
321
  });
322
+ jest.spyOn(global.Math, 'random').mockReturnValue(0.7);
296
323
 
297
324
  // WHEN
298
325
  const xhr = new XMLHttpRequestMock();
@@ -303,18 +330,46 @@ describe('XHRPr', () => {
303
330
  await flushPromises();
304
331
 
305
332
  // THEN
306
- expect(xhr.requestHeaders[TRACE_ID_HEADER_KEY]).toBeUndefined();
307
- expect(xhr.requestHeaders[PARENT_ID_HEADER_KEY]).toBeUndefined();
333
+ expect(xhr.requestHeaders[TRACE_ID_HEADER_KEY]).not.toBeUndefined();
334
+ expect(
335
+ xhr.requestHeaders[PARENT_ID_HEADER_KEY]
336
+ ).not.toBeUndefined();
337
+ expect(xhr.requestHeaders[SAMPLING_PRIORITY_HEADER_KEY]).toBe('0');
338
+ expect(xhr.requestHeaders[ORIGIN_HEADER_KEY]).toBe(ORIGIN_RUM);
308
339
  });
309
340
 
310
- it('does not crash when provided URL is not a valid one', async () => {
341
+ it('does not origin as RUM in the request headers when startTracking() + XHR.open() + XHR.send()', async () => {
311
342
  // GIVEN
312
343
  const method = 'GET';
313
- const url = 'crash';
344
+ const url = 'https://api.example.com/v2/user';
345
+ xhrProxy.onTrackingStart({
346
+ tracingSamplingRate: 100,
347
+ firstPartyHostsRegexMap: firstPartyHostsRegexMapBuilder([])
348
+ });
349
+
350
+ // WHEN
351
+ const xhr = new XMLHttpRequestMock();
352
+ xhr.open(method, url);
353
+ xhr.send();
354
+ xhr.notifyResponseArrived();
355
+ xhr.complete(200, 'ok');
356
+ await flushPromises();
357
+
358
+ // THEN
359
+ expect(xhr.requestHeaders[ORIGIN_HEADER_KEY]).toBeUndefined();
360
+ });
361
+
362
+ it('forces the agent to keep the request generated trace when startTracking() + XHR.open() + XHR.send()', async () => {
363
+ // GIVEN
364
+ const method = 'GET';
365
+ const url = 'https://api.example.com/v2/user';
314
366
  xhrProxy.onTrackingStart({
315
367
  tracingSamplingRate: 100,
316
- firstPartyHostsRegex: firstPartyHostsRegexBuilder([
317
- 'example.com'
368
+ firstPartyHostsRegexMap: firstPartyHostsRegexMapBuilder([
369
+ {
370
+ match: 'api.example.com',
371
+ propagatorTypes: [PropagatorType.DATADOG]
372
+ }
318
373
  ])
319
374
  });
320
375
 
@@ -327,18 +382,20 @@ describe('XHRPr', () => {
327
382
  await flushPromises();
328
383
 
329
384
  // THEN
330
- expect(xhr.requestHeaders[TRACE_ID_HEADER_KEY]).toBeUndefined();
331
- expect(xhr.requestHeaders[PARENT_ID_HEADER_KEY]).toBeUndefined();
385
+ expect(xhr.requestHeaders[SAMPLING_PRIORITY_HEADER_KEY]).toBe('1');
332
386
  });
333
387
 
334
- it('does not generate spanId and traceId in request headers when tracing is disabled', async () => {
388
+ it('forces the agent to discard the request generated trace when startTracking when the request is not traced', async () => {
335
389
  // GIVEN
336
390
  const method = 'GET';
337
391
  const url = 'https://api.example.com/v2/user';
338
392
  xhrProxy.onTrackingStart({
339
393
  tracingSamplingRate: 50,
340
- firstPartyHostsRegex: firstPartyHostsRegexBuilder([
341
- 'api.example.com'
394
+ firstPartyHostsRegexMap: firstPartyHostsRegexMapBuilder([
395
+ {
396
+ match: 'api.example.com',
397
+ propagatorTypes: [PropagatorType.DATADOG]
398
+ }
342
399
  ])
343
400
  });
344
401
  jest.spyOn(global.Math, 'random').mockReturnValue(0.7);
@@ -352,17 +409,25 @@ describe('XHRPr', () => {
352
409
  await flushPromises();
353
410
 
354
411
  // THEN
355
- expect(xhr.requestHeaders[TRACE_ID_HEADER_KEY]).toBeUndefined();
356
- expect(xhr.requestHeaders[PARENT_ID_HEADER_KEY]).toBeUndefined();
412
+ expect(xhr.requestHeaders[SAMPLING_PRIORITY_HEADER_KEY]).toBe('0');
357
413
  });
358
414
 
359
- it('adds origin as RUM in the request headers when startTracking() + XHR.open() + XHR.send()', async () => {
415
+ it('adds tracecontext request headers when the host is instrumented with tracecontext and request is sampled', async () => {
360
416
  // GIVEN
361
417
  const method = 'GET';
362
- const url = 'https://api.example.com/v2/user';
418
+ const url = 'https://api.example.com:443/v2/user';
363
419
  xhrProxy.onTrackingStart({
364
420
  tracingSamplingRate: 100,
365
- firstPartyHostsRegex: firstPartyHostsRegexBuilder([])
421
+ firstPartyHostsRegexMap: firstPartyHostsRegexMapBuilder([
422
+ {
423
+ match: 'something.fr',
424
+ propagatorTypes: [PropagatorType.DATADOG]
425
+ },
426
+ {
427
+ match: 'example.com',
428
+ propagatorTypes: [PropagatorType.TRACECONTEXT]
429
+ }
430
+ ])
366
431
  });
367
432
 
368
433
  // WHEN
@@ -374,17 +439,25 @@ describe('XHRPr', () => {
374
439
  await flushPromises();
375
440
 
376
441
  // THEN
377
- expect(xhr.requestHeaders[ORIGIN_HEADER_KEY]).toBe(ORIGIN_RUM);
442
+ const headerValue = xhr.requestHeaders[TRACECONTEXT_HEADER_KEY];
443
+ expect(headerValue).toMatch(/^00-[0-9a-f]{32}-[0-9a-f]{16}-01$/);
378
444
  });
379
445
 
380
- it('forces the agent to keep the request generated trace when startTracking() + XHR.open() + XHR.send()', async () => {
446
+ it('adds tracecontext request headers when the host is instrumented with tracecontext and request is sampled', async () => {
381
447
  // GIVEN
382
448
  const method = 'GET';
383
- const url = 'https://api.example.com/v2/user';
449
+ const url = 'https://api.example.com:443/v2/user';
384
450
  xhrProxy.onTrackingStart({
385
451
  tracingSamplingRate: 100,
386
- firstPartyHostsRegex: firstPartyHostsRegexBuilder([
387
- 'api.example.com'
452
+ firstPartyHostsRegexMap: firstPartyHostsRegexMapBuilder([
453
+ {
454
+ match: 'something.fr',
455
+ propagatorTypes: [PropagatorType.DATADOG]
456
+ },
457
+ {
458
+ match: 'example.com',
459
+ propagatorTypes: [PropagatorType.B3MULTI]
460
+ }
388
461
  ])
389
462
  });
390
463
 
@@ -397,20 +470,31 @@ describe('XHRPr', () => {
397
470
  await flushPromises();
398
471
 
399
472
  // THEN
400
- expect(xhr.requestHeaders[SAMPLING_PRIORITY_HEADER_KEY]).toBe('1');
473
+ const traceId = xhr.requestHeaders[B3_MULTI_TRACE_ID_HEADER_KEY];
474
+ const spanId = xhr.requestHeaders[B3_MULTI_SPAN_ID_HEADER_KEY];
475
+ const sampled = xhr.requestHeaders[B3_MULTI_SAMPLED_HEADER_KEY];
476
+ expect(traceId).toMatch(/^[0-9a-f]{32}$/);
477
+ expect(spanId).toMatch(/^[0-9a-f]{16}$/);
478
+ expect(sampled).toBe('1');
401
479
  });
402
480
 
403
- it('forces the agent to discard the request generated trace when startTracking when the request is not traced', async () => {
481
+ it('adds tracecontext request headers when the host is instrumented with b3 and request is sampled', async () => {
404
482
  // GIVEN
405
483
  const method = 'GET';
406
- const url = 'https://api.example.com/v2/user';
484
+ const url = 'https://api.example.com:443/v2/user';
407
485
  xhrProxy.onTrackingStart({
408
- tracingSamplingRate: 50,
409
- firstPartyHostsRegex: firstPartyHostsRegexBuilder([
410
- 'api.example.com'
486
+ tracingSamplingRate: 100,
487
+ firstPartyHostsRegexMap: firstPartyHostsRegexMapBuilder([
488
+ {
489
+ match: 'something.fr',
490
+ propagatorTypes: [PropagatorType.DATADOG]
491
+ },
492
+ {
493
+ match: 'example.com',
494
+ propagatorTypes: [PropagatorType.B3]
495
+ }
411
496
  ])
412
497
  });
413
- jest.spyOn(global.Math, 'random').mockReturnValue(0.7);
414
498
 
415
499
  // WHEN
416
500
  const xhr = new XMLHttpRequestMock();
@@ -421,7 +505,60 @@ describe('XHRPr', () => {
421
505
  await flushPromises();
422
506
 
423
507
  // THEN
424
- expect(xhr.requestHeaders[SAMPLING_PRIORITY_HEADER_KEY]).toBe('0');
508
+ const headerValue = xhr.requestHeaders[B3_HEADER_KEY];
509
+ expect(headerValue).toMatch(/^[0-9a-f]{32}-[0-9a-f]{16}-1$/);
510
+ });
511
+
512
+ it('adds all headers when the host is matched for different propagators', async () => {
513
+ // GIVEN
514
+ const method = 'GET';
515
+ const url = 'https://api.example.com:443/v2/user';
516
+ xhrProxy.onTrackingStart({
517
+ tracingSamplingRate: 100,
518
+ firstPartyHostsRegexMap: firstPartyHostsRegexMapBuilder([
519
+ {
520
+ match: 'api.example.com',
521
+ propagatorTypes: [
522
+ PropagatorType.DATADOG,
523
+ PropagatorType.TRACECONTEXT
524
+ ]
525
+ },
526
+ {
527
+ match: 'example.com',
528
+ propagatorTypes: [
529
+ PropagatorType.B3,
530
+ PropagatorType.B3MULTI
531
+ ]
532
+ }
533
+ ])
534
+ });
535
+
536
+ // WHEN
537
+ const xhr = new XMLHttpRequestMock();
538
+ xhr.open(method, url);
539
+ xhr.send();
540
+ xhr.notifyResponseArrived();
541
+ xhr.complete(200, 'ok');
542
+ await flushPromises();
543
+
544
+ // THEN
545
+ expect(xhr.requestHeaders[B3_HEADER_KEY]).not.toBeUndefined();
546
+ expect(
547
+ xhr.requestHeaders[B3_MULTI_TRACE_ID_HEADER_KEY]
548
+ ).not.toBeUndefined();
549
+ expect(
550
+ xhr.requestHeaders[B3_MULTI_SPAN_ID_HEADER_KEY]
551
+ ).not.toBeUndefined();
552
+ expect(xhr.requestHeaders[B3_MULTI_SAMPLED_HEADER_KEY]).toBe('1');
553
+ expect(
554
+ xhr.requestHeaders[TRACECONTEXT_HEADER_KEY]
555
+ ).not.toBeUndefined();
556
+ expect(xhr.requestHeaders[TRACE_ID_HEADER_KEY]).not.toBeUndefined();
557
+ expect(
558
+ xhr.requestHeaders[PARENT_ID_HEADER_KEY]
559
+ ).not.toBeUndefined();
560
+ expect(xhr.requestHeaders[SAMPLING_PRIORITY_HEADER_KEY]).toBe('1');
561
+ expect(xhr.requestHeaders[ORIGIN_HEADER_KEY]).toBe(ORIGIN_RUM);
425
562
  });
426
563
  });
427
564
 
@@ -432,8 +569,11 @@ describe('XHRPr', () => {
432
569
  const url = 'https://api.example.com/v2/user';
433
570
  xhrProxy.onTrackingStart({
434
571
  tracingSamplingRate: 100,
435
- firstPartyHostsRegex: firstPartyHostsRegexBuilder([
436
- 'api.example.com'
572
+ firstPartyHostsRegexMap: firstPartyHostsRegexMapBuilder([
573
+ {
574
+ match: 'api.example.com',
575
+ propagatorTypes: [PropagatorType.DATADOG]
576
+ }
437
577
  ])
438
578
  });
439
579
 
@@ -470,8 +610,46 @@ describe('XHRPr', () => {
470
610
  const url = 'https://api.example.com/v2/user';
471
611
  xhrProxy.onTrackingStart({
472
612
  tracingSamplingRate: 50,
473
- firstPartyHostsRegex: firstPartyHostsRegexBuilder([
474
- 'api.example.com'
613
+ firstPartyHostsRegexMap: firstPartyHostsRegexMapBuilder([])
614
+ });
615
+ jest.spyOn(global.Math, 'random').mockReturnValue(0.7);
616
+
617
+ // WHEN
618
+ const xhr = new XMLHttpRequestMock();
619
+ xhr.open(method, url);
620
+ xhr.send();
621
+ xhr.notifyResponseArrived();
622
+ xhr.complete(200, 'ok');
623
+ await flushPromises();
624
+
625
+ // THEN
626
+ expect(DdNativeRum.startResource).not.toHaveBeenCalledWith(
627
+ expect.anything(),
628
+ expect.anything(),
629
+ expect.anything(),
630
+ expect.objectContaining({
631
+ '_dd.trace_id': expect.any(String),
632
+ '_dd.span_id': expect.any(String),
633
+ '_dd.rule_psr': expect.any(Number)
634
+ }),
635
+ expect.anything()
636
+ );
637
+ expect(DdNativeRum.startResource.mock.calls[0][3]).toStrictEqual(
638
+ {}
639
+ );
640
+ });
641
+
642
+ it('generates spanId and traceId when the trace is not sampled', async () => {
643
+ // GIVEN
644
+ const method = 'GET';
645
+ const url = 'https://api.example.com/v2/user';
646
+ xhrProxy.onTrackingStart({
647
+ tracingSamplingRate: 50,
648
+ firstPartyHostsRegexMap: firstPartyHostsRegexMapBuilder([
649
+ {
650
+ match: 'api.example.com',
651
+ propagatorTypes: [PropagatorType.DATADOG]
652
+ }
475
653
  ])
476
654
  });
477
655
  jest.spyOn(global.Math, 'random').mockReturnValue(0.7);
@@ -509,7 +687,7 @@ describe('XHRPr', () => {
509
687
  const url = 'https://api.example.com/v2/user';
510
688
  xhrProxy.onTrackingStart({
511
689
  tracingSamplingRate: 100,
512
- firstPartyHostsRegex: firstPartyHostsRegexBuilder([])
690
+ firstPartyHostsRegexMap: firstPartyHostsRegexMapBuilder([])
513
691
  });
514
692
 
515
693
  jest.doMock('react-native/Libraries/Utilities/Platform', () => ({
@@ -556,7 +734,7 @@ describe('XHRPr', () => {
556
734
  const url = 'https://api.example.com/v2/user';
557
735
  xhrProxy.onTrackingStart({
558
736
  tracingSamplingRate: 100,
559
- firstPartyHostsRegex: firstPartyHostsRegexBuilder([])
737
+ firstPartyHostsRegexMap: firstPartyHostsRegexMapBuilder([])
560
738
  });
561
739
 
562
740
  jest.doMock('react-native/Libraries/Utilities/Platform', () => ({
@@ -606,7 +784,7 @@ describe('XHRPr', () => {
606
784
  const url = 'https://api.example.com/v2/user';
607
785
  xhrProxy.onTrackingStart({
608
786
  tracingSamplingRate: 100,
609
- firstPartyHostsRegex: firstPartyHostsRegexBuilder([])
787
+ firstPartyHostsRegexMap: firstPartyHostsRegexMapBuilder([])
610
788
  });
611
789
 
612
790
  // WHEN
@@ -629,7 +807,7 @@ describe('XHRPr', () => {
629
807
  const url = 'https://api.example.com/v2/user';
630
808
  xhrProxy.onTrackingStart({
631
809
  tracingSamplingRate: 100,
632
- firstPartyHostsRegex: firstPartyHostsRegexBuilder([])
810
+ firstPartyHostsRegexMap: firstPartyHostsRegexMapBuilder([])
633
811
  });
634
812
  DdRum.registerResourceEventMapper(event => {
635
813
  event.context['body'] = JSON.parse(