@datadog/mobile-react-native 3.9.0 → 3.10.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 (83) hide show
  1. package/android/src/main/kotlin/com/datadog/reactnative/DdFlagsImplementation.kt +6 -3
  2. package/android/src/main/kotlin/com/datadog/reactnative/DdSdkImplementation.kt +16 -8
  3. package/android/src/main/kotlin/com/datadog/reactnative/FrameRateProvider.kt +11 -6
  4. package/android/src/main/kotlin/com/datadog/reactnative/SdkVersion.kt +1 -1
  5. package/android/src/test/kotlin/com/datadog/reactnative/DdFlagsImplementationTest.kt +19 -0
  6. package/android/src/test/kotlin/com/datadog/reactnative/DdSdkTest.kt +131 -0
  7. package/datadog-configuration.schema.json +11 -0
  8. package/ios/Sources/DdSdkConfiguration.swift +13 -0
  9. package/ios/Sources/DdSdkImplementation.swift +4 -3
  10. package/ios/Sources/DdSdkNativeInitialization.swift +26 -8
  11. package/ios/Sources/JSRefreshRateListener.swift +6 -2
  12. package/ios/Sources/RNDdSdkConfiguration.swift +9 -0
  13. package/ios/Sources/SdkVersion.swift +1 -1
  14. package/lib/commonjs/DdSdkReactNative.js +1 -1
  15. package/lib/commonjs/config/FileBasedConfiguration.js +3 -1
  16. package/lib/commonjs/config/FileBasedConfiguration.js.map +1 -1
  17. package/lib/commonjs/config/async/AutoInstrumentationConfiguration.js +3 -0
  18. package/lib/commonjs/config/async/AutoInstrumentationConfiguration.js.map +1 -1
  19. package/lib/commonjs/config/features/RumConfiguration.js +8 -0
  20. package/lib/commonjs/config/features/RumConfiguration.js.map +1 -1
  21. package/lib/commonjs/flags/FlagsClient.js +81 -8
  22. package/lib/commonjs/flags/FlagsClient.js.map +1 -1
  23. package/lib/commonjs/flags/configuration/precomputed.js +2 -3
  24. package/lib/commonjs/flags/configuration/precomputed.js.map +1 -1
  25. package/lib/commonjs/flags/internal.js.map +1 -1
  26. package/lib/commonjs/version.js +1 -1
  27. package/lib/commonjs/version.js.map +1 -1
  28. package/lib/module/DdSdkReactNative.js +1 -1
  29. package/lib/module/config/FileBasedConfiguration.js +3 -1
  30. package/lib/module/config/FileBasedConfiguration.js.map +1 -1
  31. package/lib/module/config/async/AutoInstrumentationConfiguration.js +3 -0
  32. package/lib/module/config/async/AutoInstrumentationConfiguration.js.map +1 -1
  33. package/lib/module/config/features/RumConfiguration.js +8 -0
  34. package/lib/module/config/features/RumConfiguration.js.map +1 -1
  35. package/lib/module/flags/FlagsClient.js +81 -8
  36. package/lib/module/flags/FlagsClient.js.map +1 -1
  37. package/lib/module/flags/configuration/precomputed.js +2 -3
  38. package/lib/module/flags/configuration/precomputed.js.map +1 -1
  39. package/lib/module/flags/internal.js.map +1 -1
  40. package/lib/module/version.js +1 -1
  41. package/lib/module/version.js.map +1 -1
  42. package/lib/typescript/config/FileBasedConfiguration.d.ts.map +1 -1
  43. package/lib/typescript/config/FileBasedConfiguration.type.d.ts +2 -0
  44. package/lib/typescript/config/FileBasedConfiguration.type.d.ts.map +1 -1
  45. package/lib/typescript/config/async/AutoInstrumentationConfiguration.d.ts +4 -0
  46. package/lib/typescript/config/async/AutoInstrumentationConfiguration.d.ts.map +1 -1
  47. package/lib/typescript/config/async/PartialInitializationConfiguration.d.ts +2 -0
  48. package/lib/typescript/config/async/PartialInitializationConfiguration.d.ts.map +1 -1
  49. package/lib/typescript/config/features/RumConfiguration.d.ts +4 -0
  50. package/lib/typescript/config/features/RumConfiguration.d.ts.map +1 -1
  51. package/lib/typescript/config/features/RumConfiguration.type.d.ts +21 -0
  52. package/lib/typescript/config/features/RumConfiguration.type.d.ts.map +1 -1
  53. package/lib/typescript/config/features/RumConfigurationNative.d.ts +2 -0
  54. package/lib/typescript/config/features/RumConfigurationNative.d.ts.map +1 -1
  55. package/lib/typescript/flags/FlagsClient.d.ts +38 -1
  56. package/lib/typescript/flags/FlagsClient.d.ts.map +1 -1
  57. package/lib/typescript/flags/internal.d.ts +1 -0
  58. package/lib/typescript/flags/internal.d.ts.map +1 -1
  59. package/lib/typescript/flags/types.d.ts +1 -1
  60. package/lib/typescript/flags/types.d.ts.map +1 -1
  61. package/lib/typescript/version.d.ts +1 -1
  62. package/lib/typescript/version.d.ts.map +1 -1
  63. package/package.json +2 -2
  64. package/src/DdSdkReactNative.tsx +1 -1
  65. package/src/__tests__/DdSdkReactNative.test.tsx +133 -0
  66. package/src/__tests__/DdSdkReactNativeConfiguration.test.ts +12 -0
  67. package/src/config/FileBasedConfiguration.ts +6 -1
  68. package/src/config/FileBasedConfiguration.type.ts +2 -0
  69. package/src/config/__tests__/FileBasedConfiguration.test.ts +79 -0
  70. package/src/config/__tests__/__fixtures__/configuration-all-fields.json +2 -0
  71. package/src/config/async/AutoInstrumentationConfiguration.ts +9 -0
  72. package/src/config/async/PartialInitializationConfiguration.ts +2 -0
  73. package/src/config/features/RumConfiguration.ts +10 -0
  74. package/src/config/features/RumConfiguration.type.ts +23 -0
  75. package/src/config/features/RumConfigurationNative.ts +2 -0
  76. package/src/flags/FlagsClient.ts +128 -19
  77. package/src/flags/__tests__/FlagsClient.test.ts +167 -0
  78. package/src/flags/configuration/precomputed.ts +2 -3
  79. package/src/flags/internal.ts +2 -0
  80. package/src/flags/types.ts +2 -0
  81. package/src/rum/instrumentation/interactionTracking/__tests__/DdBabelInteractionTracking.test.ts +104 -1
  82. package/src/sdk/DatadogProvider/__tests__/initialization.test.tsx +165 -0
  83. package/src/version.ts +1 -1
@@ -1 +1 @@
1
- {"version":3,"file":"version.d.ts","sourceRoot":"","sources":["../../src/version.ts"],"names":[],"mappings":"AACA,eAAO,MAAM,OAAO,UAAU,CAAC"}
1
+ {"version":3,"file":"version.d.ts","sourceRoot":"","sources":["../../src/version.ts"],"names":[],"mappings":"AACA,eAAO,MAAM,OAAO,WAAW,CAAC"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@datadog/mobile-react-native",
3
- "version": "3.9.0",
3
+ "version": "3.10.0",
4
4
  "description": "A client-side React Native module to interact with Datadog",
5
5
  "keywords": [
6
6
  "datadog",
@@ -128,5 +128,5 @@
128
128
  "@datadog/flagging-core": "~2.0.1",
129
129
  "big-integer": "^1.6.52"
130
130
  },
131
- "gitHead": "6e8a314dbe755c284d9e882ebf9b03fd008a6967"
131
+ "gitHead": "14166cc5fe36299fb641805b76f06bac2043fe1c"
132
132
  }
@@ -530,7 +530,7 @@ export class DdSdkReactNative {
530
530
  DdBabelInteractionTracking.config = {
531
531
  trackInteractions,
532
532
  useAccessibilityLabel:
533
- configuration.rumConfiguration?.useAccessibilityLabel ||
533
+ configuration.rumConfiguration?.useAccessibilityLabel ??
534
534
  RUM_DEFAULTS.useAccessibilityLabel
535
535
  };
536
536
 
@@ -18,6 +18,7 @@ import { ProxyConfiguration, ProxyType, SdkVerbosity } from '../config/types';
18
18
  import { DdLogs } from '../logs/DdLogs';
19
19
  import { DdRum } from '../rum/DdRum';
20
20
  import { DdRumErrorTracking } from '../rum/instrumentation/DdRumErrorTracking';
21
+ import { DdBabelInteractionTracking } from '../rum/instrumentation/interactionTracking/DdBabelInteractionTracking';
21
22
  import { DdRumUserInteractionTracking } from '../rum/instrumentation/interactionTracking/DdRumUserInteractionTracking';
22
23
  import { DdRumResourceTracking } from '../rum/instrumentation/resourceTracking/DdRumResourceTracking';
23
24
  import { PropagatorType, RumActionType } from '../rum/types';
@@ -428,6 +429,94 @@ describe('DdSdkReactNative', () => {
428
429
  ).toBe(false);
429
430
  });
430
431
 
432
+ it('initializes with nativeIosResourceTracking undefined when not specified', async () => {
433
+ // GIVEN
434
+ const configuration = new CoreConfiguration('2', 'env');
435
+ configuration.rumConfiguration = new RumConfiguration('1');
436
+
437
+ // WHEN
438
+ await DdSdkReactNative.initialize(configuration);
439
+
440
+ // THEN
441
+ const ddSdkConfiguration = NativeModules.DdSdk.initialize.mock
442
+ .calls[0][0] as DdSdkNativeConfiguration;
443
+ expect(ddSdkConfiguration.rumConfiguration).toBeDefined();
444
+ expect(
445
+ ddSdkConfiguration.rumConfiguration?.nativeIosResourceTracking
446
+ ).toBeUndefined();
447
+ });
448
+
449
+ it.each([true, false])(
450
+ 'initializes with nativeIosResourceTracking %s when it is specified',
451
+ async value => {
452
+ // GIVEN
453
+ const configuration = new CoreConfiguration('2', 'env');
454
+ configuration.rumConfiguration = new RumConfiguration(
455
+ '1',
456
+ false,
457
+ false,
458
+ false,
459
+ { nativeIosResourceTracking: value }
460
+ );
461
+
462
+ // WHEN
463
+ await DdSdkReactNative.initialize(configuration);
464
+
465
+ // THEN
466
+ const ddSdkConfiguration = NativeModules.DdSdk.initialize.mock
467
+ .calls[0][0] as DdSdkNativeConfiguration;
468
+ expect(
469
+ ddSdkConfiguration.rumConfiguration
470
+ ?.nativeIosResourceTracking
471
+ ).toBe(value);
472
+ }
473
+ );
474
+
475
+ it('initializes with nativeIosResourceTrackingDisallowList undefined when not specified', async () => {
476
+ // GIVEN
477
+ const configuration = new CoreConfiguration('2', 'env');
478
+ configuration.rumConfiguration = new RumConfiguration('1');
479
+
480
+ // WHEN
481
+ await DdSdkReactNative.initialize(configuration);
482
+
483
+ // THEN
484
+ const ddSdkConfiguration = NativeModules.DdSdk.initialize.mock
485
+ .calls[0][0] as DdSdkNativeConfiguration;
486
+ expect(ddSdkConfiguration.rumConfiguration).toBeDefined();
487
+ expect(
488
+ ddSdkConfiguration.rumConfiguration
489
+ ?.nativeIosResourceTrackingDisallowList
490
+ ).toBeUndefined();
491
+ });
492
+
493
+ it('initializes with nativeIosResourceTrackingDisallowList when it is specified', async () => {
494
+ // GIVEN
495
+ const disallowList = [
496
+ 'https://3p.example.com/*',
497
+ 'https://cdn.example.com/a'
498
+ ];
499
+ const configuration = new CoreConfiguration('2', 'env');
500
+ configuration.rumConfiguration = new RumConfiguration(
501
+ '1',
502
+ false,
503
+ false,
504
+ false,
505
+ { nativeIosResourceTrackingDisallowList: disallowList }
506
+ );
507
+
508
+ // WHEN
509
+ await DdSdkReactNative.initialize(configuration);
510
+
511
+ // THEN
512
+ const ddSdkConfiguration = NativeModules.DdSdk.initialize.mock
513
+ .calls[0][0] as DdSdkNativeConfiguration;
514
+ expect(
515
+ ddSdkConfiguration.rumConfiguration
516
+ ?.nativeIosResourceTrackingDisallowList
517
+ ).toEqual(disallowList);
518
+ });
519
+
431
520
  it('initializes with bundleLogsWithTraces false when it is specified', async () => {
432
521
  // GIVEN
433
522
  const fakeAppId = '1';
@@ -565,6 +654,50 @@ describe('DdSdkReactNative', () => {
565
654
  });
566
655
 
567
656
  describe('feature enablement', () => {
657
+ describe('Babel interaction tracking', () => {
658
+ const originalConfig = DdBabelInteractionTracking.config;
659
+ const originalPluginFlag =
660
+ globalThis.__DD_RN_BABEL_PLUGIN_ENABLED__;
661
+
662
+ beforeEach(() => {
663
+ globalThis.__DD_RN_BABEL_PLUGIN_ENABLED__ = true;
664
+ NativeModules.DdSdk.initialize.mockResolvedValue(null);
665
+ });
666
+
667
+ afterEach(() => {
668
+ globalThis.__DD_RN_BABEL_PLUGIN_ENABLED__ = originalPluginFlag;
669
+ DdBabelInteractionTracking.config = originalConfig;
670
+ });
671
+
672
+ it.each([
673
+ { useAccessibilityLabel: false, expected: false },
674
+ { useAccessibilityLabel: true, expected: true },
675
+ { useAccessibilityLabel: undefined, expected: true }
676
+ ])(
677
+ 'respects useAccessibilityLabel=$useAccessibilityLabel during initialization',
678
+ async ({ useAccessibilityLabel, expected }) => {
679
+ const configuration = new CoreConfiguration('2', 'env');
680
+ configuration.rumConfiguration = new RumConfiguration(
681
+ '1',
682
+ true,
683
+ false,
684
+ false,
685
+ { useAccessibilityLabel }
686
+ );
687
+
688
+ await DdSdkReactNative.initialize(configuration);
689
+
690
+ expect(DdBabelInteractionTracking.config).toEqual({
691
+ trackInteractions: true,
692
+ useAccessibilityLabel: expected
693
+ });
694
+ expect(
695
+ DdRumUserInteractionTracking.startTracking
696
+ ).not.toHaveBeenCalled();
697
+ }
698
+ );
699
+ });
700
+
568
701
  it('enables user interaction feature when initialize { user interaction config enabled }', async () => {
569
702
  // GIVEN
570
703
  const fakeAppId = '1';
@@ -65,6 +65,8 @@ describe('DdSdkReactNativeConfiguration', () => {
65
65
  "longTaskThresholdMs": 0,
66
66
  "nativeCrashReportEnabled": false,
67
67
  "nativeInteractionTracking": false,
68
+ "nativeIosResourceTracking": undefined,
69
+ "nativeIosResourceTrackingDisallowList": undefined,
68
70
  "nativeLongTaskThresholdMs": 200,
69
71
  "nativeViewTracking": false,
70
72
  "resourceEventMapper": null,
@@ -134,6 +136,10 @@ describe('DdSdkReactNativeConfiguration', () => {
134
136
  nativeLongTaskThresholdMs: 345,
135
137
  nativeViewTracking: true,
136
138
  nativeInteractionTracking: true,
139
+ nativeIosResourceTracking: true,
140
+ nativeIosResourceTrackingDisallowList: [
141
+ 'https://3p.example.com/*'
142
+ ],
137
143
  longTaskThresholdMs: 567,
138
144
  trackFrustrations: true,
139
145
  trackNonFatalAnrs: true,
@@ -210,6 +216,10 @@ describe('DdSdkReactNativeConfiguration', () => {
210
216
  "longTaskThresholdMs": 567,
211
217
  "nativeCrashReportEnabled": true,
212
218
  "nativeInteractionTracking": true,
219
+ "nativeIosResourceTracking": true,
220
+ "nativeIosResourceTrackingDisallowList": [
221
+ "https://3p.example.com/*",
222
+ ],
213
223
  "nativeLongTaskThresholdMs": 345,
214
224
  "nativeViewTracking": true,
215
225
  "resourceEventMapper": [Function],
@@ -314,6 +324,8 @@ describe('DdSdkReactNativeConfiguration', () => {
314
324
  "longTaskThresholdMs": false,
315
325
  "nativeCrashReportEnabled": false,
316
326
  "nativeInteractionTracking": false,
327
+ "nativeIosResourceTracking": undefined,
328
+ "nativeIosResourceTrackingDisallowList": undefined,
317
329
  "nativeLongTaskThresholdMs": 0,
318
330
  "nativeViewTracking": false,
319
331
  "resourceEventMapper": null,
@@ -208,7 +208,12 @@ export const getJSONConfiguration = (
208
208
  telemetrySampleRate:
209
209
  configuration.rumConfiguration.telemetrySampleRate,
210
210
  nativeInteractionTracking:
211
- configuration.rumConfiguration.nativeInteractionTracking
211
+ configuration.rumConfiguration.nativeInteractionTracking,
212
+ nativeIosResourceTracking:
213
+ configuration.rumConfiguration.nativeIosResourceTracking,
214
+ nativeIosResourceTrackingDisallowList:
215
+ configuration.rumConfiguration
216
+ .nativeIosResourceTrackingDisallowList
212
217
  }
213
218
  }),
214
219
  ...(configuration.traceConfiguration !== undefined && {
@@ -46,6 +46,8 @@ export interface JsonConfiguration extends CoreConfigurationOptions {
46
46
  nativeLongTaskThresholdMs?: number;
47
47
  nativeViewTracking?: boolean;
48
48
  nativeInteractionTracking?: boolean;
49
+ nativeIosResourceTracking?: boolean;
50
+ nativeIosResourceTrackingDisallowList?: string[];
49
51
  customEndpoint?: string;
50
52
  sessionSampleRate?: number;
51
53
  resourceTraceSampleRate?: number;
@@ -59,6 +59,10 @@ describe('FileBasedConfiguration', () => {
59
59
  "longTaskThresholdMs": 44,
60
60
  "nativeCrashReportEnabled": true,
61
61
  "nativeInteractionTracking": true,
62
+ "nativeIosResourceTracking": true,
63
+ "nativeIosResourceTrackingDisallowList": [
64
+ "https://3p.example.com/*",
65
+ ],
62
66
  "nativeLongTaskThresholdMs": 789,
63
67
  "nativeViewTracking": true,
64
68
  "resourceEventMapper": null,
@@ -172,6 +176,8 @@ describe('FileBasedConfiguration', () => {
172
176
  "longTaskThresholdMs": 44,
173
177
  "nativeCrashReportEnabled": false,
174
178
  "nativeInteractionTracking": false,
179
+ "nativeIosResourceTracking": undefined,
180
+ "nativeIosResourceTrackingDisallowList": undefined,
175
181
  "nativeLongTaskThresholdMs": 200,
176
182
  "nativeViewTracking": false,
177
183
  "resourceEventMapper": null,
@@ -237,6 +243,8 @@ describe('FileBasedConfiguration', () => {
237
243
  "longTaskThresholdMs": 0,
238
244
  "nativeCrashReportEnabled": false,
239
245
  "nativeInteractionTracking": false,
246
+ "nativeIosResourceTracking": undefined,
247
+ "nativeIosResourceTrackingDisallowList": undefined,
240
248
  "nativeLongTaskThresholdMs": 200,
241
249
  "nativeViewTracking": false,
242
250
  "resourceEventMapper": null,
@@ -267,6 +275,77 @@ describe('FileBasedConfiguration', () => {
267
275
  `);
268
276
  });
269
277
 
278
+ it('leaves nativeIosResourceTracking undefined when not set', () => {
279
+ const config = new FileBasedConfiguration({
280
+ configuration: {
281
+ env: 'fake-env',
282
+ clientToken: 'fake-client-token',
283
+ rumConfiguration: {
284
+ applicationId: 'fake-app-id'
285
+ }
286
+ }
287
+ });
288
+ expect(config.rumConfiguration).toHaveProperty(
289
+ 'nativeIosResourceTracking',
290
+ undefined
291
+ );
292
+ });
293
+
294
+ it.each([true, false])(
295
+ 'passes nativeIosResourceTracking through when set to %s',
296
+ value => {
297
+ const config = new FileBasedConfiguration({
298
+ configuration: {
299
+ env: 'fake-env',
300
+ clientToken: 'fake-client-token',
301
+ rumConfiguration: {
302
+ applicationId: 'fake-app-id',
303
+ nativeIosResourceTracking: value
304
+ }
305
+ }
306
+ });
307
+ expect(config.rumConfiguration?.nativeIosResourceTracking).toBe(
308
+ value
309
+ );
310
+ }
311
+ );
312
+
313
+ it('leaves nativeIosResourceTrackingDisallowList undefined when not set', () => {
314
+ const config = new FileBasedConfiguration({
315
+ configuration: {
316
+ env: 'fake-env',
317
+ clientToken: 'fake-client-token',
318
+ rumConfiguration: {
319
+ applicationId: 'fake-app-id'
320
+ }
321
+ }
322
+ });
323
+ expect(config.rumConfiguration).toHaveProperty(
324
+ 'nativeIosResourceTrackingDisallowList',
325
+ undefined
326
+ );
327
+ });
328
+
329
+ it('passes nativeIosResourceTrackingDisallowList through when set', () => {
330
+ const disallowList = [
331
+ 'https://3p.example.com/*',
332
+ 'https://cdn.example.com/a'
333
+ ];
334
+ const config = new FileBasedConfiguration({
335
+ configuration: {
336
+ env: 'fake-env',
337
+ clientToken: 'fake-client-token',
338
+ rumConfiguration: {
339
+ applicationId: 'fake-app-id',
340
+ nativeIosResourceTrackingDisallowList: disallowList
341
+ }
342
+ }
343
+ });
344
+ expect(
345
+ config.rumConfiguration?.nativeIosResourceTrackingDisallowList
346
+ ).toEqual(disallowList);
347
+ });
348
+
270
349
  it('applies event mappers to configuration when provided', () => {
271
350
  const actionEventMapper = () => null;
272
351
  const errorEventMapper = () => null;
@@ -28,6 +28,8 @@
28
28
  "initialResourceThreshold": 456,
29
29
  "nativeViewTracking": true,
30
30
  "nativeInteractionTracking": true,
31
+ "nativeIosResourceTracking": true,
32
+ "nativeIosResourceTrackingDisallowList": ["https://3p.example.com/*"],
31
33
  "nativeLongTaskThresholdMs": 789,
32
34
  "nativeCrashReportEnabled": true,
33
35
  "trackBackgroundEvents": true,
@@ -28,6 +28,8 @@ export type AutoInstrumentationConfiguration = {
28
28
  readonly nativeCrashReportEnabled?: boolean;
29
29
  readonly nativeLongTaskThresholdMs?: number;
30
30
  readonly nativeViewTracking?: boolean;
31
+ readonly nativeIosResourceTracking?: boolean;
32
+ readonly nativeIosResourceTrackingDisallowList?: string[];
31
33
  readonly actionEventMapper?: ActionEventMapper | null;
32
34
  readonly errorEventMapper?: ErrorEventMapper | null;
33
35
  readonly resourceEventMapper?: ResourceEventMapper | null;
@@ -53,6 +55,8 @@ export type AutoInstrumentationParameters = {
53
55
  readonly nativeCrashReportEnabled?: boolean;
54
56
  readonly nativeLongTaskThresholdMs?: number;
55
57
  readonly nativeViewTracking?: boolean;
58
+ readonly nativeIosResourceTracking?: boolean;
59
+ readonly nativeIosResourceTrackingDisallowList?: string[];
56
60
  readonly actionEventMapper: ActionEventMapper | null;
57
61
  readonly errorEventMapper: ErrorEventMapper | null;
58
62
  readonly resourceEventMapper: ResourceEventMapper | null;
@@ -117,6 +121,11 @@ export const addDefaultValuesToAutoInstrumentationConfiguration = (
117
121
  nativeViewTracking:
118
122
  features.rumConfiguration.nativeViewTracking ??
119
123
  RUM_DEFAULTS.nativeViewTracking,
124
+ // No default on purpose: undefined means legacy iOS behavior
125
+ nativeIosResourceTracking:
126
+ features.rumConfiguration.nativeIosResourceTracking,
127
+ nativeIosResourceTrackingDisallowList:
128
+ features.rumConfiguration.nativeIosResourceTrackingDisallowList,
120
129
  firstPartyHosts:
121
130
  features.rumConfiguration.firstPartyHosts ||
122
131
  RUM_DEFAULTS.getFirstPartyHosts()
@@ -36,6 +36,8 @@ export type PartialInitializationConfiguration = {
36
36
  readonly nativeCrashReportEnabled?: boolean;
37
37
  readonly nativeViewTracking?: boolean;
38
38
  readonly nativeInteractionTracking?: boolean;
39
+ readonly nativeIosResourceTracking?: boolean;
40
+ readonly nativeIosResourceTrackingDisallowList?: string[];
39
41
  readonly longTaskThresholdMs?: number | false;
40
42
  readonly vitalsUpdateFrequency?: VitalsUpdateFrequency;
41
43
  readonly trackFrustrations?: boolean;
@@ -26,6 +26,8 @@ const DEFAULTS = {
26
26
  nativeCrashReportEnabled: false,
27
27
  nativeInteractionTracking: false,
28
28
  nativeLongTaskThresholdMs: 200,
29
+ nativeIosResourceTracking: undefined,
30
+ nativeIosResourceTrackingDisallowList: undefined,
29
31
  nativeViewTracking: false,
30
32
  resourceEventMapper: null,
31
33
  resourceTraceSampleRate: 100.0,
@@ -85,6 +87,14 @@ export class RumConfiguration implements RumConfigurationType {
85
87
  public nativeLongTaskThresholdMs: number =
86
88
  DEFAULTS.nativeLongTaskThresholdMs;
87
89
 
90
+ // Native Resource Tracking (iOS only); undefined means legacy behavior
91
+ public nativeIosResourceTracking?: boolean =
92
+ DEFAULTS.nativeIosResourceTracking;
93
+
94
+ // URL patterns excluded from native iOS resource tracking; undefined means [] on iOS
95
+ public nativeIosResourceTrackingDisallowList?: string[] =
96
+ DEFAULTS.nativeIosResourceTrackingDisallowList;
97
+
88
98
  // Native View Tracking enabled
89
99
  public nativeViewTracking: boolean = DEFAULTS.nativeViewTracking;
90
100
 
@@ -109,6 +109,29 @@ export interface RumConfigurationOptions {
109
109
  */
110
110
  nativeViewTracking?: boolean;
111
111
 
112
+ /**
113
+ * Controls automatic native network (URLSession) resource tracking. iOS only: has no effect on Android.
114
+ * - `undefined` (default): legacy behavior, enables iOS network tracking if `firstPartyHosts` is defined.
115
+ * - `true`: enables iOS network tracking (with trace headers for `firstPartyHosts`, if defined).
116
+ * - `false`: disables iOS network tracking.
117
+ */
118
+ nativeIosResourceTracking?: boolean;
119
+
120
+ /**
121
+ * URL patterns excluded from automatic native iOS network (URLSession) resource tracking.
122
+ * iOS only: has no effect on Android.
123
+ * - Patterns are matched against the full URL: plain strings match exactly, `*` matches any characters.
124
+ * - Patterns without any literal characters (e.g. `"*"`) are ignored.
125
+ * - Matching requests also get no trace headers injected and no APM span.
126
+ *
127
+ * Only takes effect when native iOS resource tracking is enabled (see `nativeIosResourceTracking`);
128
+ * it never enables tracking by itself. If set while tracking is disabled, the native SDK logs
129
+ * a warning (subject to `verbosity`).
130
+ *
131
+ * Default: `[]` (no URLs excluded).
132
+ */
133
+ nativeIosResourceTrackingDisallowList?: string[];
134
+
112
135
  /**
113
136
  * Custom mapper to transform RUM resource events.
114
137
  */
@@ -15,6 +15,8 @@ export type RumNativeConfiguration = {
15
15
  readonly nativeLongTaskThresholdMs: number;
16
16
  readonly nativeViewTracking: boolean;
17
17
  readonly nativeInteractionTracking: boolean;
18
+ readonly nativeIosResourceTracking: boolean | undefined;
19
+ readonly nativeIosResourceTrackingDisallowList: string[] | undefined;
18
20
  readonly trackNonFatalAnrs: boolean | undefined;
19
21
  readonly appHangThreshold: number | undefined;
20
22
  readonly trackWatchdogTerminations: boolean | undefined;