@datadog/mobile-react-native 3.11.0 → 3.13.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.
- package/DatadogSDKReactNative.podspec +357 -14
- package/README.md +5 -3
- package/android/build.gradle +23 -14
- package/android/src/main/kotlin/com/datadog/reactnative/DdSdkConfiguration.kt +27 -2
- package/android/src/main/kotlin/com/datadog/reactnative/DdSdkConfigurationExt.kt +27 -2
- package/android/src/main/kotlin/com/datadog/reactnative/DdSdkNativeInitialization.kt +25 -0
- package/android/src/main/kotlin/com/datadog/reactnative/SdkVersion.kt +1 -1
- package/android/src/test/kotlin/com/datadog/reactnative/DdSdkNativeInitializationTest.kt +4 -0
- package/android/src/test/kotlin/com/datadog/reactnative/DdSdkTest.kt +104 -0
- package/android/src/test/kotlin/com/datadog/tools/unit/DdSdkConfigurationExt.kt +8 -0
- package/android/src/test/resources/input/complete-configuration.json +5 -0
- package/datadog-configuration.gradle +59 -18
- package/datadog-configuration.schema.json +140 -0
- package/ios/Sources/DdFlagsImplementation.swift +3 -0
- package/ios/Sources/DdSdkConfiguration.swift +11 -1
- package/ios/Sources/DdSdkNativeInitialization.swift +24 -2
- package/ios/Sources/RNDdSdkConfiguration.swift +14 -2
- package/ios/Sources/SdkVersion.swift +1 -1
- package/lib/commonjs/DdSdkReactNative.js +6 -1
- package/lib/commonjs/DdSdkReactNative.js.map +1 -1
- package/lib/commonjs/config/FileBasedConfiguration.js +4 -1
- package/lib/commonjs/config/FileBasedConfiguration.js.map +1 -1
- package/lib/commonjs/config/async/AutoInstrumentationConfiguration.js +3 -1
- package/lib/commonjs/config/async/AutoInstrumentationConfiguration.js.map +1 -1
- package/lib/commonjs/config/features/RumConfiguration.js +8 -0
- package/lib/commonjs/config/features/RumConfiguration.js.map +1 -1
- package/lib/commonjs/config/features/RumConfigurationNative.js +4 -0
- package/lib/commonjs/config/types/TimeseriesConfiguration.js +25 -0
- package/lib/commonjs/config/types/TimeseriesConfiguration.js.map +1 -0
- package/lib/commonjs/config/types/index.js +7 -0
- package/lib/commonjs/config/types/index.js.map +1 -1
- package/lib/commonjs/flags/DdFlags.js +4 -2
- package/lib/commonjs/flags/DdFlags.js.map +1 -1
- package/lib/commonjs/flags/FlagsClient.js +4 -2
- package/lib/commonjs/flags/FlagsClient.js.map +1 -1
- package/lib/commonjs/index.js +7 -0
- package/lib/commonjs/index.js.map +1 -1
- package/lib/commonjs/internal.js +97 -0
- package/lib/commonjs/internal.js.map +1 -0
- package/lib/commonjs/logs/DdLogs.js +4 -2
- package/lib/commonjs/logs/DdLogs.js.map +1 -1
- package/lib/commonjs/rum/DdRum.js +4 -2
- package/lib/commonjs/rum/DdRum.js.map +1 -1
- package/lib/commonjs/rum/instrumentation/interactionTracking/DdBabelInteractionTracking.js +20 -15
- package/lib/commonjs/rum/instrumentation/interactionTracking/DdBabelInteractionTracking.js.map +1 -1
- package/lib/commonjs/rum/instrumentation/resourceTracking/DdRumResourceTracking.js +5 -2
- package/lib/commonjs/rum/instrumentation/resourceTracking/DdRumResourceTracking.js.map +1 -1
- package/lib/commonjs/rum/instrumentation/resourceTracking/distributedTracing/firstPartyHosts.js +2 -1
- package/lib/commonjs/rum/instrumentation/resourceTracking/distributedTracing/firstPartyHosts.js.map +1 -1
- package/lib/commonjs/rum/instrumentation/resourceTracking/headerCapture/README.md +142 -0
- package/lib/commonjs/rum/instrumentation/resourceTracking/headerCapture/captureHeaders.js +308 -0
- package/lib/commonjs/rum/instrumentation/resourceTracking/headerCapture/captureHeaders.js.map +1 -0
- package/lib/commonjs/rum/instrumentation/resourceTracking/headerCapture/compileHeaderConfig.js +275 -0
- package/lib/commonjs/rum/instrumentation/resourceTracking/headerCapture/compileHeaderConfig.js.map +1 -0
- package/lib/commonjs/rum/instrumentation/resourceTracking/headerCapture/enforceSizeLimits.js +167 -0
- package/lib/commonjs/rum/instrumentation/resourceTracking/headerCapture/enforceSizeLimits.js.map +1 -0
- package/lib/commonjs/rum/instrumentation/resourceTracking/headerCapture/isHeaderAllowed.js +36 -0
- package/lib/commonjs/rum/instrumentation/resourceTracking/headerCapture/isHeaderAllowed.js.map +1 -0
- package/lib/commonjs/rum/instrumentation/resourceTracking/headerCapture/normalizeUrlForMatching.js +158 -0
- package/lib/commonjs/rum/instrumentation/resourceTracking/headerCapture/normalizeUrlForMatching.js.map +1 -0
- package/lib/commonjs/rum/instrumentation/resourceTracking/headerCapture/parseResponseHeaders.js +58 -0
- package/lib/commonjs/rum/instrumentation/resourceTracking/headerCapture/parseResponseHeaders.js.map +1 -0
- package/lib/commonjs/rum/instrumentation/resourceTracking/headerCapture/sensitiveHeaderBlocklist.js +39 -0
- package/lib/commonjs/rum/instrumentation/resourceTracking/headerCapture/sensitiveHeaderBlocklist.js.map +1 -0
- package/lib/commonjs/rum/instrumentation/resourceTracking/headerCapture/tracingHeaderExclusion.js +38 -0
- package/lib/commonjs/rum/instrumentation/resourceTracking/headerCapture/tracingHeaderExclusion.js.map +1 -0
- package/lib/commonjs/rum/instrumentation/resourceTracking/headerCapture/types.js +2 -0
- package/lib/commonjs/rum/instrumentation/resourceTracking/headerCapture/types.js.map +1 -0
- package/lib/commonjs/rum/instrumentation/resourceTracking/requestProxy/FetchProxy/FetchProxy.js +17 -2
- package/lib/commonjs/rum/instrumentation/resourceTracking/requestProxy/FetchProxy/FetchProxy.js.map +1 -1
- package/lib/commonjs/rum/instrumentation/resourceTracking/requestProxy/XHRProxy/XHRProxy.js +25 -3
- package/lib/commonjs/rum/instrumentation/resourceTracking/requestProxy/XHRProxy/XHRProxy.js.map +1 -1
- package/lib/commonjs/rum/instrumentation/resourceTracking/requestProxy/XHRProxy/baggageHeaderUtils.js +2 -35
- package/lib/commonjs/rum/instrumentation/resourceTracking/requestProxy/XHRProxy/baggageHeaderUtils.js.map +1 -1
- package/lib/commonjs/rum/instrumentation/resourceTracking/requestProxy/common/RequestContext.js +3 -1
- package/lib/commonjs/rum/instrumentation/resourceTracking/requestProxy/common/RequestContext.js.map +1 -1
- package/lib/commonjs/rum/instrumentation/resourceTracking/requestProxy/common/ResourceReporter.js +8 -2
- package/lib/commonjs/rum/instrumentation/resourceTracking/requestProxy/common/ResourceReporter.js.map +1 -1
- package/lib/commonjs/rum/instrumentation/resourceTracking/requestProxy/common/headerCapture.js +88 -0
- package/lib/commonjs/rum/instrumentation/resourceTracking/requestProxy/common/headerCapture.js.map +1 -0
- package/lib/commonjs/rum/instrumentation/resourceTracking/requestProxy/interfaces/RequestProxy.js.map +1 -1
- package/lib/commonjs/sdk/DatadogEventEmitter/DatadogDefaultEventEmitter.js +2 -3
- package/lib/commonjs/sdk/DatadogEventEmitter/DatadogDefaultEventEmitter.js.map +1 -1
- package/lib/commonjs/sdk/DdSdkInternal.js +27 -22
- package/lib/commonjs/sdk/DdSdkInternal.js.map +1 -1
- package/lib/commonjs/specs/NativeDdFlags.js +19 -3
- package/lib/commonjs/specs/NativeDdFlags.js.map +1 -1
- package/lib/commonjs/specs/NativeDdLogs.js +19 -3
- package/lib/commonjs/specs/NativeDdLogs.js.map +1 -1
- package/lib/commonjs/specs/NativeDdRum.js +19 -3
- package/lib/commonjs/specs/NativeDdRum.js.map +1 -1
- package/lib/commonjs/specs/NativeDdSdk.js +19 -3
- package/lib/commonjs/specs/NativeDdSdk.js.map +1 -1
- package/lib/commonjs/specs/NativeDdTrace.js +19 -3
- package/lib/commonjs/specs/NativeDdTrace.js.map +1 -1
- package/lib/commonjs/trace/DdTrace.js +4 -2
- package/lib/commonjs/trace/DdTrace.js.map +1 -1
- package/lib/commonjs/utils/stringUtils.js +48 -0
- package/lib/commonjs/utils/stringUtils.js.map +1 -0
- package/lib/commonjs/version.js +1 -1
- package/lib/module/DdSdkReactNative.js +6 -1
- package/lib/module/DdSdkReactNative.js.map +1 -1
- package/lib/module/config/FileBasedConfiguration.js +4 -1
- package/lib/module/config/FileBasedConfiguration.js.map +1 -1
- package/lib/module/config/async/AutoInstrumentationConfiguration.js +3 -1
- package/lib/module/config/async/AutoInstrumentationConfiguration.js.map +1 -1
- package/lib/module/config/features/RumConfiguration.js +8 -0
- package/lib/module/config/features/RumConfiguration.js.map +1 -1
- package/lib/module/config/features/RumConfigurationNative.js +1 -1
- package/lib/module/config/types/TimeseriesConfiguration.js +19 -0
- package/lib/module/config/types/TimeseriesConfiguration.js.map +1 -0
- package/lib/module/config/types/index.js +1 -0
- package/lib/module/config/types/index.js.map +1 -1
- package/lib/module/flags/DdFlags.js +4 -2
- package/lib/module/flags/DdFlags.js.map +1 -1
- package/lib/module/flags/FlagsClient.js +5 -2
- package/lib/module/flags/FlagsClient.js.map +1 -1
- package/lib/module/index.js +2 -1
- package/lib/module/index.js.map +1 -1
- package/lib/module/internal.js +27 -0
- package/lib/module/internal.js.map +1 -0
- package/lib/module/logs/DdLogs.js +4 -2
- package/lib/module/logs/DdLogs.js.map +1 -1
- package/lib/module/rum/DdRum.js +4 -2
- package/lib/module/rum/DdRum.js.map +1 -1
- package/lib/module/rum/instrumentation/interactionTracking/DdBabelInteractionTracking.js +20 -14
- package/lib/module/rum/instrumentation/interactionTracking/DdBabelInteractionTracking.js.map +1 -1
- package/lib/module/rum/instrumentation/resourceTracking/DdRumResourceTracking.js +5 -2
- package/lib/module/rum/instrumentation/resourceTracking/DdRumResourceTracking.js.map +1 -1
- package/lib/module/rum/instrumentation/resourceTracking/distributedTracing/firstPartyHosts.js +1 -1
- package/lib/module/rum/instrumentation/resourceTracking/distributedTracing/firstPartyHosts.js.map +1 -1
- package/lib/module/rum/instrumentation/resourceTracking/headerCapture/README.md +142 -0
- package/lib/module/rum/instrumentation/resourceTracking/headerCapture/captureHeaders.js +298 -0
- package/lib/module/rum/instrumentation/resourceTracking/headerCapture/captureHeaders.js.map +1 -0
- package/lib/module/rum/instrumentation/resourceTracking/headerCapture/compileHeaderConfig.js +268 -0
- package/lib/module/rum/instrumentation/resourceTracking/headerCapture/compileHeaderConfig.js.map +1 -0
- package/lib/module/rum/instrumentation/resourceTracking/headerCapture/enforceSizeLimits.js +160 -0
- package/lib/module/rum/instrumentation/resourceTracking/headerCapture/enforceSizeLimits.js.map +1 -0
- package/lib/module/rum/instrumentation/resourceTracking/headerCapture/isHeaderAllowed.js +30 -0
- package/lib/module/rum/instrumentation/resourceTracking/headerCapture/isHeaderAllowed.js.map +1 -0
- package/lib/module/rum/instrumentation/resourceTracking/headerCapture/normalizeUrlForMatching.js +150 -0
- package/lib/module/rum/instrumentation/resourceTracking/headerCapture/normalizeUrlForMatching.js.map +1 -0
- package/lib/module/rum/instrumentation/resourceTracking/headerCapture/parseResponseHeaders.js +51 -0
- package/lib/module/rum/instrumentation/resourceTracking/headerCapture/parseResponseHeaders.js.map +1 -0
- package/lib/module/rum/instrumentation/resourceTracking/headerCapture/sensitiveHeaderBlocklist.js +32 -0
- package/lib/module/rum/instrumentation/resourceTracking/headerCapture/sensitiveHeaderBlocklist.js.map +1 -0
- package/lib/module/rum/instrumentation/resourceTracking/headerCapture/tracingHeaderExclusion.js +32 -0
- package/lib/module/rum/instrumentation/resourceTracking/headerCapture/tracingHeaderExclusion.js.map +1 -0
- package/lib/module/rum/instrumentation/resourceTracking/headerCapture/types.js +2 -0
- package/lib/module/rum/instrumentation/resourceTracking/headerCapture/types.js.map +1 -0
- package/lib/module/rum/instrumentation/resourceTracking/requestProxy/FetchProxy/FetchProxy.js +17 -2
- package/lib/module/rum/instrumentation/resourceTracking/requestProxy/FetchProxy/FetchProxy.js.map +1 -1
- package/lib/module/rum/instrumentation/resourceTracking/requestProxy/XHRProxy/XHRProxy.js +25 -3
- package/lib/module/rum/instrumentation/resourceTracking/requestProxy/XHRProxy/XHRProxy.js.map +1 -1
- package/lib/module/rum/instrumentation/resourceTracking/requestProxy/XHRProxy/baggageHeaderUtils.js +1 -34
- package/lib/module/rum/instrumentation/resourceTracking/requestProxy/XHRProxy/baggageHeaderUtils.js.map +1 -1
- package/lib/module/rum/instrumentation/resourceTracking/requestProxy/common/RequestContext.js +3 -1
- package/lib/module/rum/instrumentation/resourceTracking/requestProxy/common/RequestContext.js.map +1 -1
- package/lib/module/rum/instrumentation/resourceTracking/requestProxy/common/ResourceReporter.js +8 -2
- package/lib/module/rum/instrumentation/resourceTracking/requestProxy/common/ResourceReporter.js.map +1 -1
- package/lib/module/rum/instrumentation/resourceTracking/requestProxy/common/headerCapture.js +79 -0
- package/lib/module/rum/instrumentation/resourceTracking/requestProxy/common/headerCapture.js.map +1 -0
- package/lib/module/rum/instrumentation/resourceTracking/requestProxy/interfaces/RequestProxy.js.map +1 -1
- package/lib/module/sdk/DatadogEventEmitter/DatadogDefaultEventEmitter.js +2 -3
- package/lib/module/sdk/DatadogEventEmitter/DatadogDefaultEventEmitter.js.map +1 -1
- package/lib/module/sdk/DdSdkInternal.js +27 -22
- package/lib/module/sdk/DdSdkInternal.js.map +1 -1
- package/lib/module/specs/NativeDdFlags.js +14 -2
- package/lib/module/specs/NativeDdFlags.js.map +1 -1
- package/lib/module/specs/NativeDdLogs.js +14 -2
- package/lib/module/specs/NativeDdLogs.js.map +1 -1
- package/lib/module/specs/NativeDdRum.js +14 -2
- package/lib/module/specs/NativeDdRum.js.map +1 -1
- package/lib/module/specs/NativeDdSdk.js +14 -2
- package/lib/module/specs/NativeDdSdk.js.map +1 -1
- package/lib/module/specs/NativeDdTrace.js +14 -2
- package/lib/module/specs/NativeDdTrace.js.map +1 -1
- package/lib/module/trace/DdTrace.js +4 -2
- package/lib/module/trace/DdTrace.js.map +1 -1
- package/lib/module/utils/stringUtils.js +42 -0
- package/lib/module/utils/stringUtils.js.map +1 -0
- package/lib/module/version.js +1 -1
- package/lib/typescript/DdSdkReactNative.d.ts.map +1 -1
- package/lib/typescript/config/FileBasedConfiguration.d.ts.map +1 -1
- package/lib/typescript/config/FileBasedConfiguration.type.d.ts +4 -1
- package/lib/typescript/config/FileBasedConfiguration.type.d.ts.map +1 -1
- package/lib/typescript/config/async/AutoInstrumentationConfiguration.d.ts +6 -0
- package/lib/typescript/config/async/AutoInstrumentationConfiguration.d.ts.map +1 -1
- package/lib/typescript/config/async/PartialInitializationConfiguration.d.ts +2 -1
- package/lib/typescript/config/async/PartialInitializationConfiguration.d.ts.map +1 -1
- package/lib/typescript/config/features/RumConfiguration.d.ts +6 -1
- package/lib/typescript/config/features/RumConfiguration.d.ts.map +1 -1
- package/lib/typescript/config/features/RumConfiguration.type.d.ts +116 -1
- package/lib/typescript/config/features/RumConfiguration.type.d.ts.map +1 -1
- package/lib/typescript/config/features/RumConfigurationNative.d.ts +2 -0
- package/lib/typescript/config/features/RumConfigurationNative.d.ts.map +1 -1
- package/lib/typescript/config/types/TimeseriesConfiguration.d.ts +19 -0
- package/lib/typescript/config/types/TimeseriesConfiguration.d.ts.map +1 -0
- package/lib/typescript/config/types/index.d.ts +2 -0
- package/lib/typescript/config/types/index.d.ts.map +1 -1
- package/lib/typescript/flags/DdFlags.d.ts.map +1 -1
- package/lib/typescript/flags/FlagsClient.d.ts +1 -1
- package/lib/typescript/flags/FlagsClient.d.ts.map +1 -1
- package/lib/typescript/index.d.ts +5 -2
- package/lib/typescript/index.d.ts.map +1 -1
- package/lib/typescript/internal.d.ts +26 -0
- package/lib/typescript/internal.d.ts.map +1 -0
- package/lib/typescript/logs/DdLogs.d.ts +1 -1
- package/lib/typescript/logs/DdLogs.d.ts.map +1 -1
- package/lib/typescript/rum/DdRum.d.ts +1 -1
- package/lib/typescript/rum/DdRum.d.ts.map +1 -1
- package/lib/typescript/rum/instrumentation/interactionTracking/DdBabelInteractionTracking.d.ts.map +1 -1
- package/lib/typescript/rum/instrumentation/resourceTracking/DdRumResourceTracking.d.ts +3 -1
- package/lib/typescript/rum/instrumentation/resourceTracking/DdRumResourceTracking.d.ts.map +1 -1
- package/lib/typescript/rum/instrumentation/resourceTracking/distributedTracing/firstPartyHosts.d.ts +1 -0
- package/lib/typescript/rum/instrumentation/resourceTracking/distributedTracing/firstPartyHosts.d.ts.map +1 -1
- package/lib/typescript/rum/instrumentation/resourceTracking/headerCapture/captureHeaders.d.ts +85 -0
- package/lib/typescript/rum/instrumentation/resourceTracking/headerCapture/captureHeaders.d.ts.map +1 -0
- package/lib/typescript/rum/instrumentation/resourceTracking/headerCapture/compileHeaderConfig.d.ts +18 -0
- package/lib/typescript/rum/instrumentation/resourceTracking/headerCapture/compileHeaderConfig.d.ts.map +1 -0
- package/lib/typescript/rum/instrumentation/resourceTracking/headerCapture/enforceSizeLimits.d.ts +24 -0
- package/lib/typescript/rum/instrumentation/resourceTracking/headerCapture/enforceSizeLimits.d.ts.map +1 -0
- package/lib/typescript/rum/instrumentation/resourceTracking/headerCapture/isHeaderAllowed.d.ts +12 -0
- package/lib/typescript/rum/instrumentation/resourceTracking/headerCapture/isHeaderAllowed.d.ts.map +1 -0
- package/lib/typescript/rum/instrumentation/resourceTracking/headerCapture/normalizeUrlForMatching.d.ts +28 -0
- package/lib/typescript/rum/instrumentation/resourceTracking/headerCapture/normalizeUrlForMatching.d.ts.map +1 -0
- package/lib/typescript/rum/instrumentation/resourceTracking/headerCapture/parseResponseHeaders.d.ts +16 -0
- package/lib/typescript/rum/instrumentation/resourceTracking/headerCapture/parseResponseHeaders.d.ts.map +1 -0
- package/lib/typescript/rum/instrumentation/resourceTracking/headerCapture/sensitiveHeaderBlocklist.d.ts +13 -0
- package/lib/typescript/rum/instrumentation/resourceTracking/headerCapture/sensitiveHeaderBlocklist.d.ts.map +1 -0
- package/lib/typescript/rum/instrumentation/resourceTracking/headerCapture/tracingHeaderExclusion.d.ts +13 -0
- package/lib/typescript/rum/instrumentation/resourceTracking/headerCapture/tracingHeaderExclusion.d.ts.map +1 -0
- package/lib/typescript/rum/instrumentation/resourceTracking/headerCapture/types.d.ts +27 -0
- package/lib/typescript/rum/instrumentation/resourceTracking/headerCapture/types.d.ts.map +1 -0
- package/lib/typescript/rum/instrumentation/resourceTracking/requestProxy/FetchProxy/FetchProxy.d.ts.map +1 -1
- package/lib/typescript/rum/instrumentation/resourceTracking/requestProxy/XHRProxy/XHRProxy.d.ts.map +1 -1
- package/lib/typescript/rum/instrumentation/resourceTracking/requestProxy/XHRProxy/baggageHeaderUtils.d.ts.map +1 -1
- package/lib/typescript/rum/instrumentation/resourceTracking/requestProxy/common/RequestContext.d.ts +2 -0
- package/lib/typescript/rum/instrumentation/resourceTracking/requestProxy/common/RequestContext.d.ts.map +1 -1
- package/lib/typescript/rum/instrumentation/resourceTracking/requestProxy/common/headerCapture.d.ts +43 -0
- package/lib/typescript/rum/instrumentation/resourceTracking/requestProxy/common/headerCapture.d.ts.map +1 -0
- package/lib/typescript/rum/instrumentation/resourceTracking/requestProxy/interfaces/RequestProxy.d.ts +2 -0
- package/lib/typescript/rum/instrumentation/resourceTracking/requestProxy/interfaces/RequestProxy.d.ts.map +1 -1
- package/lib/typescript/rum/instrumentation/resourceTracking/requestProxy/interfaces/RumResource.d.ts +2 -0
- package/lib/typescript/rum/instrumentation/resourceTracking/requestProxy/interfaces/RumResource.d.ts.map +1 -1
- package/lib/typescript/sdk/DatadogEventEmitter/DatadogDefaultEventEmitter.d.ts.map +1 -1
- package/lib/typescript/sdk/DdSdkInternal.d.ts +1 -0
- package/lib/typescript/sdk/DdSdkInternal.d.ts.map +1 -1
- package/lib/typescript/specs/NativeDdFlags.d.ts +7 -2
- package/lib/typescript/specs/NativeDdFlags.d.ts.map +1 -1
- package/lib/typescript/specs/NativeDdLogs.d.ts +7 -2
- package/lib/typescript/specs/NativeDdLogs.d.ts.map +1 -1
- package/lib/typescript/specs/NativeDdRum.d.ts +7 -2
- package/lib/typescript/specs/NativeDdRum.d.ts.map +1 -1
- package/lib/typescript/specs/NativeDdSdk.d.ts +7 -2
- package/lib/typescript/specs/NativeDdSdk.d.ts.map +1 -1
- package/lib/typescript/specs/NativeDdTrace.d.ts +7 -2
- package/lib/typescript/specs/NativeDdTrace.d.ts.map +1 -1
- package/lib/typescript/trace/DdTrace.d.ts.map +1 -1
- package/lib/typescript/utils/stringUtils.d.ts +12 -0
- package/lib/typescript/utils/stringUtils.d.ts.map +1 -0
- package/lib/typescript/version.d.ts +1 -1
- package/package.json +8 -3
- package/src/DdSdkReactNative.tsx +11 -1
- package/src/__tests__/DdSdkReactNative.test.tsx +145 -20
- package/src/__tests__/DdSdkReactNativeConfiguration.test.ts +6 -0
- package/src/__tests__/internalEntry.test.ts +26 -0
- package/src/__tests__/mock.test.ts +1 -3
- package/src/__tests__/nativeSpecGetters.test.ts +102 -0
- package/src/__tests__/rum/instrumentation/DdRumUserInteractionTracking.test.tsx +3 -3
- package/src/__tests__/wrapperImportSafety.test.ts +129 -0
- package/src/config/FileBasedConfiguration.ts +6 -1
- package/src/config/FileBasedConfiguration.type.ts +4 -0
- package/src/config/__tests__/FileBasedConfiguration.test.ts +73 -0
- package/src/config/__tests__/__fixtures__/configuration-all-fields.json +14 -1
- package/src/config/async/AutoInstrumentationConfiguration.ts +9 -1
- package/src/config/async/PartialInitializationConfiguration.ts +2 -0
- package/src/config/features/RumConfiguration.ts +15 -0
- package/src/config/features/RumConfiguration.type.ts +128 -1
- package/src/config/features/RumConfigurationNative.ts +3 -0
- package/src/config/types/TimeseriesConfiguration.ts +26 -0
- package/src/config/types/index.ts +5 -0
- package/src/flags/DdFlags.ts +4 -3
- package/src/flags/FlagsClient.ts +4 -3
- package/src/index.tsx +15 -0
- package/src/internal.ts +32 -0
- package/src/logs/DdLogs.ts +4 -3
- package/src/rum/DdRum.ts +4 -3
- package/src/rum/__tests__/DdRum.test.ts +4 -4
- package/src/rum/instrumentation/interactionTracking/DdBabelInteractionTracking.ts +33 -26
- package/src/rum/instrumentation/interactionTracking/__tests__/BabelOptionalHandlers.test.ts +120 -0
- package/src/rum/instrumentation/interactionTracking/__tests__/DdBabelInteractionTracking.test.ts +82 -2
- package/src/rum/instrumentation/resourceTracking/DdRumResourceTracking.tsx +7 -2
- package/src/rum/instrumentation/resourceTracking/__tests__/DdRumResourceTracking.test.ts +46 -0
- package/src/rum/instrumentation/resourceTracking/__tests__/__utils__/XMLHttpRequestMock.ts +1 -1
- package/src/rum/instrumentation/resourceTracking/distributedTracing/firstPartyHosts.ts +1 -1
- package/src/rum/instrumentation/resourceTracking/headerCapture/README.md +142 -0
- package/src/rum/instrumentation/resourceTracking/headerCapture/__tests__/captureHeaders.test.ts +853 -0
- package/src/rum/instrumentation/resourceTracking/headerCapture/__tests__/compileHeaderConfig.test.ts +697 -0
- package/src/rum/instrumentation/resourceTracking/headerCapture/__tests__/enforceSizeLimits.integration.test.ts +183 -0
- package/src/rum/instrumentation/resourceTracking/headerCapture/__tests__/enforceSizeLimits.test.ts +337 -0
- package/src/rum/instrumentation/resourceTracking/headerCapture/__tests__/isHeaderAllowed.test.ts +35 -0
- package/src/rum/instrumentation/resourceTracking/headerCapture/__tests__/normalizeUrlForMatching.test.ts +176 -0
- package/src/rum/instrumentation/resourceTracking/headerCapture/__tests__/parseResponseHeaders.test.ts +114 -0
- package/src/rum/instrumentation/resourceTracking/headerCapture/__tests__/sensitiveHeaderBlocklist.test.ts +112 -0
- package/src/rum/instrumentation/resourceTracking/headerCapture/__tests__/tracingHeaderExclusion.test.ts +59 -0
- package/src/rum/instrumentation/resourceTracking/headerCapture/captureHeaders.ts +437 -0
- package/src/rum/instrumentation/resourceTracking/headerCapture/compileHeaderConfig.ts +339 -0
- package/src/rum/instrumentation/resourceTracking/headerCapture/enforceSizeLimits.ts +208 -0
- package/src/rum/instrumentation/resourceTracking/headerCapture/isHeaderAllowed.ts +29 -0
- package/src/rum/instrumentation/resourceTracking/headerCapture/normalizeUrlForMatching.ts +181 -0
- package/src/rum/instrumentation/resourceTracking/headerCapture/parseResponseHeaders.ts +59 -0
- package/src/rum/instrumentation/resourceTracking/headerCapture/sensitiveHeaderBlocklist.ts +31 -0
- package/src/rum/instrumentation/resourceTracking/headerCapture/tracingHeaderExclusion.ts +61 -0
- package/src/rum/instrumentation/resourceTracking/headerCapture/types.ts +33 -0
- package/src/rum/instrumentation/resourceTracking/requestProxy/FetchProxy/FetchProxy.ts +21 -2
- package/src/rum/instrumentation/resourceTracking/requestProxy/FetchProxy/__tests__/FetchProxy.test.ts +274 -0
- package/src/rum/instrumentation/resourceTracking/requestProxy/XHRProxy/DatadogRumResource/__tests__/ResourceReporter.test.ts +120 -0
- package/src/rum/instrumentation/resourceTracking/requestProxy/XHRProxy/XHRProxy.ts +34 -3
- package/src/rum/instrumentation/resourceTracking/requestProxy/XHRProxy/__tests__/XHRProxy.test.ts +624 -2
- package/src/rum/instrumentation/resourceTracking/requestProxy/XHRProxy/baggageHeaderUtils.ts +1 -34
- package/src/rum/instrumentation/resourceTracking/requestProxy/common/RequestContext.ts +6 -1
- package/src/rum/instrumentation/resourceTracking/requestProxy/common/ResourceReporter.ts +16 -2
- package/src/rum/instrumentation/resourceTracking/requestProxy/common/__tests__/headerCapture.test.ts +164 -0
- package/src/rum/instrumentation/resourceTracking/requestProxy/common/headerCapture.ts +119 -0
- package/src/rum/instrumentation/resourceTracking/requestProxy/interfaces/RequestProxy.ts +2 -0
- package/src/rum/instrumentation/resourceTracking/requestProxy/interfaces/RumResource.ts +2 -0
- package/src/sdk/DatadogEventEmitter/DatadogDefaultEventEmitter.tsx +3 -4
- package/src/sdk/DatadogInternalBridge/__tests__/DdSdkNativeBridge.test.tsx +35 -2
- package/src/sdk/DatadogProvider/Buffer/__tests__/BoundedBuffer.test.ts +5 -5
- package/src/sdk/DatadogProvider/__tests__/initialization.test.tsx +54 -1
- package/src/sdk/DdSdkInternal.ts +27 -24
- package/src/sdk/EventMappers/__tests__/EventMapper.test.ts +2 -2
- package/src/specs/NativeDdFlags.ts +14 -2
- package/src/specs/NativeDdLogs.ts +14 -2
- package/src/specs/NativeDdRum.ts +14 -2
- package/src/specs/NativeDdSdk.ts +14 -2
- package/src/specs/NativeDdTrace.ts +14 -2
- package/src/trace/DdTrace.ts +4 -3
- package/src/utils/__tests__/stringUtils.test.ts +90 -0
- package/src/utils/stringUtils.ts +41 -0
- package/src/version.ts +1 -1
|
@@ -8,6 +8,7 @@ import { version as reactNativeVersion } from 'react-native/package.json';
|
|
|
8
8
|
import { NativeModules } from 'react-native';
|
|
9
9
|
|
|
10
10
|
import { DdSdkReactNative } from '../DdSdkReactNative';
|
|
11
|
+
import { InternalLog } from '../InternalLog';
|
|
11
12
|
import type { DdSdkNativeConfiguration } from '../config/features/CoreConfigurationNative';
|
|
12
13
|
import { CoreConfiguration } from '../config/features/CoreConfiguration';
|
|
13
14
|
import { LogsConfiguration } from '../config/features/LogsConfiguration';
|
|
@@ -26,7 +27,7 @@ import { AttributesSingleton } from '../sdk/AttributesSingleton/AttributesSingle
|
|
|
26
27
|
import { DdSdkWrapper } from '../sdk/DdSdkInternal';
|
|
27
28
|
import { GlobalState } from '../sdk/GlobalState/GlobalState';
|
|
28
29
|
import { UserInfoSingleton } from '../sdk/UserInfoSingleton/UserInfoSingleton';
|
|
29
|
-
import
|
|
30
|
+
import { getNativeDdSdk } from '../specs/NativeDdSdk';
|
|
30
31
|
import type { LogEvent } from '../types';
|
|
31
32
|
import { ErrorSource } from '../types';
|
|
32
33
|
import { version as sdkVersion } from '../version';
|
|
@@ -813,10 +814,130 @@ describe('DdSdkReactNative', () => {
|
|
|
813
814
|
propagatorTypes: ['datadog']
|
|
814
815
|
}
|
|
815
816
|
],
|
|
816
|
-
trackFetchResources: true
|
|
817
|
+
trackFetchResources: true,
|
|
818
|
+
headerCaptureRules: undefined
|
|
817
819
|
});
|
|
818
820
|
});
|
|
819
821
|
|
|
822
|
+
it('does not enable header capture when headerCaptureRules is omitted', async () => {
|
|
823
|
+
// GIVEN
|
|
824
|
+
const fakeAppId = '1';
|
|
825
|
+
const fakeClientToken = '2';
|
|
826
|
+
const fakeEnvName = 'env';
|
|
827
|
+
const configuration = new CoreConfiguration(
|
|
828
|
+
fakeClientToken,
|
|
829
|
+
fakeEnvName
|
|
830
|
+
);
|
|
831
|
+
configuration.rumConfiguration = new RumConfiguration(
|
|
832
|
+
fakeAppId,
|
|
833
|
+
false,
|
|
834
|
+
true
|
|
835
|
+
);
|
|
836
|
+
|
|
837
|
+
NativeModules.DdSdk.initialize.mockResolvedValue(null);
|
|
838
|
+
|
|
839
|
+
// WHEN
|
|
840
|
+
await DdSdkReactNative.initialize(configuration);
|
|
841
|
+
|
|
842
|
+
// THEN
|
|
843
|
+
expect(DdRumResourceTracking.startTracking).toHaveBeenCalledWith(
|
|
844
|
+
expect.objectContaining({
|
|
845
|
+
headerCaptureRules: undefined
|
|
846
|
+
})
|
|
847
|
+
);
|
|
848
|
+
});
|
|
849
|
+
|
|
850
|
+
it('enables header capture with the default headerCaptureRules preset', async () => {
|
|
851
|
+
// GIVEN
|
|
852
|
+
const fakeAppId = '1';
|
|
853
|
+
const fakeClientToken = '2';
|
|
854
|
+
const fakeEnvName = 'env';
|
|
855
|
+
const configuration = new CoreConfiguration(
|
|
856
|
+
fakeClientToken,
|
|
857
|
+
fakeEnvName
|
|
858
|
+
);
|
|
859
|
+
configuration.rumConfiguration = new RumConfiguration(
|
|
860
|
+
fakeAppId,
|
|
861
|
+
false,
|
|
862
|
+
true
|
|
863
|
+
);
|
|
864
|
+
configuration.rumConfiguration.headerCaptureRules = 'defaults';
|
|
865
|
+
|
|
866
|
+
NativeModules.DdSdk.initialize.mockResolvedValue(null);
|
|
867
|
+
|
|
868
|
+
// WHEN
|
|
869
|
+
await DdSdkReactNative.initialize(configuration);
|
|
870
|
+
|
|
871
|
+
// THEN
|
|
872
|
+
expect(DdRumResourceTracking.startTracking).toHaveBeenCalledWith(
|
|
873
|
+
expect.objectContaining({
|
|
874
|
+
headerCaptureRules: 'defaults'
|
|
875
|
+
})
|
|
876
|
+
);
|
|
877
|
+
});
|
|
878
|
+
|
|
879
|
+
it('enables header capture with custom headerCaptureRules', async () => {
|
|
880
|
+
// GIVEN
|
|
881
|
+
const fakeAppId = '1';
|
|
882
|
+
const fakeClientToken = '2';
|
|
883
|
+
const fakeEnvName = 'env';
|
|
884
|
+
const configuration = new CoreConfiguration(
|
|
885
|
+
fakeClientToken,
|
|
886
|
+
fakeEnvName
|
|
887
|
+
);
|
|
888
|
+
configuration.rumConfiguration = new RumConfiguration(
|
|
889
|
+
fakeAppId,
|
|
890
|
+
false,
|
|
891
|
+
true
|
|
892
|
+
);
|
|
893
|
+
configuration.rumConfiguration.headerCaptureRules = [
|
|
894
|
+
{ type: 'matchHeaders', headers: ['x-request-id'] }
|
|
895
|
+
];
|
|
896
|
+
|
|
897
|
+
NativeModules.DdSdk.initialize.mockResolvedValue(null);
|
|
898
|
+
|
|
899
|
+
// WHEN
|
|
900
|
+
await DdSdkReactNative.initialize(configuration);
|
|
901
|
+
|
|
902
|
+
// THEN
|
|
903
|
+
expect(DdRumResourceTracking.startTracking).toHaveBeenCalledWith(
|
|
904
|
+
expect.objectContaining({
|
|
905
|
+
headerCaptureRules: [
|
|
906
|
+
{ type: 'matchHeaders', headers: ['x-request-id'] }
|
|
907
|
+
]
|
|
908
|
+
})
|
|
909
|
+
);
|
|
910
|
+
});
|
|
911
|
+
|
|
912
|
+
it('logs a warning and disables header capture when headerCaptureRules is set but trackResources is false', async () => {
|
|
913
|
+
// GIVEN
|
|
914
|
+
const fakeAppId = '1';
|
|
915
|
+
const fakeClientToken = '2';
|
|
916
|
+
const fakeEnvName = 'env';
|
|
917
|
+
const configuration = new CoreConfiguration(
|
|
918
|
+
fakeClientToken,
|
|
919
|
+
fakeEnvName
|
|
920
|
+
);
|
|
921
|
+
configuration.rumConfiguration = new RumConfiguration(
|
|
922
|
+
fakeAppId,
|
|
923
|
+
false,
|
|
924
|
+
false
|
|
925
|
+
);
|
|
926
|
+
configuration.rumConfiguration.headerCaptureRules = 'defaults';
|
|
927
|
+
|
|
928
|
+
NativeModules.DdSdk.initialize.mockResolvedValue(null);
|
|
929
|
+
|
|
930
|
+
// WHEN
|
|
931
|
+
await DdSdkReactNative.initialize(configuration);
|
|
932
|
+
|
|
933
|
+
// THEN
|
|
934
|
+
expect(DdRumResourceTracking.startTracking).not.toHaveBeenCalled();
|
|
935
|
+
expect(InternalLog.log).toHaveBeenCalledWith(
|
|
936
|
+
'headerCaptureRules is set but trackResources is false. Header capture will be disabled.',
|
|
937
|
+
SdkVerbosity.WARN
|
|
938
|
+
);
|
|
939
|
+
});
|
|
940
|
+
|
|
820
941
|
it('enables error tracking feature when initialize { error tracking config enabled }', async () => {
|
|
821
942
|
// GIVEN
|
|
822
943
|
const fakeAppId = '1';
|
|
@@ -1318,8 +1439,8 @@ describe('DdSdkReactNative', () => {
|
|
|
1318
1439
|
await DdSdkReactNative.addAttribute(key, value);
|
|
1319
1440
|
|
|
1320
1441
|
// THEN
|
|
1321
|
-
expect(
|
|
1322
|
-
expect(
|
|
1442
|
+
expect(getNativeDdSdk()?.addAttribute).toHaveBeenCalledTimes(1);
|
|
1443
|
+
expect(getNativeDdSdk()?.addAttribute).toHaveBeenCalledWith(key, {
|
|
1323
1444
|
value
|
|
1324
1445
|
});
|
|
1325
1446
|
expect(AttributesSingleton.getInstance().getAttribute(key)).toEqual(
|
|
@@ -1339,8 +1460,8 @@ describe('DdSdkReactNative', () => {
|
|
|
1339
1460
|
await DdSdkReactNative.removeAttribute(key);
|
|
1340
1461
|
|
|
1341
1462
|
// THEN
|
|
1342
|
-
expect(
|
|
1343
|
-
expect(
|
|
1463
|
+
expect(getNativeDdSdk()?.removeAttribute).toHaveBeenCalledTimes(1);
|
|
1464
|
+
expect(getNativeDdSdk()?.removeAttribute).toHaveBeenCalledWith(key);
|
|
1344
1465
|
expect(AttributesSingleton.getInstance().getAttribute(key)).toEqual(
|
|
1345
1466
|
undefined
|
|
1346
1467
|
);
|
|
@@ -1357,8 +1478,8 @@ describe('DdSdkReactNative', () => {
|
|
|
1357
1478
|
await DdSdkReactNative.addAttributes(attributes);
|
|
1358
1479
|
|
|
1359
1480
|
// THEN
|
|
1360
|
-
expect(
|
|
1361
|
-
expect(
|
|
1481
|
+
expect(getNativeDdSdk()?.addAttributes).toHaveBeenCalledTimes(1);
|
|
1482
|
+
expect(getNativeDdSdk()?.addAttributes).toHaveBeenCalledWith(
|
|
1362
1483
|
attributes
|
|
1363
1484
|
);
|
|
1364
1485
|
expect(AttributesSingleton.getInstance().getAttributes()).toEqual({
|
|
@@ -1377,8 +1498,8 @@ describe('DdSdkReactNative', () => {
|
|
|
1377
1498
|
await DdSdkReactNative.removeAttributes(['foo', 'baz']);
|
|
1378
1499
|
|
|
1379
1500
|
// THEN
|
|
1380
|
-
expect(
|
|
1381
|
-
expect(
|
|
1501
|
+
expect(getNativeDdSdk()?.removeAttributes).toHaveBeenCalledTimes(1);
|
|
1502
|
+
expect(getNativeDdSdk()?.removeAttributes).toHaveBeenCalledWith([
|
|
1382
1503
|
'foo',
|
|
1383
1504
|
'baz'
|
|
1384
1505
|
]);
|
|
@@ -1404,8 +1525,10 @@ describe('DdSdkReactNative', () => {
|
|
|
1404
1525
|
await DdSdkReactNative.setUserInfo(userInfo);
|
|
1405
1526
|
|
|
1406
1527
|
// THEN
|
|
1407
|
-
expect(
|
|
1408
|
-
expect(
|
|
1528
|
+
expect(getNativeDdSdk()?.setUserInfo).toHaveBeenCalledTimes(1);
|
|
1529
|
+
expect(getNativeDdSdk()?.setUserInfo).toHaveBeenCalledWith(
|
|
1530
|
+
userInfo
|
|
1531
|
+
);
|
|
1409
1532
|
expect(UserInfoSingleton.getInstance().getUserInfo()).toEqual(
|
|
1410
1533
|
userInfo
|
|
1411
1534
|
);
|
|
@@ -1425,8 +1548,8 @@ describe('DdSdkReactNative', () => {
|
|
|
1425
1548
|
await DdSdkReactNative.addUserExtraInfo(extraInfo);
|
|
1426
1549
|
|
|
1427
1550
|
// THEN
|
|
1428
|
-
expect(
|
|
1429
|
-
expect(
|
|
1551
|
+
expect(getNativeDdSdk()?.addUserExtraInfo).toHaveBeenCalledTimes(1);
|
|
1552
|
+
expect(getNativeDdSdk()?.addUserExtraInfo).toHaveBeenCalledWith(
|
|
1430
1553
|
extraInfo
|
|
1431
1554
|
);
|
|
1432
1555
|
expect(UserInfoSingleton.getInstance().getUserInfo()).toEqual({
|
|
@@ -1446,7 +1569,7 @@ describe('DdSdkReactNative', () => {
|
|
|
1446
1569
|
await DdSdkReactNative.addUserExtraInfo(extraInfo);
|
|
1447
1570
|
|
|
1448
1571
|
// THEN
|
|
1449
|
-
expect(
|
|
1572
|
+
expect(getNativeDdSdk()?.addUserExtraInfo).toHaveBeenCalledWith(
|
|
1450
1573
|
extraInfo
|
|
1451
1574
|
);
|
|
1452
1575
|
expect(UserInfoSingleton.getInstance().getUserInfo()).toEqual({
|
|
@@ -1475,8 +1598,8 @@ describe('DdSdkReactNative', () => {
|
|
|
1475
1598
|
await DdSdkReactNative.clearUserInfo();
|
|
1476
1599
|
|
|
1477
1600
|
// THEN
|
|
1478
|
-
expect(
|
|
1479
|
-
expect(
|
|
1601
|
+
expect(getNativeDdSdk()?.clearUserInfo).toHaveBeenCalledTimes(1);
|
|
1602
|
+
expect(getNativeDdSdk()?.setUserInfo).toHaveBeenCalled();
|
|
1480
1603
|
expect(
|
|
1481
1604
|
UserInfoSingleton.getInstance().getUserInfo()
|
|
1482
1605
|
).toBeUndefined();
|
|
@@ -1493,8 +1616,10 @@ describe('DdSdkReactNative', () => {
|
|
|
1493
1616
|
DdSdkReactNative.setTrackingConsent(consent);
|
|
1494
1617
|
|
|
1495
1618
|
// THEN
|
|
1496
|
-
expect(
|
|
1497
|
-
|
|
1619
|
+
expect(getNativeDdSdk()?.setTrackingConsent).toHaveBeenCalledTimes(
|
|
1620
|
+
1
|
|
1621
|
+
);
|
|
1622
|
+
expect(getNativeDdSdk()?.setTrackingConsent).toHaveBeenCalledWith(
|
|
1498
1623
|
consent
|
|
1499
1624
|
);
|
|
1500
1625
|
});
|
|
@@ -1506,7 +1631,7 @@ describe('DdSdkReactNative', () => {
|
|
|
1506
1631
|
DdSdkReactNative.clearAllData();
|
|
1507
1632
|
|
|
1508
1633
|
// THEN
|
|
1509
|
-
expect(
|
|
1634
|
+
expect(getNativeDdSdk()?.clearAllData).toHaveBeenCalledTimes(1);
|
|
1510
1635
|
});
|
|
1511
1636
|
});
|
|
1512
1637
|
|
|
@@ -61,6 +61,7 @@ describe('DdSdkReactNativeConfiguration', () => {
|
|
|
61
61
|
"customEndpoint": undefined,
|
|
62
62
|
"errorEventMapper": null,
|
|
63
63
|
"firstPartyHosts": [],
|
|
64
|
+
"headerCaptureRules": undefined,
|
|
64
65
|
"initialResourceThreshold": undefined,
|
|
65
66
|
"longTaskThresholdMs": 0,
|
|
66
67
|
"nativeCrashReportEnabled": false,
|
|
@@ -82,6 +83,7 @@ describe('DdSdkReactNativeConfiguration', () => {
|
|
|
82
83
|
"trackNonFatalAnrs": undefined,
|
|
83
84
|
"trackResources": false,
|
|
84
85
|
"trackWatchdogTerminations": false,
|
|
86
|
+
"unstable_timeseries": undefined,
|
|
85
87
|
"useAccessibilityLabel": true,
|
|
86
88
|
"vitalsUpdateFrequency": "AVERAGE",
|
|
87
89
|
},
|
|
@@ -212,6 +214,7 @@ describe('DdSdkReactNativeConfiguration', () => {
|
|
|
212
214
|
],
|
|
213
215
|
},
|
|
214
216
|
],
|
|
217
|
+
"headerCaptureRules": undefined,
|
|
215
218
|
"initialResourceThreshold": 0.123,
|
|
216
219
|
"longTaskThresholdMs": 567,
|
|
217
220
|
"nativeCrashReportEnabled": true,
|
|
@@ -235,6 +238,7 @@ describe('DdSdkReactNativeConfiguration', () => {
|
|
|
235
238
|
"trackNonFatalAnrs": true,
|
|
236
239
|
"trackResources": true,
|
|
237
240
|
"trackWatchdogTerminations": false,
|
|
241
|
+
"unstable_timeseries": undefined,
|
|
238
242
|
"useAccessibilityLabel": true,
|
|
239
243
|
"vitalsUpdateFrequency": "AVERAGE",
|
|
240
244
|
},
|
|
@@ -320,6 +324,7 @@ describe('DdSdkReactNativeConfiguration', () => {
|
|
|
320
324
|
"customEndpoint": undefined,
|
|
321
325
|
"errorEventMapper": null,
|
|
322
326
|
"firstPartyHosts": [],
|
|
327
|
+
"headerCaptureRules": undefined,
|
|
323
328
|
"initialResourceThreshold": 0,
|
|
324
329
|
"longTaskThresholdMs": false,
|
|
325
330
|
"nativeCrashReportEnabled": false,
|
|
@@ -341,6 +346,7 @@ describe('DdSdkReactNativeConfiguration', () => {
|
|
|
341
346
|
"trackNonFatalAnrs": false,
|
|
342
347
|
"trackResources": false,
|
|
343
348
|
"trackWatchdogTerminations": false,
|
|
349
|
+
"unstable_timeseries": undefined,
|
|
344
350
|
"useAccessibilityLabel": false,
|
|
345
351
|
"vitalsUpdateFrequency": "AVERAGE",
|
|
346
352
|
},
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
describe('./internal entry', () => {
|
|
2
|
+
it('exports the internals react-native-vega needs', () => {
|
|
3
|
+
// eslint-disable-next-line global-require, @typescript-eslint/no-var-requires
|
|
4
|
+
const internal = require('../internal');
|
|
5
|
+
const expected = [
|
|
6
|
+
'addDefaultValuesToAutoInstrumentationConfiguration',
|
|
7
|
+
'buildConfigurationFromPartialConfiguration',
|
|
8
|
+
'DdSdkNativeConfiguration',
|
|
9
|
+
'RUM_DEFAULTS',
|
|
10
|
+
'adaptLongTaskThreshold',
|
|
11
|
+
'version',
|
|
12
|
+
'AccountInfoSingleton',
|
|
13
|
+
'AttributesSingleton',
|
|
14
|
+
'UserInfoSingleton',
|
|
15
|
+
'GlobalState',
|
|
16
|
+
'BufferSingleton',
|
|
17
|
+
'DatadogProviderState',
|
|
18
|
+
'DdRumResourceTracking'
|
|
19
|
+
];
|
|
20
|
+
for (const name of expected) {
|
|
21
|
+
expect(internal[name]).toBeDefined();
|
|
22
|
+
}
|
|
23
|
+
});
|
|
24
|
+
|
|
25
|
+
// Import safety of this entry point is covered in wrapperImportSafety.test.ts.
|
|
26
|
+
});
|
|
@@ -22,9 +22,8 @@ import { DdLogs, DdRum, DdTrace, DdSdkReactNative } from '../index';
|
|
|
22
22
|
*/
|
|
23
23
|
|
|
24
24
|
const privateProperties = {
|
|
25
|
-
DdTrace: [
|
|
25
|
+
DdTrace: [],
|
|
26
26
|
DdLogs: [
|
|
27
|
-
'nativeLogs',
|
|
28
27
|
'logEventMapper',
|
|
29
28
|
'printLogDroppedSdkNotInitialized',
|
|
30
29
|
'printLogDroppedByMapper',
|
|
@@ -33,7 +32,6 @@ const privateProperties = {
|
|
|
33
32
|
'logWithError'
|
|
34
33
|
],
|
|
35
34
|
DdRum: [
|
|
36
|
-
'nativeRum',
|
|
37
35
|
'errorEventMapper',
|
|
38
36
|
'resourceEventMapper',
|
|
39
37
|
'actionEventMapper',
|
|
@@ -0,0 +1,102 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* Unless explicitly stated otherwise all files in this repository are licensed under the Apache License Version 2.0.
|
|
3
|
+
* This product includes software developed at Datadog (https://www.datadoghq.com/).
|
|
4
|
+
* Copyright 2016-Present Datadog, Inc.
|
|
5
|
+
*/
|
|
6
|
+
|
|
7
|
+
describe('native spec getters', () => {
|
|
8
|
+
afterEach(() => {
|
|
9
|
+
jest.restoreAllMocks();
|
|
10
|
+
});
|
|
11
|
+
|
|
12
|
+
it.each([
|
|
13
|
+
['../specs/NativeDdSdk', 'getNativeDdSdk', 'DdSdk'],
|
|
14
|
+
['../specs/NativeDdRum', 'getNativeDdRum', 'DdRum'],
|
|
15
|
+
['../specs/NativeDdLogs', 'getNativeDdLogs', 'DdLogs'],
|
|
16
|
+
['../specs/NativeDdTrace', 'getNativeDdTrace', 'DdTrace'],
|
|
17
|
+
['../specs/NativeDdFlags', 'getNativeDdFlags', 'DdFlags']
|
|
18
|
+
])(
|
|
19
|
+
'%s retries a missing module and caches it once found',
|
|
20
|
+
(modulePath, getterName, registryName) => {
|
|
21
|
+
jest.isolateModules(() => {
|
|
22
|
+
// eslint-disable-next-line global-require, @typescript-eslint/no-var-requires
|
|
23
|
+
const { TurboModuleRegistry } = require('react-native');
|
|
24
|
+
const nativeModule = { name: registryName };
|
|
25
|
+
const getSpy = jest
|
|
26
|
+
.spyOn(TurboModuleRegistry, 'get')
|
|
27
|
+
.mockReturnValueOnce(null)
|
|
28
|
+
.mockReturnValue(nativeModule);
|
|
29
|
+
// eslint-disable-next-line global-require, import/no-dynamic-require, @typescript-eslint/no-var-requires
|
|
30
|
+
const getter = require(modulePath)[getterName];
|
|
31
|
+
|
|
32
|
+
expect(getter()).toBeNull();
|
|
33
|
+
expect(getter()).toBe(nativeModule);
|
|
34
|
+
expect(getter()).toBe(nativeModule);
|
|
35
|
+
expect(getSpy).toHaveBeenCalledTimes(2);
|
|
36
|
+
expect(getSpy).toHaveBeenCalledWith(registryName);
|
|
37
|
+
});
|
|
38
|
+
}
|
|
39
|
+
);
|
|
40
|
+
|
|
41
|
+
it('FlagsClient retries a missing module and uses it for fetching and tracking', async () => {
|
|
42
|
+
await jest.isolateModulesAsync(async () => {
|
|
43
|
+
// eslint-disable-next-line global-require, @typescript-eslint/no-var-requires
|
|
44
|
+
const { TurboModuleRegistry } = require('react-native');
|
|
45
|
+
const nativeModule = {
|
|
46
|
+
setEvaluationContext: jest.fn().mockResolvedValue({
|
|
47
|
+
feature: { key: 'feature', value: true, reason: 'STATIC' }
|
|
48
|
+
}),
|
|
49
|
+
trackEvaluation: jest.fn().mockResolvedValue(undefined)
|
|
50
|
+
};
|
|
51
|
+
const getSpy = jest
|
|
52
|
+
.spyOn(TurboModuleRegistry, 'get')
|
|
53
|
+
.mockReturnValueOnce(null)
|
|
54
|
+
.mockReturnValue(nativeModule);
|
|
55
|
+
// eslint-disable-next-line global-require, @typescript-eslint/no-var-requires
|
|
56
|
+
const { FlagsClient } = require('../flags/FlagsClient');
|
|
57
|
+
const client = new FlagsClient('late-native');
|
|
58
|
+
const context = { targetingKey: 'user', attributes: {} };
|
|
59
|
+
|
|
60
|
+
expect(getSpy).not.toHaveBeenCalled();
|
|
61
|
+
await expect(
|
|
62
|
+
client.setEvaluationContext(context)
|
|
63
|
+
).rejects.toThrow();
|
|
64
|
+
await expect(
|
|
65
|
+
client.setEvaluationContext(context)
|
|
66
|
+
).resolves.toBeUndefined();
|
|
67
|
+
expect(nativeModule.setEvaluationContext).toHaveBeenCalledWith(
|
|
68
|
+
'late-native',
|
|
69
|
+
'user',
|
|
70
|
+
{}
|
|
71
|
+
);
|
|
72
|
+
expect(client.getBooleanValue('feature', false)).toBe(true);
|
|
73
|
+
expect(nativeModule.trackEvaluation).toHaveBeenCalledWith(
|
|
74
|
+
'late-native',
|
|
75
|
+
'feature',
|
|
76
|
+
expect.objectContaining({ value: true }),
|
|
77
|
+
'user',
|
|
78
|
+
{}
|
|
79
|
+
);
|
|
80
|
+
expect(getSpy).toHaveBeenCalledTimes(2);
|
|
81
|
+
expect(getSpy).toHaveBeenCalledWith('DdFlags');
|
|
82
|
+
});
|
|
83
|
+
});
|
|
84
|
+
|
|
85
|
+
it('DdSdkWrapper picks up a module that was missing on first use', () => {
|
|
86
|
+
jest.isolateModules(() => {
|
|
87
|
+
// eslint-disable-next-line global-require, @typescript-eslint/no-var-requires
|
|
88
|
+
const { TurboModuleRegistry } = require('react-native');
|
|
89
|
+
const nativeModule = { clearAllData: jest.fn() };
|
|
90
|
+
jest.spyOn(TurboModuleRegistry, 'get')
|
|
91
|
+
.mockReturnValueOnce(null)
|
|
92
|
+
.mockReturnValue(nativeModule);
|
|
93
|
+
// eslint-disable-next-line global-require, @typescript-eslint/no-var-requires
|
|
94
|
+
const { DdSdkWrapper } = require('../sdk/DdSdkInternal');
|
|
95
|
+
const sdk = new DdSdkWrapper();
|
|
96
|
+
|
|
97
|
+
expect(() => sdk.clearAllData()).toThrow();
|
|
98
|
+
sdk.clearAllData();
|
|
99
|
+
expect(nativeModule.clearAllData).toHaveBeenCalledTimes(1);
|
|
100
|
+
});
|
|
101
|
+
});
|
|
102
|
+
});
|
|
@@ -21,7 +21,7 @@ import React from 'react';
|
|
|
21
21
|
import type { DdNativeRumType } from '../../../nativeModulesTypes';
|
|
22
22
|
import { DdRumUserInteractionTracking } from '../../../rum/instrumentation/interactionTracking/DdRumUserInteractionTracking';
|
|
23
23
|
import { BufferSingleton } from '../../../sdk/DatadogProvider/Buffer/BufferSingleton';
|
|
24
|
-
import
|
|
24
|
+
import { getNativeDdSdk } from '../../../specs/NativeDdSdk';
|
|
25
25
|
|
|
26
26
|
const styles = StyleSheet.create({
|
|
27
27
|
button: {
|
|
@@ -467,7 +467,7 @@ describe('startTracking', () => {
|
|
|
467
467
|
jest.setMock('react/jsx-runtime', {});
|
|
468
468
|
DdRumUserInteractionTracking.startTracking({});
|
|
469
469
|
expect(DdRumUserInteractionTracking['isTracking']).toBe(true);
|
|
470
|
-
expect(
|
|
470
|
+
expect(getNativeDdSdk()?.telemetryDebug).toBeCalledWith(
|
|
471
471
|
'React jsx runtime does not export new jsx transform'
|
|
472
472
|
);
|
|
473
473
|
});
|
|
@@ -477,7 +477,7 @@ describe('startTracking', () => {
|
|
|
477
477
|
|
|
478
478
|
DdRumUserInteractionTracking.startTracking({});
|
|
479
479
|
expect(DdRumUserInteractionTracking['isTracking']).toBe(true);
|
|
480
|
-
expect(
|
|
480
|
+
expect(getNativeDdSdk()?.telemetryDebug).toBeCalledWith(
|
|
481
481
|
'React version does not support new jsx transform'
|
|
482
482
|
);
|
|
483
483
|
});
|
|
@@ -0,0 +1,129 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* Unless explicitly stated otherwise all files in this repository are licensed under the Apache License Version 2.0.
|
|
3
|
+
* This product includes software developed at Datadog (https://www.datadoghq.com/).
|
|
4
|
+
* Copyright 2016-Present Datadog, Inc.
|
|
5
|
+
*/
|
|
6
|
+
|
|
7
|
+
/**
|
|
8
|
+
* The spy must be installed on the `react-native` instance from inside
|
|
9
|
+
* `jest.isolateModules`: lookups made by isolated modules go through that
|
|
10
|
+
* registry, not the one imported at the top of a test file.
|
|
11
|
+
*/
|
|
12
|
+
const requireCountingLookups = (modulePath: string) => {
|
|
13
|
+
let lookups: string[] = [];
|
|
14
|
+
let mod: any;
|
|
15
|
+
jest.isolateModules(() => {
|
|
16
|
+
// eslint-disable-next-line global-require, @typescript-eslint/no-var-requires
|
|
17
|
+
const { TurboModuleRegistry } = require('react-native');
|
|
18
|
+
const getSpy = jest.spyOn(TurboModuleRegistry, 'get');
|
|
19
|
+
// eslint-disable-next-line global-require, import/no-dynamic-require
|
|
20
|
+
mod = require(modulePath);
|
|
21
|
+
lookups = getSpy.mock.calls.map(call => call[0] as string);
|
|
22
|
+
});
|
|
23
|
+
return { mod, lookups };
|
|
24
|
+
};
|
|
25
|
+
|
|
26
|
+
describe('SDK wrappers are import-safe', () => {
|
|
27
|
+
afterEach(() => {
|
|
28
|
+
jest.restoreAllMocks();
|
|
29
|
+
// Singletons live on globalThis, which isolateModules does not reset.
|
|
30
|
+
const g = globalThis as Record<PropertyKey, unknown>;
|
|
31
|
+
for (const symbol of Object.getOwnPropertySymbols(g)) {
|
|
32
|
+
if (symbol.description?.startsWith('com.datadog.reactnative')) {
|
|
33
|
+
delete g[symbol];
|
|
34
|
+
}
|
|
35
|
+
}
|
|
36
|
+
});
|
|
37
|
+
|
|
38
|
+
it.each([
|
|
39
|
+
'../specs/NativeDdSdk',
|
|
40
|
+
'../specs/NativeDdRum',
|
|
41
|
+
'../specs/NativeDdLogs',
|
|
42
|
+
'../specs/NativeDdTrace',
|
|
43
|
+
'../specs/NativeDdFlags',
|
|
44
|
+
'../sdk/DdSdkInternal',
|
|
45
|
+
'../rum/DdRum',
|
|
46
|
+
'../logs/DdLogs',
|
|
47
|
+
'../trace/DdTrace',
|
|
48
|
+
'../flags/DdFlags'
|
|
49
|
+
])('importing %s performs no native lookup', modulePath => {
|
|
50
|
+
expect(requireCountingLookups(modulePath).lookups).toEqual([]);
|
|
51
|
+
});
|
|
52
|
+
|
|
53
|
+
it('DdSdkWrapper only resolves the native module when a method is used', () => {
|
|
54
|
+
jest.isolateModules(() => {
|
|
55
|
+
// eslint-disable-next-line global-require, @typescript-eslint/no-var-requires
|
|
56
|
+
const { TurboModuleRegistry } = require('react-native');
|
|
57
|
+
const getSpy = jest.spyOn(TurboModuleRegistry, 'get');
|
|
58
|
+
// eslint-disable-next-line global-require, @typescript-eslint/no-var-requires
|
|
59
|
+
const { DdSdkWrapper } = require('../sdk/DdSdkInternal');
|
|
60
|
+
|
|
61
|
+
const sdk = new DdSdkWrapper();
|
|
62
|
+
expect(getSpy).not.toHaveBeenCalled();
|
|
63
|
+
|
|
64
|
+
sdk.getConstants();
|
|
65
|
+
expect(getSpy).toHaveBeenCalledWith('DdSdk');
|
|
66
|
+
});
|
|
67
|
+
});
|
|
68
|
+
|
|
69
|
+
it('importing the public barrel performs no native lookup', () => {
|
|
70
|
+
expect(requireCountingLookups('../index').lookups).toEqual([]);
|
|
71
|
+
});
|
|
72
|
+
|
|
73
|
+
it('importing the internal entry performs no native lookup', () => {
|
|
74
|
+
expect(requireCountingLookups('../internal').lookups).toEqual([]);
|
|
75
|
+
});
|
|
76
|
+
});
|
|
77
|
+
|
|
78
|
+
describe('SDK wrappers do not rely on Proxy', () => {
|
|
79
|
+
// Older Android JSC and Hermes versions supported by the SDK lack Proxy.
|
|
80
|
+
it.each(['../sdk/DdSdkInternal', '../index', '../internal'])(
|
|
81
|
+
'importing %s works without Proxy',
|
|
82
|
+
modulePath => {
|
|
83
|
+
const g = globalThis as Record<string, unknown>;
|
|
84
|
+
const originalProxy = g.Proxy;
|
|
85
|
+
try {
|
|
86
|
+
delete g.Proxy;
|
|
87
|
+
expect(() => requireCountingLookups(modulePath)).not.toThrow();
|
|
88
|
+
} finally {
|
|
89
|
+
g.Proxy = originalProxy;
|
|
90
|
+
}
|
|
91
|
+
}
|
|
92
|
+
);
|
|
93
|
+
|
|
94
|
+
it('DdSdkWrapper forwards every method to the native module', () => {
|
|
95
|
+
jest.isolateModules(() => {
|
|
96
|
+
// eslint-disable-next-line global-require, @typescript-eslint/no-var-requires
|
|
97
|
+
const { TurboModuleRegistry } = require('react-native');
|
|
98
|
+
const nativeModule: Record<string, jest.Mock> = {};
|
|
99
|
+
jest.spyOn(TurboModuleRegistry, 'get').mockReturnValue(
|
|
100
|
+
nativeModule
|
|
101
|
+
);
|
|
102
|
+
// eslint-disable-next-line global-require, @typescript-eslint/no-var-requires
|
|
103
|
+
const { DdSdkWrapper } = require('../sdk/DdSdkInternal');
|
|
104
|
+
const sdk = new DdSdkWrapper();
|
|
105
|
+
const methods = Object.getOwnPropertyNames(
|
|
106
|
+
DdSdkWrapper.prototype
|
|
107
|
+
).filter(
|
|
108
|
+
name =>
|
|
109
|
+
name !== 'constructor' &&
|
|
110
|
+
!name.startsWith('_') &&
|
|
111
|
+
typeof Object.getOwnPropertyDescriptor(
|
|
112
|
+
DdSdkWrapper.prototype,
|
|
113
|
+
name
|
|
114
|
+
)?.value === 'function'
|
|
115
|
+
);
|
|
116
|
+
for (const name of methods) {
|
|
117
|
+
nativeModule[name] = jest.fn().mockReturnValue(name);
|
|
118
|
+
}
|
|
119
|
+
|
|
120
|
+
for (const name of methods) {
|
|
121
|
+
const arg =
|
|
122
|
+
name === 'initialize' ? { attributeEncoders: [] } : 'arg';
|
|
123
|
+
expect(sdk[name](arg)).toBe(name);
|
|
124
|
+
expect(nativeModule[name]).toHaveBeenCalledTimes(1);
|
|
125
|
+
}
|
|
126
|
+
expect(methods.length).toBeGreaterThan(15);
|
|
127
|
+
});
|
|
128
|
+
});
|
|
129
|
+
});
|
|
@@ -165,6 +165,9 @@ export const getJSONConfiguration = (
|
|
|
165
165
|
buildFirstPartyHosts(
|
|
166
166
|
configuration.rumConfiguration.firstPartyHosts
|
|
167
167
|
) || RUM_DEFAULTS.getFirstPartyHosts(),
|
|
168
|
+
// Validated when compiled at resource tracking start
|
|
169
|
+
headerCaptureRules:
|
|
170
|
+
configuration.rumConfiguration.headerCaptureRules,
|
|
168
171
|
useAccessibilityLabel:
|
|
169
172
|
configuration.rumConfiguration.useAccessibilityLabel,
|
|
170
173
|
trackInteractions:
|
|
@@ -213,7 +216,9 @@ export const getJSONConfiguration = (
|
|
|
213
216
|
configuration.rumConfiguration.nativeIosResourceTracking,
|
|
214
217
|
nativeIosResourceTrackingDisallowList:
|
|
215
218
|
configuration.rumConfiguration
|
|
216
|
-
.nativeIosResourceTrackingDisallowList
|
|
219
|
+
.nativeIosResourceTrackingDisallowList,
|
|
220
|
+
unstable_timeseries:
|
|
221
|
+
configuration.rumConfiguration.unstable_timeseries
|
|
217
222
|
}
|
|
218
223
|
}),
|
|
219
224
|
...(configuration.traceConfiguration !== undefined && {
|
|
@@ -6,11 +6,13 @@
|
|
|
6
6
|
import type { FirstPartyHost } from '../rum/types';
|
|
7
7
|
|
|
8
8
|
import type { CoreConfigurationOptions } from './features/CoreConfiguration.type';
|
|
9
|
+
import type { HeaderCaptureRule } from './features/RumConfiguration.type';
|
|
9
10
|
import type {
|
|
10
11
|
BatchProcessingLevel,
|
|
11
12
|
BatchSize,
|
|
12
13
|
ProxyConfiguration,
|
|
13
14
|
SdkVerbosity,
|
|
15
|
+
TimeseriesConfiguration,
|
|
14
16
|
TrackingConsent,
|
|
15
17
|
UploadFrequency,
|
|
16
18
|
VitalsUpdateFrequency
|
|
@@ -40,6 +42,7 @@ export interface JsonConfiguration extends CoreConfigurationOptions {
|
|
|
40
42
|
actionNameAttribute?: string;
|
|
41
43
|
appHangThreshold?: number;
|
|
42
44
|
firstPartyHosts?: FirstPartyHost[];
|
|
45
|
+
headerCaptureRules?: 'defaults' | HeaderCaptureRule[];
|
|
43
46
|
initialResourceThreshold?: number;
|
|
44
47
|
trackMemoryWarnings?: boolean;
|
|
45
48
|
nativeCrashReportEnabled?: boolean;
|
|
@@ -57,6 +60,7 @@ export interface JsonConfiguration extends CoreConfigurationOptions {
|
|
|
57
60
|
trackWatchdogTerminations?: boolean;
|
|
58
61
|
vitalsUpdateFrequency?: VitalsUpdateFrequency;
|
|
59
62
|
telemetrySampleRate?: number;
|
|
63
|
+
unstable_timeseries?: TimeseriesConfiguration;
|
|
60
64
|
};
|
|
61
65
|
traceConfiguration?: {
|
|
62
66
|
customEndpoint?: string;
|