@datadog/mobile-react-native 2.14.7 → 2.14.9
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/android/src/main/kotlin/com/datadog/reactnative/DdSdkImplementation.kt +4 -5
- package/android/src/main/kotlin/com/datadog/reactnative/FrameRateProvider.kt +16 -8
- package/android/src/main/kotlin/com/datadog/reactnative/JsThreadExecutor.kt +27 -0
- package/android/src/main/kotlin/com/datadog/reactnative/SdkVersion.kt +1 -1
- package/android/src/test/kotlin/com/datadog/reactnative/DdSdkTest.kt +7 -5
- package/android/src/test/kotlin/com/datadog/tools/unit/TestJsThreadExecutor.kt +16 -0
- package/ios/Sources/SdkVersion.swift +1 -1
- package/lib/commonjs/DdSdkReactNative.js +10 -1
- package/lib/commonjs/DdSdkReactNative.js.map +1 -1
- package/lib/commonjs/DdSdkReactNativeConfiguration.js.map +1 -1
- package/lib/commonjs/metro/plugin/metroSerializer.js +2 -2
- package/lib/commonjs/metro/plugin/metroSerializer.js.map +1 -1
- package/lib/commonjs/rum/instrumentation/resourceTracking/DdRumResourceTracking.js +20 -0
- package/lib/commonjs/rum/instrumentation/resourceTracking/DdRumResourceTracking.js.map +1 -1
- package/lib/commonjs/rum/instrumentation/resourceTracking/requestProxy/XHRProxy/XHRProxy.js +12 -4
- package/lib/commonjs/rum/instrumentation/resourceTracking/requestProxy/XHRProxy/XHRProxy.js.map +1 -1
- package/lib/commonjs/rum/instrumentation/resourceTracking/requestProxy/interfaces/RequestProxy.js.map +1 -1
- package/lib/commonjs/version.js +1 -1
- package/lib/module/DdSdkReactNative.js +10 -1
- package/lib/module/DdSdkReactNative.js.map +1 -1
- package/lib/module/DdSdkReactNativeConfiguration.js.map +1 -1
- package/lib/module/metro/plugin/metroSerializer.js +2 -2
- package/lib/module/metro/plugin/metroSerializer.js.map +1 -1
- package/lib/module/rum/instrumentation/resourceTracking/DdRumResourceTracking.js +20 -0
- package/lib/module/rum/instrumentation/resourceTracking/DdRumResourceTracking.js.map +1 -1
- package/lib/module/rum/instrumentation/resourceTracking/requestProxy/XHRProxy/XHRProxy.js +12 -4
- package/lib/module/rum/instrumentation/resourceTracking/requestProxy/XHRProxy/XHRProxy.js.map +1 -1
- package/lib/module/version.js +1 -1
- package/lib/typescript/DdSdkReactNative.d.ts.map +1 -1
- package/lib/typescript/DdSdkReactNativeConfiguration.d.ts +1 -0
- package/lib/typescript/DdSdkReactNativeConfiguration.d.ts.map +1 -1
- package/lib/typescript/metro/plugin/metroSerializer.d.ts.map +1 -1
- package/lib/typescript/rum/instrumentation/resourceTracking/DdRumResourceTracking.d.ts +11 -0
- package/lib/typescript/rum/instrumentation/resourceTracking/DdRumResourceTracking.d.ts.map +1 -1
- package/lib/typescript/rum/instrumentation/resourceTracking/requestProxy/XHRProxy/XHRProxy.d.ts +2 -0
- package/lib/typescript/rum/instrumentation/resourceTracking/requestProxy/XHRProxy/XHRProxy.d.ts.map +1 -1
- package/lib/typescript/rum/instrumentation/resourceTracking/requestProxy/interfaces/RequestProxy.d.ts +1 -0
- package/lib/typescript/rum/instrumentation/resourceTracking/requestProxy/interfaces/RequestProxy.d.ts.map +1 -1
- package/lib/typescript/version.d.ts +1 -1
- package/package.json +2 -2
- package/src/DdSdkReactNative.tsx +17 -6
- package/src/DdSdkReactNativeConfiguration.tsx +1 -0
- package/src/metro/__tests__/metro.test.ts +20 -0
- package/src/metro/plugin/metroSerializer.ts +3 -2
- package/src/rum/instrumentation/resourceTracking/DdRumResourceTracking.tsx +25 -0
- package/src/rum/instrumentation/resourceTracking/__tests__/DdRumResourceTracking.test.ts +111 -0
- package/src/rum/instrumentation/resourceTracking/requestProxy/XHRProxy/XHRProxy.ts +13 -4
- package/src/rum/instrumentation/resourceTracking/requestProxy/XHRProxy/__tests__/XHRProxy.test.ts +68 -0
- package/src/rum/instrumentation/resourceTracking/requestProxy/interfaces/RequestProxy.ts +1 -0
- package/src/version.ts +1 -1
package/src/rum/instrumentation/resourceTracking/requestProxy/XHRProxy/__tests__/XHRProxy.test.ts
CHANGED
|
@@ -425,6 +425,74 @@ describe('XHRProxy', () => {
|
|
|
425
425
|
expect(xhr.requestHeaders[SAMPLING_PRIORITY_HEADER_KEY]).toBe('0');
|
|
426
426
|
});
|
|
427
427
|
|
|
428
|
+
it('applies a tracingSamplingRate updated via onTrackingUpdate to subsequent XHRs (regression: RUMS-5973)', async () => {
|
|
429
|
+
// GIVEN
|
|
430
|
+
const method = 'GET';
|
|
431
|
+
const url = 'https://api.example.com/v2/user';
|
|
432
|
+
const firstPartyHostsRegexMap = firstPartyHostsRegexMapBuilder([
|
|
433
|
+
{
|
|
434
|
+
match: 'api.example.com',
|
|
435
|
+
propagatorTypes: [PropagatorType.DATADOG]
|
|
436
|
+
}
|
|
437
|
+
]);
|
|
438
|
+
xhrProxy.onTrackingStart({
|
|
439
|
+
tracingSamplingRate: 0,
|
|
440
|
+
firstPartyHostsRegexMap
|
|
441
|
+
});
|
|
442
|
+
|
|
443
|
+
// WHEN: an XHR is opened with the initial rate of 0
|
|
444
|
+
const xhrBeforeUpdate = new XMLHttpRequestMock();
|
|
445
|
+
xhrBeforeUpdate.open(method, url);
|
|
446
|
+
xhrBeforeUpdate.send();
|
|
447
|
+
xhrBeforeUpdate.notifyResponseArrived();
|
|
448
|
+
xhrBeforeUpdate.complete(200, 'ok');
|
|
449
|
+
await flushPromises();
|
|
450
|
+
|
|
451
|
+
// AND: the tracking context is updated to 100
|
|
452
|
+
xhrProxy.onTrackingUpdate({
|
|
453
|
+
tracingSamplingRate: 100,
|
|
454
|
+
firstPartyHostsRegexMap
|
|
455
|
+
});
|
|
456
|
+
|
|
457
|
+
// AND: a second XHR is opened
|
|
458
|
+
const xhrAfterUpdate = new XMLHttpRequestMock();
|
|
459
|
+
xhrAfterUpdate.open(method, url);
|
|
460
|
+
xhrAfterUpdate.send();
|
|
461
|
+
xhrAfterUpdate.notifyResponseArrived();
|
|
462
|
+
xhrAfterUpdate.complete(200, 'ok');
|
|
463
|
+
await flushPromises();
|
|
464
|
+
|
|
465
|
+
// THEN: the pre-update request keeps priority 0, the post-update one is sampled at 100%
|
|
466
|
+
expect(
|
|
467
|
+
xhrBeforeUpdate.requestHeaders[SAMPLING_PRIORITY_HEADER_KEY]
|
|
468
|
+
).toBe('0');
|
|
469
|
+
expect(
|
|
470
|
+
xhrAfterUpdate.requestHeaders[SAMPLING_PRIORITY_HEADER_KEY]
|
|
471
|
+
).toBe('1');
|
|
472
|
+
});
|
|
473
|
+
|
|
474
|
+
it('ignores onTrackingUpdate when tracking has not started', () => {
|
|
475
|
+
// GIVEN: tracking was never started, so XMLHttpRequest is not proxied
|
|
476
|
+
|
|
477
|
+
// WHEN
|
|
478
|
+
xhrProxy.onTrackingUpdate({
|
|
479
|
+
tracingSamplingRate: 100,
|
|
480
|
+
firstPartyHostsRegexMap: firstPartyHostsRegexMapBuilder([
|
|
481
|
+
{
|
|
482
|
+
match: 'api.example.com',
|
|
483
|
+
propagatorTypes: [PropagatorType.DATADOG]
|
|
484
|
+
}
|
|
485
|
+
])
|
|
486
|
+
});
|
|
487
|
+
|
|
488
|
+
// THEN: no throw, and a subsequent open is not instrumented
|
|
489
|
+
const xhr = new XMLHttpRequestMock();
|
|
490
|
+
xhr.open('GET', 'https://api.example.com/v2/user');
|
|
491
|
+
expect(
|
|
492
|
+
xhr.requestHeaders[SAMPLING_PRIORITY_HEADER_KEY]
|
|
493
|
+
).toBeUndefined();
|
|
494
|
+
});
|
|
495
|
+
|
|
428
496
|
it('adds tracecontext request headers when the host is instrumented with tracecontext and request is sampled', async () => {
|
|
429
497
|
// GIVEN
|
|
430
498
|
const method = 'GET';
|
package/src/version.ts
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
// generated by genversion
|
|
2
|
-
export const version = '2.14.
|
|
2
|
+
export const version = '2.14.9';
|