@datadog/mobile-react-native 3.10.0 → 3.12.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 +7 -7
- package/README.md +2 -1
- package/android/build.gradle +23 -13
- package/android/src/main/kotlin/com/datadog/reactnative/DdRumImplementation.kt +10 -0
- package/android/src/main/kotlin/com/datadog/reactnative/SdkVersion.kt +1 -1
- package/android/src/newarch/kotlin/com/datadog/reactnative/DdRum.kt +10 -0
- package/android/src/oldarchCommon/kotlin/com/datadog/reactnative/DdRum.kt +10 -0
- package/android/src/test/kotlin/com/datadog/reactnative/DdRumTest.kt +9 -0
- package/android/src/test/kotlin/com/datadog/tools/unit/MockRumMonitor.kt +3 -3
- package/datadog-configuration.gradle +59 -18
- package/datadog-configuration.schema.json +119 -0
- package/ios/Sources/DdRum.mm +13 -1
- package/ios/Sources/DdRumImplementation.swift +6 -0
- package/ios/Sources/SdkVersion.swift +1 -1
- package/jest/mock.js +3 -0
- package/lib/commonjs/DdSdkReactNative.js +6 -1
- package/lib/commonjs/DdSdkReactNative.js.map +1 -1
- package/lib/commonjs/config/FileBasedConfiguration.js +2 -0
- package/lib/commonjs/config/FileBasedConfiguration.js.map +1 -1
- package/lib/commonjs/config/async/AutoInstrumentationConfiguration.js +2 -1
- package/lib/commonjs/config/async/AutoInstrumentationConfiguration.js.map +1 -1
- package/lib/commonjs/config/features/RumConfiguration.js +4 -0
- package/lib/commonjs/config/features/RumConfiguration.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/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 +8 -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 +19 -4
- package/lib/commonjs/rum/instrumentation/resourceTracking/requestProxy/FetchProxy/FetchProxy.js.map +1 -1
- package/lib/commonjs/rum/instrumentation/resourceTracking/requestProxy/XHRProxy/XHRProxy.js +26 -4
- 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 +10 -2
- 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/rum/types.js.map +1 -1
- package/lib/commonjs/sdk/AccountInfoSingleton/AccountInfoSingleton.js +1 -0
- package/lib/commonjs/sdk/AccountInfoSingleton/AccountInfoSingleton.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/sdk/UserInfoSingleton/UserInfoSingleton.js +1 -0
- package/lib/commonjs/sdk/UserInfoSingleton/UserInfoSingleton.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 +2 -0
- package/lib/module/config/FileBasedConfiguration.js.map +1 -1
- package/lib/module/config/async/AutoInstrumentationConfiguration.js +2 -1
- package/lib/module/config/async/AutoInstrumentationConfiguration.js.map +1 -1
- package/lib/module/config/features/RumConfiguration.js +4 -0
- package/lib/module/config/features/RumConfiguration.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/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 +8 -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 +20 -5
- package/lib/module/rum/instrumentation/resourceTracking/requestProxy/FetchProxy/FetchProxy.js.map +1 -1
- package/lib/module/rum/instrumentation/resourceTracking/requestProxy/XHRProxy/XHRProxy.js +27 -5
- 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 +8 -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/rum/types.js.map +1 -1
- package/lib/module/sdk/AccountInfoSingleton/AccountInfoSingleton.js +2 -1
- package/lib/module/sdk/AccountInfoSingleton/AccountInfoSingleton.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/sdk/UserInfoSingleton/UserInfoSingleton.js +2 -1
- package/lib/module/sdk/UserInfoSingleton/UserInfoSingleton.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 +2 -0
- package/lib/typescript/config/FileBasedConfiguration.type.d.ts.map +1 -1
- package/lib/typescript/config/async/AutoInstrumentationConfiguration.d.ts +3 -0
- package/lib/typescript/config/async/AutoInstrumentationConfiguration.d.ts.map +1 -1
- package/lib/typescript/config/features/RumConfiguration.d.ts +3 -1
- package/lib/typescript/config/features/RumConfiguration.d.ts.map +1 -1
- package/lib/typescript/config/features/RumConfiguration.type.d.ts +107 -0
- package/lib/typescript/config/features/RumConfiguration.type.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 +1 -0
- 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 +2 -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 +4 -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/rum/types.d.ts +6 -0
- package/lib/typescript/rum/types.d.ts.map +1 -1
- package/lib/typescript/sdk/AccountInfoSingleton/AccountInfoSingleton.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/sdk/UserInfoSingleton/UserInfoSingleton.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 +13 -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 +7 -2
- package/src/DdSdkReactNative.tsx +11 -1
- package/src/__tests__/DdSdkReactNative.test.tsx +145 -20
- package/src/__tests__/DdSdkReactNativeConfiguration.test.ts +3 -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 +3 -0
- package/src/config/FileBasedConfiguration.type.ts +2 -0
- package/src/config/__tests__/FileBasedConfiguration.test.ts +66 -0
- package/src/config/__tests__/__fixtures__/configuration-all-fields.json +8 -0
- package/src/config/async/AutoInstrumentationConfiguration.ts +5 -1
- package/src/config/features/RumConfiguration.ts +9 -0
- package/src/config/features/RumConfiguration.type.ts +117 -0
- package/src/flags/DdFlags.ts +4 -3
- package/src/flags/FlagsClient.ts +4 -3
- package/src/index.tsx +7 -0
- package/src/internal.ts +32 -0
- package/src/logs/DdLogs.ts +4 -3
- package/src/rum/DdRum.ts +14 -3
- package/src/rum/__tests__/DdRum.test.ts +14 -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 +24 -5
- package/src/rum/instrumentation/resourceTracking/requestProxy/FetchProxy/__tests__/FetchProxy.test.ts +303 -0
- package/src/rum/instrumentation/resourceTracking/requestProxy/XHRProxy/DatadogRumResource/__tests__/ResourceReporter.test.ts +120 -0
- package/src/rum/instrumentation/resourceTracking/requestProxy/XHRProxy/XHRProxy.ts +36 -5
- package/src/rum/instrumentation/resourceTracking/requestProxy/XHRProxy/__tests__/XHRProxy.test.ts +664 -2
- package/src/rum/instrumentation/resourceTracking/requestProxy/XHRProxy/baggageHeaderUtils.ts +1 -34
- package/src/rum/instrumentation/resourceTracking/requestProxy/common/RequestContext.ts +15 -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/rum/types.ts +7 -0
- package/src/sdk/AccountInfoSingleton/AccountInfoSingleton.ts +2 -1
- package/src/sdk/AccountInfoSingleton/__tests__/AccountInfoSingleton.test.ts +59 -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 +2 -1
- package/src/sdk/DdSdkInternal.ts +27 -24
- package/src/sdk/EventMappers/__tests__/EventMapper.test.ts +2 -2
- package/src/sdk/UserInfoSingleton/UserInfoSingleton.ts +2 -1
- package/src/sdk/UserInfoSingleton/__tests__/UserInfoSingleton.test.ts +55 -0
- package/src/specs/NativeDdFlags.ts +14 -2
- package/src/specs/NativeDdLogs.ts +14 -2
- package/src/specs/NativeDdRum.ts +21 -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
|
@@ -55,6 +55,20 @@ describe('FileBasedConfiguration', () => {
|
|
|
55
55
|
],
|
|
56
56
|
},
|
|
57
57
|
],
|
|
58
|
+
"headerCaptureRules": [
|
|
59
|
+
{
|
|
60
|
+
"type": "defaults",
|
|
61
|
+
},
|
|
62
|
+
{
|
|
63
|
+
"forURLs": [
|
|
64
|
+
"api.example.com",
|
|
65
|
+
],
|
|
66
|
+
"headers": [
|
|
67
|
+
"x-request-id",
|
|
68
|
+
],
|
|
69
|
+
"type": "matchResponseHeaders",
|
|
70
|
+
},
|
|
71
|
+
],
|
|
58
72
|
"initialResourceThreshold": 456,
|
|
59
73
|
"longTaskThresholdMs": 44,
|
|
60
74
|
"nativeCrashReportEnabled": true,
|
|
@@ -172,6 +186,7 @@ describe('FileBasedConfiguration', () => {
|
|
|
172
186
|
],
|
|
173
187
|
},
|
|
174
188
|
],
|
|
189
|
+
"headerCaptureRules": undefined,
|
|
175
190
|
"initialResourceThreshold": undefined,
|
|
176
191
|
"longTaskThresholdMs": 44,
|
|
177
192
|
"nativeCrashReportEnabled": false,
|
|
@@ -239,6 +254,7 @@ describe('FileBasedConfiguration', () => {
|
|
|
239
254
|
"customEndpoint": undefined,
|
|
240
255
|
"errorEventMapper": null,
|
|
241
256
|
"firstPartyHosts": [],
|
|
257
|
+
"headerCaptureRules": undefined,
|
|
242
258
|
"initialResourceThreshold": undefined,
|
|
243
259
|
"longTaskThresholdMs": 0,
|
|
244
260
|
"nativeCrashReportEnabled": false,
|
|
@@ -346,6 +362,56 @@ describe('FileBasedConfiguration', () => {
|
|
|
346
362
|
).toEqual(disallowList);
|
|
347
363
|
});
|
|
348
364
|
|
|
365
|
+
it('leaves headerCaptureRules undefined when not set', () => {
|
|
366
|
+
const config = new FileBasedConfiguration({
|
|
367
|
+
configuration: {
|
|
368
|
+
env: 'fake-env',
|
|
369
|
+
clientToken: 'fake-client-token',
|
|
370
|
+
rumConfiguration: {
|
|
371
|
+
applicationId: 'fake-app-id'
|
|
372
|
+
}
|
|
373
|
+
}
|
|
374
|
+
});
|
|
375
|
+
expect(config.rumConfiguration?.headerCaptureRules).toBeUndefined();
|
|
376
|
+
});
|
|
377
|
+
|
|
378
|
+
it('passes the headerCaptureRules defaults preset through', () => {
|
|
379
|
+
const config = new FileBasedConfiguration({
|
|
380
|
+
configuration: {
|
|
381
|
+
env: 'fake-env',
|
|
382
|
+
clientToken: 'fake-client-token',
|
|
383
|
+
rumConfiguration: {
|
|
384
|
+
applicationId: 'fake-app-id',
|
|
385
|
+
headerCaptureRules: 'defaults'
|
|
386
|
+
}
|
|
387
|
+
}
|
|
388
|
+
});
|
|
389
|
+
expect(config.rumConfiguration?.headerCaptureRules).toBe(
|
|
390
|
+
'defaults'
|
|
391
|
+
);
|
|
392
|
+
});
|
|
393
|
+
|
|
394
|
+
it('passes headerCaptureRules rules through', () => {
|
|
395
|
+
const rules = [
|
|
396
|
+
{
|
|
397
|
+
type: 'matchRequestHeaders',
|
|
398
|
+
headers: ['x-device-id'],
|
|
399
|
+
forURLs: ['api.example.com/v2']
|
|
400
|
+
}
|
|
401
|
+
];
|
|
402
|
+
const config = new FileBasedConfiguration({
|
|
403
|
+
configuration: {
|
|
404
|
+
env: 'fake-env',
|
|
405
|
+
clientToken: 'fake-client-token',
|
|
406
|
+
rumConfiguration: {
|
|
407
|
+
applicationId: 'fake-app-id',
|
|
408
|
+
headerCaptureRules: rules
|
|
409
|
+
}
|
|
410
|
+
}
|
|
411
|
+
});
|
|
412
|
+
expect(config.rumConfiguration?.headerCaptureRules).toEqual(rules);
|
|
413
|
+
});
|
|
414
|
+
|
|
349
415
|
it('applies event mappers to configuration when provided', () => {
|
|
350
416
|
const actionEventMapper = () => null;
|
|
351
417
|
const errorEventMapper = () => null;
|
|
@@ -25,6 +25,14 @@
|
|
|
25
25
|
]
|
|
26
26
|
}
|
|
27
27
|
],
|
|
28
|
+
"headerCaptureRules": [
|
|
29
|
+
{ "type": "defaults" },
|
|
30
|
+
{
|
|
31
|
+
"type": "matchResponseHeaders",
|
|
32
|
+
"headers": ["x-request-id"],
|
|
33
|
+
"forURLs": ["api.example.com"]
|
|
34
|
+
}
|
|
35
|
+
],
|
|
28
36
|
"initialResourceThreshold": 456,
|
|
29
37
|
"nativeViewTracking": true,
|
|
30
38
|
"nativeInteractionTracking": true,
|
|
@@ -9,6 +9,7 @@ import type { ResourceEventMapper } from '../../rum/eventMappers/resourceEventMa
|
|
|
9
9
|
import type { FirstPartyHost } from '../../rum/types';
|
|
10
10
|
import type { LogEventMapper } from '../../types';
|
|
11
11
|
import { LOGS_DEFAULTS } from '../features/LogsConfiguration';
|
|
12
|
+
import type { HeaderCaptureRule } from '../features/RumConfiguration.type';
|
|
12
13
|
import { RUM_DEFAULTS } from '../features/RumConfiguration';
|
|
13
14
|
import type { TraceConfiguration } from '../features/TraceConfiguration';
|
|
14
15
|
|
|
@@ -25,6 +26,7 @@ export type AutoInstrumentationConfiguration = {
|
|
|
25
26
|
readonly useAccessibilityLabel?: boolean;
|
|
26
27
|
readonly actionNameAttribute?: string;
|
|
27
28
|
readonly resourceTraceSampleRate?: number;
|
|
29
|
+
readonly headerCaptureRules?: 'defaults' | HeaderCaptureRule[];
|
|
28
30
|
readonly nativeCrashReportEnabled?: boolean;
|
|
29
31
|
readonly nativeLongTaskThresholdMs?: number;
|
|
30
32
|
readonly nativeViewTracking?: boolean;
|
|
@@ -61,6 +63,7 @@ export type AutoInstrumentationParameters = {
|
|
|
61
63
|
readonly errorEventMapper: ErrorEventMapper | null;
|
|
62
64
|
readonly resourceEventMapper: ResourceEventMapper | null;
|
|
63
65
|
readonly firstPartyHosts: FirstPartyHost[];
|
|
66
|
+
readonly headerCaptureRules?: 'defaults' | HeaderCaptureRule[];
|
|
64
67
|
};
|
|
65
68
|
readonly logsConfiguration?: {
|
|
66
69
|
readonly logEventMapper: LogEventMapper | null;
|
|
@@ -128,7 +131,8 @@ export const addDefaultValuesToAutoInstrumentationConfiguration = (
|
|
|
128
131
|
features.rumConfiguration.nativeIosResourceTrackingDisallowList,
|
|
129
132
|
firstPartyHosts:
|
|
130
133
|
features.rumConfiguration.firstPartyHosts ||
|
|
131
|
-
RUM_DEFAULTS.getFirstPartyHosts()
|
|
134
|
+
RUM_DEFAULTS.getFirstPartyHosts(),
|
|
135
|
+
headerCaptureRules: features.rumConfiguration.headerCaptureRules
|
|
132
136
|
},
|
|
133
137
|
logsConfiguration: {
|
|
134
138
|
logEventMapper:
|
|
@@ -10,6 +10,7 @@ import type { FirstPartyHost } from '../../rum/types';
|
|
|
10
10
|
import { VitalsUpdateFrequency } from '../types';
|
|
11
11
|
|
|
12
12
|
import type {
|
|
13
|
+
HeaderCaptureRule,
|
|
13
14
|
RumConfigurationOptions,
|
|
14
15
|
RumConfigurationType
|
|
15
16
|
} from './RumConfiguration.type';
|
|
@@ -40,6 +41,10 @@ const DEFAULTS = {
|
|
|
40
41
|
trackInteractions: false,
|
|
41
42
|
trackMemoryWarnings: true,
|
|
42
43
|
trackNonFatalAnrs: undefined,
|
|
44
|
+
headerCaptureRules: undefined as
|
|
45
|
+
| 'defaults'
|
|
46
|
+
| HeaderCaptureRule[]
|
|
47
|
+
| undefined,
|
|
43
48
|
trackResources: false,
|
|
44
49
|
trackWatchdogTerminations: false,
|
|
45
50
|
useAccessibilityLabel: true,
|
|
@@ -126,6 +131,10 @@ export class RumConfiguration implements RumConfigurationType {
|
|
|
126
131
|
// Track non-fatal ANRs enabled
|
|
127
132
|
public trackNonFatalAnrs?: boolean = DEFAULTS.trackNonFatalAnrs;
|
|
128
133
|
|
|
134
|
+
// Header Capture Rules
|
|
135
|
+
public headerCaptureRules: 'defaults' | HeaderCaptureRule[] | undefined =
|
|
136
|
+
DEFAULTS.headerCaptureRules;
|
|
137
|
+
|
|
129
138
|
// Track Watchdog Terminations enabled
|
|
130
139
|
public trackWatchdogTerminations: boolean =
|
|
131
140
|
DEFAULTS.trackWatchdogTerminations;
|
|
@@ -37,6 +37,108 @@ export interface RumConfigurationRequired {
|
|
|
37
37
|
trackErrors?: boolean;
|
|
38
38
|
}
|
|
39
39
|
|
|
40
|
+
/**
|
|
41
|
+
* Captures a predefined set of caching and content headers from both
|
|
42
|
+
* request and response.
|
|
43
|
+
*
|
|
44
|
+
* Default headers captured:
|
|
45
|
+
* - **Response:** cache-control, etag, age, expires, content-type,
|
|
46
|
+
* content-encoding, content-length, vary, server-timing, x-cache
|
|
47
|
+
* - **Request:** cache-control, content-type
|
|
48
|
+
*
|
|
49
|
+
* Optionally scoped to specific URLs via `forURLs`.
|
|
50
|
+
*/
|
|
51
|
+
export type DefaultsRule = {
|
|
52
|
+
type: 'defaults';
|
|
53
|
+
/**
|
|
54
|
+
* URL patterns to scope this rule to. Supports hostname-only
|
|
55
|
+
* ('api.example.com') or hostname+path prefix ('api.example.com/v2').
|
|
56
|
+
* Omit to match all URLs.
|
|
57
|
+
*/
|
|
58
|
+
forURLs?: string[];
|
|
59
|
+
};
|
|
60
|
+
|
|
61
|
+
/**
|
|
62
|
+
* Captures the specified headers from both request and response.
|
|
63
|
+
*
|
|
64
|
+
* Use this when the same header names should be captured regardless
|
|
65
|
+
* of direction (e.g. 'content-type', 'x-request-id').
|
|
66
|
+
* Optionally scoped to specific URLs via `forURLs`.
|
|
67
|
+
*/
|
|
68
|
+
export type MatchHeadersRule = {
|
|
69
|
+
type: 'matchHeaders';
|
|
70
|
+
/**
|
|
71
|
+
* Header names to capture from both request and response.
|
|
72
|
+
* Preserved as-is; compared case-insensitively at capture time.
|
|
73
|
+
*/
|
|
74
|
+
headers: string[];
|
|
75
|
+
/**
|
|
76
|
+
* URL patterns to scope this rule to. Supports hostname-only
|
|
77
|
+
* ('api.example.com') or hostname+path prefix ('api.example.com/v2').
|
|
78
|
+
* Omit to match all URLs.
|
|
79
|
+
*/
|
|
80
|
+
forURLs?: string[];
|
|
81
|
+
};
|
|
82
|
+
|
|
83
|
+
/**
|
|
84
|
+
* Captures the specified headers from requests only.
|
|
85
|
+
*
|
|
86
|
+
* Use this when you need to capture request-specific headers
|
|
87
|
+
* (e.g. 'x-request-id', 'if-none-match') without capturing response headers.
|
|
88
|
+
* Optionally scoped to specific URLs via `forURLs`.
|
|
89
|
+
*/
|
|
90
|
+
export type MatchRequestHeadersRule = {
|
|
91
|
+
type: 'matchRequestHeaders';
|
|
92
|
+
/**
|
|
93
|
+
* Request header names to capture.
|
|
94
|
+
* Preserved as-is; compared case-insensitively at capture time.
|
|
95
|
+
*/
|
|
96
|
+
headers: string[];
|
|
97
|
+
/**
|
|
98
|
+
* URL patterns to scope this rule to. Supports hostname-only
|
|
99
|
+
* ('api.example.com') or hostname+path prefix ('api.example.com/v2').
|
|
100
|
+
* Omit to match all URLs.
|
|
101
|
+
*/
|
|
102
|
+
forURLs?: string[];
|
|
103
|
+
};
|
|
104
|
+
|
|
105
|
+
/**
|
|
106
|
+
* Captures the specified headers from responses only.
|
|
107
|
+
*
|
|
108
|
+
* Use this when you need to capture response-specific headers
|
|
109
|
+
* (e.g. 'x-request-id', 'x-ratelimit-remaining') without capturing
|
|
110
|
+
* request headers.
|
|
111
|
+
* Optionally scoped to specific URLs via `forURLs`.
|
|
112
|
+
*/
|
|
113
|
+
export type MatchResponseHeadersRule = {
|
|
114
|
+
type: 'matchResponseHeaders';
|
|
115
|
+
/**
|
|
116
|
+
* Response header names to capture.
|
|
117
|
+
* Preserved as-is; compared case-insensitively at capture time.
|
|
118
|
+
*/
|
|
119
|
+
headers: string[];
|
|
120
|
+
/**
|
|
121
|
+
* URL patterns to scope this rule to. Supports hostname-only
|
|
122
|
+
* ('api.example.com') or hostname+path prefix ('api.example.com/v2').
|
|
123
|
+
* Omit to match all URLs.
|
|
124
|
+
*/
|
|
125
|
+
forURLs?: string[];
|
|
126
|
+
};
|
|
127
|
+
|
|
128
|
+
/**
|
|
129
|
+
* A composable header capture rule.
|
|
130
|
+
*
|
|
131
|
+
* Discriminated union on the `type` field. Multiple rules can be combined
|
|
132
|
+
* in an array. Matching rules are merged additively (union of headers).
|
|
133
|
+
* If at least one scoped rule (explicit `forURLs` patterns) matches a URL,
|
|
134
|
+
* catch-all rules (omitted `forURLs` / `['*']`) are ignored for that URL.
|
|
135
|
+
*/
|
|
136
|
+
export type HeaderCaptureRule =
|
|
137
|
+
| DefaultsRule
|
|
138
|
+
| MatchHeadersRule
|
|
139
|
+
| MatchRequestHeadersRule
|
|
140
|
+
| MatchResponseHeadersRule;
|
|
141
|
+
|
|
40
142
|
/**
|
|
41
143
|
* Optional RUM configuration values.
|
|
42
144
|
*/
|
|
@@ -79,6 +181,21 @@ export interface RumConfigurationOptions {
|
|
|
79
181
|
*/
|
|
80
182
|
firstPartyHosts?: FirstPartyHost[];
|
|
81
183
|
|
|
184
|
+
/**
|
|
185
|
+
* Controls which resource headers the SDK captures on network requests.
|
|
186
|
+
*
|
|
187
|
+
* - **Omitted** (default): No headers are captured.
|
|
188
|
+
* - `'defaults'`: Captures a predefined set of caching and content headers
|
|
189
|
+
* across all URLs.
|
|
190
|
+
* - `HeaderCaptureRule[]`: An array of composable rules. When multiple rules
|
|
191
|
+
* match a URL their header sets are merged. If at least one scoped rule
|
|
192
|
+
* (with explicit `forURLs` patterns) matches, catch-all rules (no `forURLs`
|
|
193
|
+
* or `['*']`) are ignored for that URL.
|
|
194
|
+
*
|
|
195
|
+
* Requires `trackResources: true` to take effect.
|
|
196
|
+
*/
|
|
197
|
+
headerCaptureRules?: 'defaults' | HeaderCaptureRule[];
|
|
198
|
+
|
|
82
199
|
/**
|
|
83
200
|
* Initial resource collection threshold in seconds.
|
|
84
201
|
*/
|
package/src/flags/DdFlags.ts
CHANGED
|
@@ -7,6 +7,7 @@
|
|
|
7
7
|
import { InternalLog } from '../InternalLog';
|
|
8
8
|
import { SdkVerbosity } from '../config/types/SdkVerbosity';
|
|
9
9
|
import type { DdNativeFlagsType } from '../nativeModulesTypes';
|
|
10
|
+
import { getNativeDdFlags } from '../specs/NativeDdFlags';
|
|
10
11
|
import { getGlobalInstance } from '../utils/singletonUtils';
|
|
11
12
|
|
|
12
13
|
import { FlagsClient } from './FlagsClient';
|
|
@@ -18,9 +19,9 @@ const FLAGS_MODULE = 'com.datadog.reactnative.flags';
|
|
|
18
19
|
* Implementation class for {@link DdFlagsType}. Please see the interface for documentation.
|
|
19
20
|
*/
|
|
20
21
|
class DdFlagsWrapper implements DdFlagsType {
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
22
|
+
private get nativeFlags(): DdNativeFlagsType {
|
|
23
|
+
return getNativeDdFlags() as DdNativeFlagsType;
|
|
24
|
+
}
|
|
24
25
|
|
|
25
26
|
private isFeatureEnabled = false;
|
|
26
27
|
|
package/src/flags/FlagsClient.ts
CHANGED
|
@@ -7,6 +7,7 @@
|
|
|
7
7
|
import { InternalLog } from '../InternalLog';
|
|
8
8
|
import { SdkVerbosity } from '../config/types/SdkVerbosity';
|
|
9
9
|
import type { DdNativeFlagsType } from '../nativeModulesTypes';
|
|
10
|
+
import { getNativeDdFlags } from '../specs/NativeDdFlags';
|
|
10
11
|
|
|
11
12
|
// Imported directly (not via the module index): context matching is an internal helper,
|
|
12
13
|
// used here only to detect a runtime context an offline precomputed configuration cannot honor.
|
|
@@ -82,9 +83,9 @@ interface OfflineFlagsEvaluator {
|
|
|
82
83
|
}
|
|
83
84
|
|
|
84
85
|
export class FlagsClient {
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
86
|
+
private get nativeFlags(): DdNativeFlagsType {
|
|
87
|
+
return getNativeDdFlags() as DdNativeFlagsType;
|
|
88
|
+
}
|
|
88
89
|
|
|
89
90
|
private clientName: string;
|
|
90
91
|
|
package/src/index.tsx
CHANGED
|
@@ -116,6 +116,13 @@ export {
|
|
|
116
116
|
__ddExtractText,
|
|
117
117
|
__ddEnrichEvaluationContextWithRumUser
|
|
118
118
|
};
|
|
119
|
+
export type {
|
|
120
|
+
HeaderCaptureRule,
|
|
121
|
+
DefaultsRule,
|
|
122
|
+
MatchHeadersRule,
|
|
123
|
+
MatchRequestHeadersRule,
|
|
124
|
+
MatchResponseHeadersRule
|
|
125
|
+
} from './config/features/RumConfiguration.type';
|
|
119
126
|
export type {
|
|
120
127
|
Timestamp,
|
|
121
128
|
FirstPartyHost,
|
package/src/internal.ts
ADDED
|
@@ -0,0 +1,32 @@
|
|
|
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
|
+
* Sanctioned entry point for cross-package internals consumed by platform
|
|
9
|
+
* packages (e.g. @datadog/mobile-react-native-vega). NOT part of the public API
|
|
10
|
+
* and may change between minor versions. Everything re-exported here must be
|
|
11
|
+
* native-free at import (must not call TurboModuleRegistry / NativeModules at
|
|
12
|
+
* module load).
|
|
13
|
+
*/
|
|
14
|
+
export { addDefaultValuesToAutoInstrumentationConfiguration } from './config/async/AutoInstrumentationConfiguration';
|
|
15
|
+
export { buildConfigurationFromPartialConfiguration } from './config/async/asyncInitializationHelper';
|
|
16
|
+
export { DdSdkNativeConfiguration } from './config/features/CoreConfigurationNative';
|
|
17
|
+
export { RUM_DEFAULTS } from './config/features/RumConfiguration';
|
|
18
|
+
export { adaptLongTaskThreshold } from './utils/longTasksUtils';
|
|
19
|
+
export { version } from './version';
|
|
20
|
+
export { AccountInfoSingleton } from './sdk/AccountInfoSingleton/AccountInfoSingleton';
|
|
21
|
+
export { AttributesSingleton } from './sdk/AttributesSingleton/AttributesSingleton';
|
|
22
|
+
export { UserInfoSingleton } from './sdk/UserInfoSingleton/UserInfoSingleton';
|
|
23
|
+
export { GlobalState } from './sdk/GlobalState/GlobalState';
|
|
24
|
+
export { BufferSingleton } from './sdk/DatadogProvider/Buffer/BufferSingleton';
|
|
25
|
+
export { DatadogProviderState } from './sdk/DatadogProvider/DatadogProviderState';
|
|
26
|
+
export { DdRumResourceTracking } from './rum/instrumentation/resourceTracking/DdRumResourceTracking';
|
|
27
|
+
|
|
28
|
+
export type { Attributes } from './sdk/AttributesSingleton/types';
|
|
29
|
+
export type { LogsNativeConfiguration } from './config/features/LogsConfigurationNative';
|
|
30
|
+
export type { RumNativeConfiguration } from './config/features/RumConfigurationNative';
|
|
31
|
+
export type { TraceNativeConfiguration } from './config/features/TraceConfigurationNative';
|
|
32
|
+
export type { InitializationModeForTelemetry } from './config/types/InitializationModeForTelemetry';
|
package/src/logs/DdLogs.ts
CHANGED
|
@@ -11,6 +11,7 @@ import { debugId } from '../metro/debugIdResolver';
|
|
|
11
11
|
import type { DdNativeLogsType } from '../nativeModulesTypes';
|
|
12
12
|
import { encodeAttributes } from '../sdk/AttributesEncoding/attributesEncoding';
|
|
13
13
|
import { bufferVoidNativeCall } from '../sdk/DatadogProvider/Buffer/bufferNativeCall';
|
|
14
|
+
import { getNativeDdLogs } from '../specs/NativeDdLogs';
|
|
14
15
|
import type { ErrorSource, LogEventMapper } from '../types';
|
|
15
16
|
import { getGlobalInstance } from '../utils/singletonUtils';
|
|
16
17
|
|
|
@@ -44,9 +45,9 @@ const isLogWithError = (
|
|
|
44
45
|
};
|
|
45
46
|
|
|
46
47
|
class DdLogsWrapper implements DdLogsType {
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
48
|
+
private get nativeLogs(): DdNativeLogsType {
|
|
49
|
+
return getNativeDdLogs() as DdNativeLogsType;
|
|
50
|
+
}
|
|
50
51
|
private logEventMapper = generateEventMapper(undefined);
|
|
51
52
|
|
|
52
53
|
debug = (...args: LogArguments | LogWithErrorArguments): Promise<void> => {
|
package/src/rum/DdRum.ts
CHANGED
|
@@ -15,6 +15,7 @@ import type { Attributes } from '../sdk/AttributesSingleton/types';
|
|
|
15
15
|
import { bufferVoidNativeCall } from '../sdk/DatadogProvider/Buffer/bufferNativeCall';
|
|
16
16
|
import { DdSdk } from '../sdk/DdSdk';
|
|
17
17
|
import { GlobalState } from '../sdk/GlobalState/GlobalState';
|
|
18
|
+
import { getNativeDdRum } from '../specs/NativeDdRum';
|
|
18
19
|
import type { ErrorSource, FeatureOperationFailure } from '../types';
|
|
19
20
|
import { getGlobalInstance } from '../utils/singletonUtils';
|
|
20
21
|
import { DefaultTimeProvider } from '../utils/time-provider/DefaultTimeProvider';
|
|
@@ -77,9 +78,9 @@ const touchDataFromEvent = (
|
|
|
77
78
|
};
|
|
78
79
|
|
|
79
80
|
class DdRumWrapper implements DdRumType {
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
81
|
+
private get nativeRum(): DdNativeRumType {
|
|
82
|
+
return getNativeDdRum() as DdNativeRumType;
|
|
83
|
+
}
|
|
83
84
|
private lastActionData?: { type: RumActionType; name: string };
|
|
84
85
|
private errorEventMapper = generateErrorEventMapper(undefined);
|
|
85
86
|
private resourceEventMapper = generateResourceEventMapper(undefined);
|
|
@@ -427,6 +428,16 @@ class DdRumWrapper implements DdRumType {
|
|
|
427
428
|
);
|
|
428
429
|
};
|
|
429
430
|
|
|
431
|
+
reportAppFullyDisplayed = (): Promise<void> => {
|
|
432
|
+
InternalLog.log(
|
|
433
|
+
'Reporting App Fully Displayed (TTFD)',
|
|
434
|
+
SdkVerbosity.DEBUG
|
|
435
|
+
);
|
|
436
|
+
return bufferVoidNativeCall(() =>
|
|
437
|
+
this.nativeRum.reportAppFullyDisplayed()
|
|
438
|
+
);
|
|
439
|
+
};
|
|
440
|
+
|
|
430
441
|
stopSession = (): Promise<void> => {
|
|
431
442
|
InternalLog.log('Stopping RUM Session', SdkVerbosity.DEBUG);
|
|
432
443
|
clearCachedSessionId();
|
|
@@ -12,7 +12,7 @@ import { InternalLog } from '../../InternalLog';
|
|
|
12
12
|
import { SdkVerbosity } from '../../config/types';
|
|
13
13
|
import { BufferSingleton } from '../../sdk/DatadogProvider/Buffer/BufferSingleton';
|
|
14
14
|
import { GlobalState } from '../../sdk/GlobalState/GlobalState';
|
|
15
|
-
import
|
|
15
|
+
import { getNativeDdSdk } from '../../specs/NativeDdSdk';
|
|
16
16
|
import { ErrorSource } from '../../types';
|
|
17
17
|
import { DdRum } from '../DdRum';
|
|
18
18
|
import type { ActionEventMapper } from '../eventMappers/actionEventMapper';
|
|
@@ -1444,7 +1444,7 @@ describe('DdRum', () => {
|
|
|
1444
1444
|
test('does not call the native SDK when startAction has not been called before and using old API', async () => {
|
|
1445
1445
|
await DdRum.stopAction({ user: 'me' }, 789);
|
|
1446
1446
|
expect(NativeModules.DdRum.stopAction).not.toHaveBeenCalled();
|
|
1447
|
-
expect(
|
|
1447
|
+
expect(getNativeDdSdk()?.telemetryDebug).not.toHaveBeenCalled();
|
|
1448
1448
|
});
|
|
1449
1449
|
|
|
1450
1450
|
test('calls the native SDK when called with old API', async () => {
|
|
@@ -1456,7 +1456,7 @@ describe('DdRum', () => {
|
|
|
1456
1456
|
{ user: 'me' },
|
|
1457
1457
|
789
|
|
1458
1458
|
);
|
|
1459
|
-
expect(
|
|
1459
|
+
expect(getNativeDdSdk()?.telemetryDebug).toHaveBeenCalledWith(
|
|
1460
1460
|
'DDdRum.stopAction called with the old signature'
|
|
1461
1461
|
);
|
|
1462
1462
|
});
|
|
@@ -1470,7 +1470,7 @@ describe('DdRum', () => {
|
|
|
1470
1470
|
{},
|
|
1471
1471
|
456
|
|
1472
1472
|
);
|
|
1473
|
-
expect(
|
|
1473
|
+
expect(getNativeDdSdk()?.telemetryDebug).toHaveBeenCalledWith(
|
|
1474
1474
|
'DDdRum.stopAction called with the old signature'
|
|
1475
1475
|
);
|
|
1476
1476
|
});
|
|
@@ -1884,6 +1884,16 @@ describe('DdRum', () => {
|
|
|
1884
1884
|
});
|
|
1885
1885
|
});
|
|
1886
1886
|
|
|
1887
|
+
describe('DdRum.reportAppFullyDisplayed', () => {
|
|
1888
|
+
it('calls the native API', async () => {
|
|
1889
|
+
await DdRum.reportAppFullyDisplayed();
|
|
1890
|
+
|
|
1891
|
+
expect(
|
|
1892
|
+
NativeModules.DdRum.reportAppFullyDisplayed
|
|
1893
|
+
).toHaveBeenCalledTimes(1);
|
|
1894
|
+
});
|
|
1895
|
+
});
|
|
1896
|
+
|
|
1887
1897
|
describe('PropagatorTypes', () => {
|
|
1888
1898
|
it('matches with the native name of propagators', () => {
|
|
1889
1899
|
/**
|
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
* Copyright 2016-Present Datadog, Inc.
|
|
5
5
|
*/
|
|
6
6
|
|
|
7
|
-
import
|
|
7
|
+
import { getNativeDdSdk } from '../../../specs/NativeDdSdk';
|
|
8
8
|
import { getGlobalInstance } from '../../../utils/singletonUtils';
|
|
9
9
|
import { DefaultTimeProvider } from '../../../utils/time-provider/DefaultTimeProvider';
|
|
10
10
|
import type { TimeProvider } from '../../../utils/time-provider/TimeProvider';
|
|
@@ -76,41 +76,48 @@ class BabelInteractionTracking {
|
|
|
76
76
|
|
|
77
77
|
const { useAccessibilityLabel } = this.config;
|
|
78
78
|
|
|
79
|
-
const
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
79
|
+
const index = handlerArgs
|
|
80
|
+
? handlerArgs.find(x => typeof x === 'number') || 0
|
|
81
|
+
: 0;
|
|
82
|
+
|
|
83
|
+
// Picks the value at `index` (positions map to compound component parts).
|
|
84
|
+
// Values can come from runtime expressions, so a value that doesn't resolve
|
|
85
|
+
// to a usable name returns null and lets the next naming source take over.
|
|
86
|
+
const getIndexedValue = (values: unknown): string | null => {
|
|
87
|
+
if (!Array.isArray(values) || values.length === 0) {
|
|
88
|
+
return null;
|
|
89
|
+
}
|
|
90
|
+
|
|
91
|
+
// Fail-safe in case the our 'index' value turns out to not be a real index
|
|
92
|
+
const value =
|
|
93
|
+
index + 1 > values.length || index < 0
|
|
94
|
+
? values[0]
|
|
95
|
+
: values[index];
|
|
96
|
+
|
|
97
|
+
if (
|
|
98
|
+
(typeof value === 'string' && value.length > 0) ||
|
|
99
|
+
(typeof value === 'number' && Number.isFinite(value))
|
|
100
|
+
) {
|
|
101
|
+
return String(value);
|
|
83
102
|
}
|
|
84
103
|
|
|
85
104
|
return null;
|
|
86
105
|
};
|
|
87
106
|
|
|
88
107
|
const getAccessibilityLabel = () =>
|
|
89
|
-
useAccessibilityLabel
|
|
90
|
-
? accessibilityLabel
|
|
91
|
-
: null;
|
|
92
|
-
|
|
93
|
-
const index = handlerArgs
|
|
94
|
-
? handlerArgs.find(x => typeof x === 'number') || 0
|
|
95
|
-
: 0;
|
|
108
|
+
useAccessibilityLabel ? getIndexedValue(accessibilityLabel) : null;
|
|
96
109
|
|
|
97
110
|
// Order: actionName → actionNameAttribute → accessibilityLabel → content
|
|
98
|
-
const
|
|
99
|
-
actionName
|
|
100
|
-
Object.values(attrs)[0]
|
|
101
|
-
getAccessibilityLabel()
|
|
102
|
-
|
|
111
|
+
const output =
|
|
112
|
+
getIndexedValue(actionName) ??
|
|
113
|
+
getIndexedValue(Object.values(attrs)[0]) ??
|
|
114
|
+
getAccessibilityLabel() ??
|
|
115
|
+
getIndexedValue(getContent?.());
|
|
103
116
|
|
|
104
|
-
if (
|
|
117
|
+
if (output === null) {
|
|
105
118
|
return componentName;
|
|
106
119
|
}
|
|
107
120
|
|
|
108
|
-
// Fail-safe in case the our 'index' value turns out to not be a real index
|
|
109
|
-
const output =
|
|
110
|
-
index + 1 > selectedContent.length || index < 0
|
|
111
|
-
? selectedContent[0]
|
|
112
|
-
: selectedContent[index];
|
|
113
|
-
|
|
114
121
|
return options.useNamePrefix
|
|
115
122
|
? `${componentName} ("${output}")`
|
|
116
123
|
: output;
|
|
@@ -123,7 +130,7 @@ class BabelInteractionTracking {
|
|
|
123
130
|
): (...args: any[]) => any {
|
|
124
131
|
return (...args: any[]) => {
|
|
125
132
|
if (!this.telemetrySent) {
|
|
126
|
-
|
|
133
|
+
getNativeDdSdk()?.sendTelemetryLog(
|
|
127
134
|
BABEL_PLUGIN_TELEMETRY,
|
|
128
135
|
this.getTelemetryConfig(),
|
|
129
136
|
{ onlyOnce: true }
|
|
@@ -147,7 +154,7 @@ class BabelInteractionTracking {
|
|
|
147
154
|
)
|
|
148
155
|
.catch(e => {
|
|
149
156
|
if (e instanceof Error) {
|
|
150
|
-
|
|
157
|
+
getNativeDdSdk()?.telemetryError(
|
|
151
158
|
e.message,
|
|
152
159
|
e.stack || '',
|
|
153
160
|
'BabelActionTrack'
|