@datadog/mobile-react-native 2.4.0 → 2.4.2
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/android/build.gradle +1 -0
- package/android/src/main/kotlin/com/datadog/reactnative/DdRumImplementation.kt +6 -0
- package/android/src/main/kotlin/com/datadog/reactnative/DdSdkImplementation.kt +31 -24
- package/android/src/main/kotlin/com/datadog/reactnative/FrameRateProvider.kt +63 -0
- package/android/src/main/kotlin/com/datadog/reactnative/SdkVersion.kt +1 -1
- package/android/src/main/kotlin/com/datadog/reactnative/UiThreadExecutor.kt +25 -0
- package/android/src/newarch/kotlin/com/datadog/reactnative/DdRum.kt +10 -1
- package/android/src/oldarch/kotlin/com/datadog/reactnative/DdRum.kt +10 -1
- package/android/src/test/kotlin/com/datadog/reactnative/DdRumTest.kt +29 -0
- package/android/src/test/kotlin/com/datadog/reactnative/DdSdkTest.kt +34 -14
- package/android/src/test/kotlin/com/datadog/tools/unit/TestUiThreadExecutor.kt +16 -0
- package/datadog-sourcemaps.gradle +3 -5
- package/ios/Sources/DdRum.mm +4 -3
- package/ios/Sources/DdRumImplementation.swift +15 -2
- package/ios/Sources/SdkVersion.swift +1 -1
- package/lib/commonjs/DdSdkReactNative.js +105 -150
- package/lib/commonjs/DdSdkReactNative.js.map +1 -1
- package/lib/commonjs/DdSdkReactNativeConfiguration.js +54 -119
- package/lib/commonjs/DdSdkReactNativeConfiguration.js.map +1 -1
- package/lib/commonjs/InternalLog.js +8 -19
- package/lib/commonjs/InternalLog.js.map +1 -1
- package/lib/commonjs/ProxyConfiguration.js +3 -15
- package/lib/commonjs/ProxyConfiguration.js.map +1 -1
- package/lib/commonjs/SdkVerbosity.js +3 -7
- package/lib/commonjs/SdkVerbosity.js.map +1 -1
- package/lib/commonjs/TrackingConsent.js +3 -7
- package/lib/commonjs/TrackingConsent.js.map +1 -1
- package/lib/commonjs/index.js +51 -65
- package/lib/commonjs/index.js.map +1 -1
- package/lib/commonjs/logs/DdLogs.js +103 -123
- package/lib/commonjs/logs/DdLogs.js.map +1 -1
- package/lib/commonjs/logs/eventMapper.js +4 -11
- package/lib/commonjs/logs/eventMapper.js.map +1 -1
- package/lib/commonjs/logs/types.js +4 -0
- package/lib/commonjs/logs/types.js.map +1 -1
- package/lib/commonjs/nativeModulesTypes.js +4 -3
- package/lib/commonjs/nativeModulesTypes.js.map +1 -1
- package/lib/commonjs/polyfills.js +28 -0
- package/lib/commonjs/polyfills.js.map +1 -0
- package/lib/commonjs/rum/DdAttributes.js +26 -0
- package/lib/commonjs/rum/DdAttributes.js.map +1 -0
- package/lib/commonjs/rum/DdRum.js +145 -210
- package/lib/commonjs/rum/DdRum.js.map +1 -1
- package/lib/commonjs/rum/eventMappers/actionEventMapper.js +5 -8
- package/lib/commonjs/rum/eventMappers/actionEventMapper.js.map +1 -1
- package/lib/commonjs/rum/eventMappers/errorEventMapper.js +3 -7
- package/lib/commonjs/rum/eventMappers/errorEventMapper.js.map +1 -1
- package/lib/commonjs/rum/eventMappers/resourceEventMapper.js +5 -8
- package/lib/commonjs/rum/eventMappers/resourceEventMapper.js.map +1 -1
- package/lib/commonjs/rum/instrumentation/DdRumErrorTracking.js +68 -89
- package/lib/commonjs/rum/instrumentation/DdRumErrorTracking.js.map +1 -1
- package/lib/commonjs/rum/instrumentation/interactionTracking/DdEventsInterceptor.js +13 -46
- package/lib/commonjs/rum/instrumentation/interactionTracking/DdEventsInterceptor.js.map +1 -1
- package/lib/commonjs/rum/instrumentation/interactionTracking/DdRumUserInteractionTracking.js +52 -66
- package/lib/commonjs/rum/instrumentation/interactionTracking/DdRumUserInteractionTracking.js.map +1 -1
- package/lib/commonjs/rum/instrumentation/interactionTracking/EventsInterceptor.js.map +1 -1
- package/lib/commonjs/rum/instrumentation/interactionTracking/NoOpEventsInterceptor.js +3 -4
- package/lib/commonjs/rum/instrumentation/interactionTracking/NoOpEventsInterceptor.js.map +1 -1
- package/lib/commonjs/rum/instrumentation/interactionTracking/ShallowObjectEqualityChecker.js +0 -6
- package/lib/commonjs/rum/instrumentation/interactionTracking/ShallowObjectEqualityChecker.js.map +1 -1
- package/lib/commonjs/rum/instrumentation/interactionTracking/getJsxRuntime.js +18 -19
- package/lib/commonjs/rum/instrumentation/interactionTracking/getJsxRuntime.js.map +1 -1
- package/lib/commonjs/rum/instrumentation/resourceTracking/DdRumResourceTracking.js +6 -21
- package/lib/commonjs/rum/instrumentation/resourceTracking/DdRumResourceTracking.js.map +1 -1
- package/lib/commonjs/rum/instrumentation/resourceTracking/distributedTracing/TracingIdentifier.js +32 -55
- package/lib/commonjs/rum/instrumentation/resourceTracking/distributedTracing/TracingIdentifier.js.map +1 -1
- package/lib/commonjs/rum/instrumentation/resourceTracking/distributedTracing/distributedTracing.js +1 -9
- package/lib/commonjs/rum/instrumentation/resourceTracking/distributedTracing/distributedTracing.js.map +1 -1
- package/lib/commonjs/rum/instrumentation/resourceTracking/distributedTracing/distributedTracingHeaders.js +15 -41
- package/lib/commonjs/rum/instrumentation/resourceTracking/distributedTracing/distributedTracingHeaders.js.map +1 -1
- package/lib/commonjs/rum/instrumentation/resourceTracking/distributedTracing/firstPartyHosts.js +3 -13
- package/lib/commonjs/rum/instrumentation/resourceTracking/distributedTracing/firstPartyHosts.js.map +1 -1
- package/lib/commonjs/rum/instrumentation/resourceTracking/graphql/graphqlHeaders.js +5 -10
- package/lib/commonjs/rum/instrumentation/resourceTracking/graphql/graphqlHeaders.js.map +1 -1
- package/lib/commonjs/rum/instrumentation/resourceTracking/requestProxy/XHRProxy/DatadogRumResource/ResourceReporter.js +16 -35
- package/lib/commonjs/rum/instrumentation/resourceTracking/requestProxy/XHRProxy/DatadogRumResource/ResourceReporter.js.map +1 -1
- package/lib/commonjs/rum/instrumentation/resourceTracking/requestProxy/XHRProxy/DatadogRumResource/internalDevResourceBlocklist.js +2 -5
- package/lib/commonjs/rum/instrumentation/resourceTracking/requestProxy/XHRProxy/DatadogRumResource/internalDevResourceBlocklist.js.map +1 -1
- package/lib/commonjs/rum/instrumentation/resourceTracking/requestProxy/XHRProxy/DatadogRumResource/resourceTiming.js +4 -7
- package/lib/commonjs/rum/instrumentation/resourceTracking/requestProxy/XHRProxy/DatadogRumResource/resourceTiming.js.map +1 -1
- package/lib/commonjs/rum/instrumentation/resourceTracking/requestProxy/XHRProxy/URLHostParser.js +4 -10
- package/lib/commonjs/rum/instrumentation/resourceTracking/requestProxy/XHRProxy/URLHostParser.js.map +1 -1
- package/lib/commonjs/rum/instrumentation/resourceTracking/requestProxy/XHRProxy/XHRProxy.js +25 -58
- package/lib/commonjs/rum/instrumentation/resourceTracking/requestProxy/XHRProxy/XHRProxy.js.map +1 -1
- package/lib/commonjs/rum/instrumentation/resourceTracking/requestProxy/XHRProxy/responseSize.js +4 -26
- package/lib/commonjs/rum/instrumentation/resourceTracking/requestProxy/XHRProxy/responseSize.js.map +1 -1
- package/lib/commonjs/rum/instrumentation/resourceTracking/requestProxy/interfaces/RequestProxy.js +1 -11
- package/lib/commonjs/rum/instrumentation/resourceTracking/requestProxy/interfaces/RequestProxy.js.map +1 -1
- package/lib/commonjs/rum/instrumentation/resourceTracking/requestProxy/interfaces/RumResource.js +4 -0
- package/lib/commonjs/rum/instrumentation/resourceTracking/requestProxy/interfaces/RumResource.js.map +1 -1
- package/lib/commonjs/rum/types.js +15 -27
- package/lib/commonjs/rum/types.js.map +1 -1
- package/lib/commonjs/sdk/AttributesSingleton/AttributesSingleton.js +20 -30
- package/lib/commonjs/sdk/AttributesSingleton/AttributesSingleton.js.map +1 -1
- package/lib/commonjs/sdk/AttributesSingleton/types.js.map +1 -1
- package/lib/commonjs/sdk/DatadogProvider/Buffer/BoundedBuffer.js +112 -144
- package/lib/commonjs/sdk/DatadogProvider/Buffer/BoundedBuffer.js.map +1 -1
- package/lib/commonjs/sdk/DatadogProvider/Buffer/BufferSingleton.js +19 -22
- package/lib/commonjs/sdk/DatadogProvider/Buffer/BufferSingleton.js.map +1 -1
- package/lib/commonjs/sdk/DatadogProvider/Buffer/DatadogBuffer.js +1 -15
- package/lib/commonjs/sdk/DatadogProvider/Buffer/DatadogBuffer.js.map +1 -1
- package/lib/commonjs/sdk/DatadogProvider/Buffer/PassThroughBuffer.js +9 -16
- package/lib/commonjs/sdk/DatadogProvider/Buffer/PassThroughBuffer.js.map +1 -1
- package/lib/commonjs/sdk/DatadogProvider/Buffer/bufferNativeCall.js +2 -8
- package/lib/commonjs/sdk/DatadogProvider/Buffer/bufferNativeCall.js.map +1 -1
- package/lib/commonjs/sdk/DatadogProvider/DatadogProvider.js +8 -25
- package/lib/commonjs/sdk/DatadogProvider/DatadogProvider.js.map +1 -1
- package/lib/commonjs/sdk/DdSdk.js +2 -4
- package/lib/commonjs/sdk/DdSdk.js.map +1 -1
- package/lib/commonjs/sdk/EventMappers/EventMapper.js +31 -51
- package/lib/commonjs/sdk/EventMappers/EventMapper.js.map +1 -1
- package/lib/commonjs/sdk/EventMappers/utils/deepClone.js +9 -24
- package/lib/commonjs/sdk/EventMappers/utils/deepClone.js.map +1 -1
- package/lib/commonjs/sdk/FileBasedConfiguration/FileBasedConfiguration.js +6 -38
- package/lib/commonjs/sdk/FileBasedConfiguration/FileBasedConfiguration.js.map +1 -1
- package/lib/commonjs/sdk/GlobalState/GlobalState.js +33 -0
- package/lib/commonjs/sdk/GlobalState/GlobalState.js.map +1 -0
- package/lib/commonjs/sdk/UserInfoSingleton/UserInfoSingleton.js +17 -28
- package/lib/commonjs/sdk/UserInfoSingleton/UserInfoSingleton.js.map +1 -1
- package/lib/commonjs/sdk/UserInfoSingleton/types.js.map +1 -1
- package/lib/commonjs/specs/NativeDdLogs.js +5 -6
- package/lib/commonjs/specs/NativeDdLogs.js.map +1 -1
- package/lib/commonjs/specs/NativeDdRum.js +5 -6
- package/lib/commonjs/specs/NativeDdRum.js.map +1 -1
- package/lib/commonjs/specs/NativeDdSdk.js +5 -6
- package/lib/commonjs/specs/NativeDdSdk.js.map +1 -1
- package/lib/commonjs/specs/NativeDdTrace.js +5 -6
- package/lib/commonjs/specs/NativeDdTrace.js.map +1 -1
- package/lib/commonjs/trace/DdTrace.js +17 -29
- package/lib/commonjs/trace/DdTrace.js.map +1 -1
- package/lib/commonjs/types.js +4 -3
- package/lib/commonjs/types.js.map +1 -1
- package/lib/commonjs/utils/Timer.js +7 -22
- package/lib/commonjs/utils/Timer.js.map +1 -1
- package/lib/commonjs/utils/argsUtils.js +3 -11
- package/lib/commonjs/utils/argsUtils.js.map +1 -1
- package/lib/commonjs/utils/errorUtils.js +9 -22
- package/lib/commonjs/utils/errorUtils.js.map +1 -1
- package/lib/commonjs/utils/jsUtils.js +1 -2
- package/lib/commonjs/utils/jsUtils.js.map +1 -1
- package/lib/commonjs/utils/longTasksUtils.js +2 -7
- package/lib/commonjs/utils/longTasksUtils.js.map +1 -1
- package/lib/commonjs/utils/time-provider/DefaultTimeProvider.js +9 -15
- package/lib/commonjs/utils/time-provider/DefaultTimeProvider.js.map +1 -1
- package/lib/commonjs/utils/time-provider/TimeProvider.js +1 -11
- package/lib/commonjs/utils/time-provider/TimeProvider.js.map +1 -1
- package/lib/commonjs/version.js +1 -2
- package/lib/commonjs/version.js.map +1 -1
- package/lib/module/DdSdkReactNative.js +102 -122
- package/lib/module/DdSdkReactNative.js.map +1 -1
- package/lib/module/DdSdkReactNativeConfiguration.js +49 -101
- package/lib/module/DdSdkReactNativeConfiguration.js.map +1 -1
- package/lib/module/InternalLog.js +4 -15
- package/lib/module/InternalLog.js.map +1 -1
- package/lib/module/ProxyConfiguration.js +3 -14
- package/lib/module/ProxyConfiguration.js.map +1 -1
- package/lib/module/SdkVerbosity.js +3 -4
- package/lib/module/SdkVerbosity.js.map +1 -1
- package/lib/module/TrackingConsent.js +3 -4
- package/lib/module/TrackingConsent.js.map +1 -1
- package/lib/module/index.js +5 -0
- package/lib/module/index.js.map +1 -1
- package/lib/module/logs/DdLogs.js +98 -117
- package/lib/module/logs/DdLogs.js.map +1 -1
- package/lib/module/logs/eventMapper.js +3 -1
- package/lib/module/logs/eventMapper.js.map +1 -1
- package/lib/module/logs/types.js +1 -1
- package/lib/module/logs/types.js.map +1 -1
- package/lib/module/nativeModulesTypes.js +5 -1
- package/lib/module/nativeModulesTypes.js.map +1 -1
- package/lib/module/polyfills.js +26 -0
- package/lib/module/polyfills.js.map +1 -0
- package/lib/module/rum/DdAttributes.js +20 -0
- package/lib/module/rum/DdAttributes.js.map +1 -0
- package/lib/module/rum/DdRum.js +140 -187
- package/lib/module/rum/DdRum.js.map +1 -1
- package/lib/module/rum/eventMappers/actionEventMapper.js +5 -5
- package/lib/module/rum/eventMappers/actionEventMapper.js.map +1 -1
- package/lib/module/rum/eventMappers/errorEventMapper.js +3 -4
- package/lib/module/rum/eventMappers/errorEventMapper.js.map +1 -1
- package/lib/module/rum/eventMappers/resourceEventMapper.js +5 -5
- package/lib/module/rum/eventMappers/resourceEventMapper.js.map +1 -1
- package/lib/module/rum/instrumentation/DdRumErrorTracking.js +64 -79
- package/lib/module/rum/instrumentation/DdRumErrorTracking.js.map +1 -1
- package/lib/module/rum/instrumentation/interactionTracking/DdEventsInterceptor.js +7 -36
- package/lib/module/rum/instrumentation/interactionTracking/DdEventsInterceptor.js.map +1 -1
- package/lib/module/rum/instrumentation/interactionTracking/DdRumUserInteractionTracking.js +49 -54
- package/lib/module/rum/instrumentation/interactionTracking/DdRumUserInteractionTracking.js.map +1 -1
- package/lib/module/rum/instrumentation/interactionTracking/EventsInterceptor.js.map +1 -1
- package/lib/module/rum/instrumentation/interactionTracking/NoOpEventsInterceptor.js +3 -2
- package/lib/module/rum/instrumentation/interactionTracking/NoOpEventsInterceptor.js.map +1 -1
- package/lib/module/rum/instrumentation/interactionTracking/ShallowObjectEqualityChecker.js +0 -4
- package/lib/module/rum/instrumentation/interactionTracking/ShallowObjectEqualityChecker.js.map +1 -1
- package/lib/module/rum/instrumentation/interactionTracking/getJsxRuntime.js +16 -14
- package/lib/module/rum/instrumentation/interactionTracking/getJsxRuntime.js.map +1 -1
- package/lib/module/rum/instrumentation/resourceTracking/DdRumResourceTracking.js +2 -12
- package/lib/module/rum/instrumentation/resourceTracking/DdRumResourceTracking.js.map +1 -1
- package/lib/module/rum/instrumentation/resourceTracking/distributedTracing/TracingIdentifier.js +33 -45
- package/lib/module/rum/instrumentation/resourceTracking/distributedTracing/TracingIdentifier.js.map +1 -1
- package/lib/module/rum/instrumentation/resourceTracking/distributedTracing/distributedTracing.js +1 -4
- package/lib/module/rum/instrumentation/resourceTracking/distributedTracing/distributedTracing.js.map +1 -1
- package/lib/module/rum/instrumentation/resourceTracking/distributedTracing/distributedTracingHeaders.js +2 -10
- package/lib/module/rum/instrumentation/resourceTracking/distributedTracing/distributedTracingHeaders.js.map +1 -1
- package/lib/module/rum/instrumentation/resourceTracking/distributedTracing/firstPartyHosts.js +3 -5
- package/lib/module/rum/instrumentation/resourceTracking/distributedTracing/firstPartyHosts.js.map +1 -1
- package/lib/module/rum/instrumentation/resourceTracking/graphql/graphqlHeaders.js +1 -0
- package/lib/module/rum/instrumentation/resourceTracking/graphql/graphqlHeaders.js.map +1 -1
- package/lib/module/rum/instrumentation/resourceTracking/requestProxy/XHRProxy/DatadogRumResource/ResourceReporter.js +12 -30
- package/lib/module/rum/instrumentation/resourceTracking/requestProxy/XHRProxy/DatadogRumResource/ResourceReporter.js.map +1 -1
- package/lib/module/rum/instrumentation/resourceTracking/requestProxy/XHRProxy/DatadogRumResource/internalDevResourceBlocklist.js +2 -3
- package/lib/module/rum/instrumentation/resourceTracking/requestProxy/XHRProxy/DatadogRumResource/internalDevResourceBlocklist.js.map +1 -1
- package/lib/module/rum/instrumentation/resourceTracking/requestProxy/XHRProxy/DatadogRumResource/resourceTiming.js +4 -4
- package/lib/module/rum/instrumentation/resourceTracking/requestProxy/XHRProxy/DatadogRumResource/resourceTiming.js.map +1 -1
- package/lib/module/rum/instrumentation/resourceTracking/requestProxy/XHRProxy/URLHostParser.js +4 -5
- package/lib/module/rum/instrumentation/resourceTracking/requestProxy/XHRProxy/URLHostParser.js.map +1 -1
- package/lib/module/rum/instrumentation/resourceTracking/requestProxy/XHRProxy/XHRProxy.js +20 -48
- package/lib/module/rum/instrumentation/resourceTracking/requestProxy/XHRProxy/XHRProxy.js.map +1 -1
- package/lib/module/rum/instrumentation/resourceTracking/requestProxy/XHRProxy/responseSize.js +2 -20
- package/lib/module/rum/instrumentation/resourceTracking/requestProxy/XHRProxy/responseSize.js.map +1 -1
- package/lib/module/rum/instrumentation/resourceTracking/requestProxy/interfaces/RequestProxy.js +1 -9
- package/lib/module/rum/instrumentation/resourceTracking/requestProxy/interfaces/RequestProxy.js.map +1 -1
- package/lib/module/rum/instrumentation/resourceTracking/requestProxy/interfaces/RumResource.js +1 -1
- package/lib/module/rum/instrumentation/resourceTracking/requestProxy/interfaces/RumResource.js.map +1 -1
- package/lib/module/rum/types.js +14 -18
- package/lib/module/rum/types.js.map +1 -1
- package/lib/module/sdk/AttributesSingleton/AttributesSingleton.js +20 -28
- package/lib/module/sdk/AttributesSingleton/AttributesSingleton.js.map +1 -1
- package/lib/module/sdk/AttributesSingleton/types.js.map +1 -1
- package/lib/module/sdk/DatadogProvider/Buffer/BoundedBuffer.js +108 -137
- package/lib/module/sdk/DatadogProvider/Buffer/BoundedBuffer.js.map +1 -1
- package/lib/module/sdk/DatadogProvider/Buffer/BufferSingleton.js +14 -18
- package/lib/module/sdk/DatadogProvider/Buffer/BufferSingleton.js.map +1 -1
- package/lib/module/sdk/DatadogProvider/Buffer/DatadogBuffer.js +1 -13
- package/lib/module/sdk/DatadogProvider/Buffer/DatadogBuffer.js.map +1 -1
- package/lib/module/sdk/DatadogProvider/Buffer/PassThroughBuffer.js +5 -14
- package/lib/module/sdk/DatadogProvider/Buffer/PassThroughBuffer.js.map +1 -1
- package/lib/module/sdk/DatadogProvider/Buffer/bufferNativeCall.js +1 -0
- package/lib/module/sdk/DatadogProvider/Buffer/bufferNativeCall.js.map +1 -1
- package/lib/module/sdk/DatadogProvider/DatadogProvider.js +6 -14
- package/lib/module/sdk/DatadogProvider/DatadogProvider.js.map +1 -1
- package/lib/module/sdk/DdSdk.js +1 -1
- package/lib/module/sdk/DdSdk.js.map +1 -1
- package/lib/module/sdk/EventMappers/EventMapper.js +27 -41
- package/lib/module/sdk/EventMappers/EventMapper.js.map +1 -1
- package/lib/module/sdk/EventMappers/utils/deepClone.js +9 -22
- package/lib/module/sdk/EventMappers/utils/deepClone.js.map +1 -1
- package/lib/module/sdk/FileBasedConfiguration/FileBasedConfiguration.js +5 -29
- package/lib/module/sdk/FileBasedConfiguration/FileBasedConfiguration.js.map +1 -1
- package/lib/module/sdk/GlobalState/GlobalState.js +26 -0
- package/lib/module/sdk/GlobalState/GlobalState.js.map +1 -0
- package/lib/module/sdk/UserInfoSingleton/UserInfoSingleton.js +17 -26
- package/lib/module/sdk/UserInfoSingleton/UserInfoSingleton.js.map +1 -1
- package/lib/module/sdk/UserInfoSingleton/types.js.map +1 -1
- package/lib/module/specs/NativeDdLogs.js +3 -0
- package/lib/module/specs/NativeDdLogs.js.map +1 -1
- package/lib/module/specs/NativeDdRum.js +3 -0
- package/lib/module/specs/NativeDdRum.js.map +1 -1
- package/lib/module/specs/NativeDdSdk.js +3 -0
- package/lib/module/specs/NativeDdSdk.js.map +1 -1
- package/lib/module/specs/NativeDdTrace.js +3 -0
- package/lib/module/specs/NativeDdTrace.js.map +1 -1
- package/lib/module/trace/DdTrace.js +12 -19
- package/lib/module/trace/DdTrace.js.map +1 -1
- package/lib/module/types.js +5 -1
- package/lib/module/types.js.map +1 -1
- package/lib/module/utils/Timer.js +3 -20
- package/lib/module/utils/Timer.js.map +1 -1
- package/lib/module/utils/argsUtils.js +3 -5
- package/lib/module/utils/argsUtils.js.map +1 -1
- package/lib/module/utils/errorUtils.js +6 -9
- package/lib/module/utils/errorUtils.js.map +1 -1
- package/lib/module/utils/jsUtils.js +1 -0
- package/lib/module/utils/jsUtils.js.map +1 -1
- package/lib/module/utils/longTasksUtils.js +2 -5
- package/lib/module/utils/longTasksUtils.js.map +1 -1
- package/lib/module/utils/time-provider/DefaultTimeProvider.js +5 -13
- package/lib/module/utils/time-provider/DefaultTimeProvider.js.map +1 -1
- package/lib/module/utils/time-provider/TimeProvider.js +1 -9
- package/lib/module/utils/time-provider/TimeProvider.js.map +1 -1
- package/lib/module/version.js +1 -1
- package/lib/module/version.js.map +1 -1
- package/lib/typescript/DdSdkReactNative.d.ts +1 -5
- package/lib/typescript/DdSdkReactNative.d.ts.map +1 -0
- package/lib/typescript/DdSdkReactNativeConfiguration.d.ts +1 -0
- package/lib/typescript/DdSdkReactNativeConfiguration.d.ts.map +1 -0
- package/lib/typescript/InternalLog.d.ts +1 -0
- package/lib/typescript/InternalLog.d.ts.map +1 -0
- package/lib/typescript/ProxyConfiguration.d.ts +1 -0
- package/lib/typescript/ProxyConfiguration.d.ts.map +1 -0
- package/lib/typescript/SdkVerbosity.d.ts +1 -0
- package/lib/typescript/SdkVerbosity.d.ts.map +1 -0
- package/lib/typescript/TrackingConsent.d.ts +1 -0
- package/lib/typescript/TrackingConsent.d.ts.map +1 -0
- package/lib/typescript/index.d.ts +2 -0
- package/lib/typescript/index.d.ts.map +1 -0
- package/lib/typescript/logs/DdLogs.d.ts +1 -0
- package/lib/typescript/logs/DdLogs.d.ts.map +1 -0
- package/lib/typescript/logs/eventMapper.d.ts +1 -0
- package/lib/typescript/logs/eventMapper.d.ts.map +1 -0
- package/lib/typescript/logs/types.d.ts +6 -1
- package/lib/typescript/logs/types.d.ts.map +1 -0
- package/lib/typescript/nativeModulesTypes.d.ts +3 -1
- package/lib/typescript/nativeModulesTypes.d.ts.map +1 -0
- package/lib/typescript/rum/DdAttributes.d.ts +14 -0
- package/lib/typescript/rum/DdAttributes.d.ts.map +1 -0
- package/lib/typescript/rum/DdRum.d.ts +3 -2
- package/lib/typescript/rum/DdRum.d.ts.map +1 -0
- package/lib/typescript/rum/eventMappers/actionEventMapper.d.ts +1 -0
- package/lib/typescript/rum/eventMappers/actionEventMapper.d.ts.map +1 -0
- package/lib/typescript/rum/eventMappers/errorEventMapper.d.ts +3 -0
- package/lib/typescript/rum/eventMappers/errorEventMapper.d.ts.map +1 -0
- package/lib/typescript/rum/eventMappers/resourceEventMapper.d.ts +1 -0
- package/lib/typescript/rum/eventMappers/resourceEventMapper.d.ts.map +1 -0
- package/lib/typescript/rum/instrumentation/DdRumErrorTracking.d.ts +1 -0
- package/lib/typescript/rum/instrumentation/DdRumErrorTracking.d.ts.map +1 -0
- package/lib/typescript/rum/instrumentation/interactionTracking/DdEventsInterceptor.d.ts +1 -0
- package/lib/typescript/rum/instrumentation/interactionTracking/DdEventsInterceptor.d.ts.map +1 -0
- package/lib/typescript/rum/instrumentation/interactionTracking/DdRumUserInteractionTracking.d.ts +2 -0
- package/lib/typescript/rum/instrumentation/interactionTracking/DdRumUserInteractionTracking.d.ts.map +1 -0
- package/lib/typescript/rum/instrumentation/interactionTracking/EventsInterceptor.d.ts +1 -0
- package/lib/typescript/rum/instrumentation/interactionTracking/EventsInterceptor.d.ts.map +1 -0
- package/lib/typescript/rum/instrumentation/interactionTracking/NoOpEventsInterceptor.d.ts +1 -0
- package/lib/typescript/rum/instrumentation/interactionTracking/NoOpEventsInterceptor.d.ts.map +1 -0
- package/lib/typescript/rum/instrumentation/interactionTracking/ShallowObjectEqualityChecker.d.ts +1 -0
- package/lib/typescript/rum/instrumentation/interactionTracking/ShallowObjectEqualityChecker.d.ts.map +1 -0
- package/lib/typescript/rum/instrumentation/interactionTracking/getJsxRuntime.d.ts +2 -1
- package/lib/typescript/rum/instrumentation/interactionTracking/getJsxRuntime.d.ts.map +1 -0
- package/lib/typescript/rum/instrumentation/resourceTracking/DdRumResourceTracking.d.ts +1 -0
- package/lib/typescript/rum/instrumentation/resourceTracking/DdRumResourceTracking.d.ts.map +1 -0
- package/lib/typescript/rum/instrumentation/resourceTracking/distributedTracing/TracingIdentifier.d.ts +1 -0
- package/lib/typescript/rum/instrumentation/resourceTracking/distributedTracing/TracingIdentifier.d.ts.map +1 -0
- package/lib/typescript/rum/instrumentation/resourceTracking/distributedTracing/distributedTracing.d.ts +1 -0
- package/lib/typescript/rum/instrumentation/resourceTracking/distributedTracing/distributedTracing.d.ts.map +1 -0
- package/lib/typescript/rum/instrumentation/resourceTracking/distributedTracing/distributedTracingHeaders.d.ts +1 -0
- package/lib/typescript/rum/instrumentation/resourceTracking/distributedTracing/distributedTracingHeaders.d.ts.map +1 -0
- package/lib/typescript/rum/instrumentation/resourceTracking/distributedTracing/firstPartyHosts.d.ts +1 -0
- package/lib/typescript/rum/instrumentation/resourceTracking/distributedTracing/firstPartyHosts.d.ts.map +1 -0
- package/lib/typescript/rum/instrumentation/resourceTracking/graphql/graphqlHeaders.d.ts +1 -0
- package/lib/typescript/rum/instrumentation/resourceTracking/graphql/graphqlHeaders.d.ts.map +1 -0
- package/lib/typescript/rum/instrumentation/resourceTracking/requestProxy/XHRProxy/DatadogRumResource/ResourceReporter.d.ts +1 -0
- package/lib/typescript/rum/instrumentation/resourceTracking/requestProxy/XHRProxy/DatadogRumResource/ResourceReporter.d.ts.map +1 -0
- package/lib/typescript/rum/instrumentation/resourceTracking/requestProxy/XHRProxy/DatadogRumResource/internalDevResourceBlocklist.d.ts +1 -0
- package/lib/typescript/rum/instrumentation/resourceTracking/requestProxy/XHRProxy/DatadogRumResource/internalDevResourceBlocklist.d.ts.map +1 -0
- package/lib/typescript/rum/instrumentation/resourceTracking/requestProxy/XHRProxy/DatadogRumResource/resourceTiming.d.ts +1 -0
- package/lib/typescript/rum/instrumentation/resourceTracking/requestProxy/XHRProxy/DatadogRumResource/resourceTiming.d.ts.map +1 -0
- package/lib/typescript/rum/instrumentation/resourceTracking/requestProxy/XHRProxy/URLHostParser.d.ts +1 -0
- package/lib/typescript/rum/instrumentation/resourceTracking/requestProxy/XHRProxy/URLHostParser.d.ts.map +1 -0
- package/lib/typescript/rum/instrumentation/resourceTracking/requestProxy/XHRProxy/XHRProxy.d.ts +1 -0
- package/lib/typescript/rum/instrumentation/resourceTracking/requestProxy/XHRProxy/XHRProxy.d.ts.map +1 -0
- package/lib/typescript/rum/instrumentation/resourceTracking/requestProxy/XHRProxy/responseSize.d.ts +1 -0
- package/lib/typescript/rum/instrumentation/resourceTracking/requestProxy/XHRProxy/responseSize.d.ts.map +1 -0
- package/lib/typescript/rum/instrumentation/resourceTracking/requestProxy/interfaces/RequestProxy.d.ts +1 -0
- package/lib/typescript/rum/instrumentation/resourceTracking/requestProxy/interfaces/RequestProxy.d.ts.map +1 -0
- package/lib/typescript/rum/instrumentation/resourceTracking/requestProxy/interfaces/RumResource.d.ts +1 -0
- package/lib/typescript/rum/instrumentation/resourceTracking/requestProxy/interfaces/RumResource.d.ts.map +1 -0
- package/lib/typescript/rum/types.d.ts +1 -0
- package/lib/typescript/rum/types.d.ts.map +1 -0
- package/lib/typescript/sdk/AttributesSingleton/AttributesSingleton.d.ts +1 -0
- package/lib/typescript/sdk/AttributesSingleton/AttributesSingleton.d.ts.map +1 -0
- package/lib/typescript/sdk/AttributesSingleton/types.d.ts +1 -0
- package/lib/typescript/sdk/AttributesSingleton/types.d.ts.map +1 -0
- package/lib/typescript/sdk/DatadogProvider/Buffer/BoundedBuffer.d.ts +1 -0
- package/lib/typescript/sdk/DatadogProvider/Buffer/BoundedBuffer.d.ts.map +1 -0
- package/lib/typescript/sdk/DatadogProvider/Buffer/BufferSingleton.d.ts +1 -0
- package/lib/typescript/sdk/DatadogProvider/Buffer/BufferSingleton.d.ts.map +1 -0
- package/lib/typescript/sdk/DatadogProvider/Buffer/DatadogBuffer.d.ts +1 -0
- package/lib/typescript/sdk/DatadogProvider/Buffer/DatadogBuffer.d.ts.map +1 -0
- package/lib/typescript/sdk/DatadogProvider/Buffer/PassThroughBuffer.d.ts +1 -0
- package/lib/typescript/sdk/DatadogProvider/Buffer/PassThroughBuffer.d.ts.map +1 -0
- package/lib/typescript/sdk/DatadogProvider/Buffer/bufferNativeCall.d.ts +1 -0
- package/lib/typescript/sdk/DatadogProvider/Buffer/bufferNativeCall.d.ts.map +1 -0
- package/lib/typescript/sdk/DatadogProvider/DatadogProvider.d.ts +1 -0
- package/lib/typescript/sdk/DatadogProvider/DatadogProvider.d.ts.map +1 -0
- package/lib/typescript/sdk/DdSdk.d.ts +1 -0
- package/lib/typescript/sdk/DdSdk.d.ts.map +1 -0
- package/lib/typescript/sdk/EventMappers/EventMapper.d.ts +1 -0
- package/lib/typescript/sdk/EventMappers/EventMapper.d.ts.map +1 -0
- package/lib/typescript/sdk/EventMappers/utils/deepClone.d.ts +1 -0
- package/lib/typescript/sdk/EventMappers/utils/deepClone.d.ts.map +1 -0
- package/lib/typescript/sdk/FileBasedConfiguration/FileBasedConfiguration.d.ts +1 -0
- package/lib/typescript/sdk/FileBasedConfiguration/FileBasedConfiguration.d.ts.map +1 -0
- package/lib/typescript/sdk/GlobalState/GlobalState.d.ts +13 -0
- package/lib/typescript/sdk/GlobalState/GlobalState.d.ts.map +1 -0
- package/lib/typescript/sdk/UserInfoSingleton/UserInfoSingleton.d.ts +1 -0
- package/lib/typescript/sdk/UserInfoSingleton/UserInfoSingleton.d.ts.map +1 -0
- package/lib/typescript/sdk/UserInfoSingleton/types.d.ts +1 -0
- package/lib/typescript/sdk/UserInfoSingleton/types.d.ts.map +1 -0
- package/lib/typescript/specs/NativeDdLogs.d.ts +1 -0
- package/lib/typescript/specs/NativeDdLogs.d.ts.map +1 -0
- package/lib/typescript/specs/NativeDdRum.d.ts +3 -1
- package/lib/typescript/specs/NativeDdRum.d.ts.map +1 -0
- package/lib/typescript/specs/NativeDdSdk.d.ts +1 -0
- package/lib/typescript/specs/NativeDdSdk.d.ts.map +1 -0
- package/lib/typescript/specs/NativeDdTrace.d.ts +1 -0
- package/lib/typescript/specs/NativeDdTrace.d.ts.map +1 -0
- package/lib/typescript/trace/DdTrace.d.ts +1 -0
- package/lib/typescript/trace/DdTrace.d.ts.map +1 -0
- package/lib/typescript/types.d.ts +1 -0
- package/lib/typescript/types.d.ts.map +1 -0
- package/lib/typescript/utils/Timer.d.ts +1 -0
- package/lib/typescript/utils/Timer.d.ts.map +1 -0
- package/lib/typescript/utils/argsUtils.d.ts +1 -0
- package/lib/typescript/utils/argsUtils.d.ts.map +1 -0
- package/lib/typescript/utils/errorUtils.d.ts +1 -0
- package/lib/typescript/utils/errorUtils.d.ts.map +1 -0
- package/lib/typescript/utils/jsUtils.d.ts +1 -0
- package/lib/typescript/utils/jsUtils.d.ts.map +1 -0
- package/lib/typescript/utils/longTasksUtils.d.ts +1 -0
- package/lib/typescript/utils/longTasksUtils.d.ts.map +1 -0
- package/lib/typescript/utils/time-provider/DefaultTimeProvider.d.ts +1 -0
- package/lib/typescript/utils/time-provider/DefaultTimeProvider.d.ts.map +1 -0
- package/lib/typescript/utils/time-provider/TimeProvider.d.ts +1 -0
- package/lib/typescript/utils/time-provider/TimeProvider.d.ts.map +1 -0
- package/lib/typescript/version.d.ts +2 -1
- package/lib/typescript/version.d.ts.map +1 -0
- package/package.json +3 -3
- package/src/DdSdkReactNative.tsx +3 -10
- package/src/__tests__/DdSdkReactNative.test.tsx +5 -3
- package/src/__tests__/mock.test.ts +0 -1
- package/src/__tests__/rum/instrumentation/DdRumErrorTracking.test.tsx +32 -16
- package/src/__tests__/rum/instrumentation/DdRumUserInteractionTracking.test.tsx +17 -15
- package/src/index.tsx +4 -0
- package/src/logs/DdLogs.ts +25 -8
- package/src/logs/__tests__/DdLogs.test.ts +122 -0
- package/src/logs/types.ts +5 -1
- package/src/nativeModulesTypes.ts +3 -1
- package/src/polyfills.js +37 -0
- package/src/rum/DdAttributes.ts +20 -0
- package/src/rum/DdRum.ts +13 -8
- package/src/rum/__tests__/DdRum.test.ts +43 -7
- package/src/rum/eventMappers/errorEventMapper.ts +2 -0
- package/src/rum/instrumentation/interactionTracking/DdRumUserInteractionTracking.tsx +33 -10
- package/src/rum/instrumentation/interactionTracking/getJsxRuntime.ts +10 -3
- package/src/rum/instrumentation/resourceTracking/__tests__/__utils__/XMLHttpRequestMock.ts +1 -0
- package/src/rum/instrumentation/resourceTracking/distributedTracing/__tests__/__utils__/TracingIdentifierUtils.ts +1 -1
- package/src/rum/instrumentation/resourceTracking/distributedTracing/__tests__/distributedTracing.test.ts +1 -1
- package/src/rum/instrumentation/resourceTracking/requestProxy/XHRProxy/__tests__/XHRProxy.test.ts +1 -1
- package/src/sdk/DatadogProvider/__tests__/initialization.test.tsx +3 -3
- package/src/sdk/DatadogProvider/__tests__/initializationModes.test.tsx +3 -2
- package/src/sdk/GlobalState/GlobalState.tsx +26 -0
- package/src/specs/NativeDdLogs.ts +1 -0
- package/src/specs/NativeDdRum.ts +4 -1
- package/src/specs/NativeDdSdk.ts +1 -0
- package/src/specs/NativeDdTrace.ts +1 -0
- package/src/version.ts +1 -1
- package/android/src/main/kotlin/com/datadog/reactnative/VitalFrameCallback.kt +0 -41
|
@@ -184,6 +184,128 @@ describe('DdLogs', () => {
|
|
|
184
184
|
}
|
|
185
185
|
);
|
|
186
186
|
|
|
187
|
+
it.each([
|
|
188
|
+
[
|
|
189
|
+
'kind',
|
|
190
|
+
'message',
|
|
191
|
+
'stacktrace',
|
|
192
|
+
{ context: 'value' },
|
|
193
|
+
'custom-fingerprint-0'
|
|
194
|
+
],
|
|
195
|
+
// 1 argument is undefined
|
|
196
|
+
[
|
|
197
|
+
undefined,
|
|
198
|
+
'message',
|
|
199
|
+
'stacktrace',
|
|
200
|
+
{ context: 'value' },
|
|
201
|
+
'custom-fingerprint-1'
|
|
202
|
+
],
|
|
203
|
+
[
|
|
204
|
+
'kind',
|
|
205
|
+
undefined,
|
|
206
|
+
'stacktrace',
|
|
207
|
+
{ context: 'value' },
|
|
208
|
+
'custom-fingerprint-2'
|
|
209
|
+
],
|
|
210
|
+
[
|
|
211
|
+
'kind',
|
|
212
|
+
'message',
|
|
213
|
+
undefined,
|
|
214
|
+
{ context: 'value' },
|
|
215
|
+
'custom-fingerprint-3'
|
|
216
|
+
],
|
|
217
|
+
['kind', 'message', 'stacktrace', undefined, 'custom-fingerprint'],
|
|
218
|
+
// 2 arguments are undefined
|
|
219
|
+
[
|
|
220
|
+
undefined,
|
|
221
|
+
undefined,
|
|
222
|
+
'stacktrace',
|
|
223
|
+
{ context: 'value' },
|
|
224
|
+
'custom-fingerprint-4'
|
|
225
|
+
],
|
|
226
|
+
[
|
|
227
|
+
undefined,
|
|
228
|
+
'message',
|
|
229
|
+
undefined,
|
|
230
|
+
{ context: 'value' },
|
|
231
|
+
'custom-fingerprint-5'
|
|
232
|
+
],
|
|
233
|
+
[
|
|
234
|
+
undefined,
|
|
235
|
+
'message',
|
|
236
|
+
'stacktrace',
|
|
237
|
+
undefined,
|
|
238
|
+
'custom-fingerprint-6'
|
|
239
|
+
],
|
|
240
|
+
[
|
|
241
|
+
'kind',
|
|
242
|
+
undefined,
|
|
243
|
+
undefined,
|
|
244
|
+
{ context: 'value' },
|
|
245
|
+
'custom-fingerprint-7'
|
|
246
|
+
],
|
|
247
|
+
[
|
|
248
|
+
'kind',
|
|
249
|
+
undefined,
|
|
250
|
+
'stacktrace',
|
|
251
|
+
undefined,
|
|
252
|
+
'custom-fingerprint-8'
|
|
253
|
+
],
|
|
254
|
+
['kind', 'message', undefined, undefined, 'custom-fingerprint-9'],
|
|
255
|
+
// 3 arguments are undefined
|
|
256
|
+
[
|
|
257
|
+
undefined,
|
|
258
|
+
undefined,
|
|
259
|
+
'stacktrace',
|
|
260
|
+
undefined,
|
|
261
|
+
'custom-fingerprint-10'
|
|
262
|
+
],
|
|
263
|
+
[
|
|
264
|
+
undefined,
|
|
265
|
+
'message',
|
|
266
|
+
undefined,
|
|
267
|
+
undefined,
|
|
268
|
+
'custom-fingerprint-11'
|
|
269
|
+
],
|
|
270
|
+
['kind', undefined, undefined, undefined, 'custom-fingerprint-12'],
|
|
271
|
+
[
|
|
272
|
+
undefined,
|
|
273
|
+
undefined,
|
|
274
|
+
undefined,
|
|
275
|
+
{ context: 'value' },
|
|
276
|
+
'custom-fingerprint-13'
|
|
277
|
+
]
|
|
278
|
+
])(
|
|
279
|
+
'sends error info with custom fingerprint when provided for %s %s %s %s %s',
|
|
280
|
+
async (
|
|
281
|
+
errorKind,
|
|
282
|
+
errorMessage,
|
|
283
|
+
stacktrace,
|
|
284
|
+
context,
|
|
285
|
+
fingerprint
|
|
286
|
+
) => {
|
|
287
|
+
await DdLogs.info(
|
|
288
|
+
'message',
|
|
289
|
+
errorKind,
|
|
290
|
+
errorMessage,
|
|
291
|
+
stacktrace,
|
|
292
|
+
context,
|
|
293
|
+
fingerprint
|
|
294
|
+
);
|
|
295
|
+
expect(NativeModules.DdLogs.infoWithError).toHaveBeenCalledWith(
|
|
296
|
+
'message',
|
|
297
|
+
errorKind,
|
|
298
|
+
errorMessage,
|
|
299
|
+
stacktrace,
|
|
300
|
+
{
|
|
301
|
+
...(context || {}),
|
|
302
|
+
'_dd.error.source_type': 'react-native',
|
|
303
|
+
'_dd.error.fingerprint': fingerprint
|
|
304
|
+
}
|
|
305
|
+
);
|
|
306
|
+
}
|
|
307
|
+
);
|
|
308
|
+
|
|
187
309
|
it('does not send error info when no error and no context is passed', async () => {
|
|
188
310
|
await DdLogs.info(
|
|
189
311
|
'message',
|
package/src/logs/types.ts
CHANGED
|
@@ -54,6 +54,7 @@ export type RawLogWithError = {
|
|
|
54
54
|
stacktrace: string;
|
|
55
55
|
context: object;
|
|
56
56
|
status: LogStatus;
|
|
57
|
+
fingerprint?: string;
|
|
57
58
|
};
|
|
58
59
|
|
|
59
60
|
/**
|
|
@@ -69,6 +70,7 @@ export type NativeLogWithError = {
|
|
|
69
70
|
errorMessage: string;
|
|
70
71
|
stacktrace: string;
|
|
71
72
|
context: object;
|
|
73
|
+
fingerprint?: string;
|
|
72
74
|
};
|
|
73
75
|
|
|
74
76
|
export type LogStatus = 'debug' | 'info' | 'warn' | 'error';
|
|
@@ -79,6 +81,7 @@ export type LogEvent = {
|
|
|
79
81
|
errorKind?: string;
|
|
80
82
|
errorMessage?: string;
|
|
81
83
|
stacktrace?: string;
|
|
84
|
+
fingerprint?: string;
|
|
82
85
|
// readonly date: number; // TODO: RUMM-2446 & RUMM-2447
|
|
83
86
|
readonly status: LogStatus;
|
|
84
87
|
readonly userInfo: UserInfo;
|
|
@@ -94,5 +97,6 @@ export type LogWithErrorArguments = [
|
|
|
94
97
|
errorKind?: string,
|
|
95
98
|
errorMessage?: string,
|
|
96
99
|
stacktrace?: string,
|
|
97
|
-
context?: object
|
|
100
|
+
context?: object,
|
|
101
|
+
fingerprint?: string
|
|
98
102
|
];
|
|
@@ -139,12 +139,14 @@ export interface DdNativeRumType extends NativeDdRum {
|
|
|
139
139
|
* @param stacktrace: The error stacktrace.
|
|
140
140
|
* @param context: The additional context to send.
|
|
141
141
|
* @param timestampMs: The timestamp when the error occurred (in milliseconds). If not provided, current timestamp will be used.
|
|
142
|
+
* @param fingerprint: Optional custom error fingerprint.
|
|
142
143
|
*/
|
|
143
144
|
addError(
|
|
144
145
|
message: string,
|
|
145
146
|
source: ErrorSource,
|
|
146
147
|
stacktrace: string,
|
|
147
148
|
context: object,
|
|
148
|
-
timestampMs: number
|
|
149
|
+
timestampMs: number,
|
|
150
|
+
fingerprint: string | undefined
|
|
149
151
|
): Promise<void>;
|
|
150
152
|
}
|
package/src/polyfills.js
ADDED
|
@@ -0,0 +1,37 @@
|
|
|
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
|
+
import { version as reactNativeVersion } from 'react-native/package.json';
|
|
8
|
+
|
|
9
|
+
function applyBigIntPolyfill() {
|
|
10
|
+
const rnVersion = reactNativeVersion.split('.').map(Number);
|
|
11
|
+
const isRn63 = rnVersion[0] === 0 && rnVersion[1] === 63;
|
|
12
|
+
|
|
13
|
+
if (isRn63 && typeof BigInt === 'undefined') {
|
|
14
|
+
try {
|
|
15
|
+
// eslint-disable-next-line global-require, import/no-extraneous-dependencies
|
|
16
|
+
global.BigInt = require('big-integer');
|
|
17
|
+
console.warn(
|
|
18
|
+
'React Native 0.63 does not support BigInt, which is required starting from v2.4.0 of Datadog React Native SDK. ' +
|
|
19
|
+
'The missing type has been polyfilled using `big-integer` to grant back-compatibility. ' +
|
|
20
|
+
'We strongly suggest updating to a greater version of React Native (>= 0.64).'
|
|
21
|
+
);
|
|
22
|
+
} catch (e) {
|
|
23
|
+
if (e instanceof Error && e.code === 'MODULE_NOT_FOUND') {
|
|
24
|
+
throw new Error(
|
|
25
|
+
'React Native 0.63 does not support BigInt, which is required starting from v2.4.0 of Datadog React Native SDK. ' +
|
|
26
|
+
'We strongly suggest updating to a greater version of React Native (>= 0.64).\n\n' +
|
|
27
|
+
'You can install `big-integer` to enable our polyfill that grants back-compatibility with RN 63:\n\n' +
|
|
28
|
+
'`yarn add big-integer`\n\nOR\n\n`npm install --save big-integer`'
|
|
29
|
+
);
|
|
30
|
+
} else {
|
|
31
|
+
throw e;
|
|
32
|
+
}
|
|
33
|
+
}
|
|
34
|
+
}
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
applyBigIntPolyfill();
|
|
@@ -0,0 +1,20 @@
|
|
|
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
|
+
export const DdAttributes = {
|
|
8
|
+
/**
|
|
9
|
+
* Custom "source type" of the error. Used in RUM errors. It names the
|
|
10
|
+
* language or platform of the RUM error stack trace, so the SCI backend
|
|
11
|
+
* knows how to symbolize it. Expects {@link String} value.
|
|
12
|
+
*/
|
|
13
|
+
errorSourceType: '_dd.error.source_type',
|
|
14
|
+
|
|
15
|
+
/**
|
|
16
|
+
* Custom fingerprint to an error.
|
|
17
|
+
* Expects {@link String} value.
|
|
18
|
+
*/
|
|
19
|
+
errorFingerprint: '_dd.error.fingerprint'
|
|
20
|
+
};
|
package/src/rum/DdRum.ts
CHANGED
|
@@ -6,16 +6,17 @@
|
|
|
6
6
|
|
|
7
7
|
import type { GestureResponderEvent } from 'react-native';
|
|
8
8
|
|
|
9
|
-
import { DdSdkReactNative } from '../DdSdkReactNative';
|
|
10
9
|
import { InternalLog } from '../InternalLog';
|
|
11
10
|
import { SdkVerbosity } from '../SdkVerbosity';
|
|
12
11
|
import type { DdNativeRumType } from '../nativeModulesTypes';
|
|
13
12
|
import { bufferVoidNativeCall } from '../sdk/DatadogProvider/Buffer/bufferNativeCall';
|
|
14
13
|
import { DdSdk } from '../sdk/DdSdk';
|
|
14
|
+
import { GlobalState } from '../sdk/GlobalState/GlobalState';
|
|
15
15
|
import { validateContext } from '../utils/argsUtils';
|
|
16
16
|
import { DefaultTimeProvider } from '../utils/time-provider/DefaultTimeProvider';
|
|
17
17
|
import type { TimeProvider } from '../utils/time-provider/TimeProvider';
|
|
18
18
|
|
|
19
|
+
import { DdAttributes } from './DdAttributes';
|
|
19
20
|
import type { ActionEventMapper } from './eventMappers/actionEventMapper';
|
|
20
21
|
import { generateActionEventMapper } from './eventMappers/actionEventMapper';
|
|
21
22
|
import type { ErrorEventMapper } from './eventMappers/errorEventMapper';
|
|
@@ -23,10 +24,10 @@ import { generateErrorEventMapper } from './eventMappers/errorEventMapper';
|
|
|
23
24
|
import type { ResourceEventMapper } from './eventMappers/resourceEventMapper';
|
|
24
25
|
import { generateResourceEventMapper } from './eventMappers/resourceEventMapper';
|
|
25
26
|
import type {
|
|
27
|
+
ErrorSource,
|
|
26
28
|
DdRumType,
|
|
27
29
|
RumActionType,
|
|
28
|
-
ResourceKind
|
|
29
|
-
ErrorSource
|
|
30
|
+
ResourceKind
|
|
30
31
|
} from './types';
|
|
31
32
|
|
|
32
33
|
const generateEmptyPromise = () => new Promise<void>(resolve => resolve());
|
|
@@ -229,28 +230,32 @@ class DdRumWrapper implements DdRumType {
|
|
|
229
230
|
source: ErrorSource,
|
|
230
231
|
stacktrace: string,
|
|
231
232
|
context: object = {},
|
|
232
|
-
timestampMs: number = this.timeProvider.now()
|
|
233
|
+
timestampMs: number = this.timeProvider.now(),
|
|
234
|
+
fingerprint?: string
|
|
233
235
|
): Promise<void> => {
|
|
234
236
|
const mappedEvent = this.errorEventMapper.applyEventMapper({
|
|
235
237
|
message,
|
|
236
238
|
source,
|
|
237
239
|
stacktrace,
|
|
238
240
|
context: validateContext(context),
|
|
239
|
-
timestampMs
|
|
241
|
+
timestampMs,
|
|
242
|
+
fingerprint: fingerprint ?? ''
|
|
240
243
|
});
|
|
244
|
+
|
|
241
245
|
if (!mappedEvent) {
|
|
242
246
|
return generateEmptyPromise();
|
|
243
247
|
}
|
|
244
248
|
InternalLog.log(`Adding RUM Error “${message}”`, SdkVerbosity.DEBUG);
|
|
245
249
|
const updatedContext: any = mappedEvent.context;
|
|
246
|
-
updatedContext[
|
|
250
|
+
updatedContext[DdAttributes.errorSourceType] = 'react-native';
|
|
247
251
|
return bufferVoidNativeCall(() =>
|
|
248
252
|
this.nativeRum.addError(
|
|
249
253
|
mappedEvent.message,
|
|
250
254
|
mappedEvent.source,
|
|
251
255
|
mappedEvent.stacktrace,
|
|
252
256
|
updatedContext,
|
|
253
|
-
mappedEvent.timestampMs
|
|
257
|
+
mappedEvent.timestampMs,
|
|
258
|
+
mappedEvent.fingerprint
|
|
254
259
|
)
|
|
255
260
|
);
|
|
256
261
|
};
|
|
@@ -284,7 +289,7 @@ class DdRumWrapper implements DdRumType {
|
|
|
284
289
|
};
|
|
285
290
|
|
|
286
291
|
async getCurrentSessionId(): Promise<string | undefined> {
|
|
287
|
-
if (!
|
|
292
|
+
if (!GlobalState.instance.isInitialized) {
|
|
288
293
|
return undefined;
|
|
289
294
|
}
|
|
290
295
|
return this.nativeRum.getCurrentSessionId();
|
|
@@ -7,11 +7,11 @@
|
|
|
7
7
|
|
|
8
8
|
import { NativeModules } from 'react-native';
|
|
9
9
|
|
|
10
|
-
import { DdSdkReactNative } from '../../DdSdkReactNative';
|
|
11
10
|
import { InternalLog } from '../../InternalLog';
|
|
12
11
|
import { SdkVerbosity } from '../../SdkVerbosity';
|
|
13
12
|
import { BufferSingleton } from '../../sdk/DatadogProvider/Buffer/BufferSingleton';
|
|
14
13
|
import { DdSdk } from '../../sdk/DdSdk';
|
|
14
|
+
import { GlobalState } from '../../sdk/GlobalState/GlobalState';
|
|
15
15
|
import { DdRum } from '../DdRum';
|
|
16
16
|
import type { ActionEventMapper } from '../eventMappers/actionEventMapper';
|
|
17
17
|
import type { ErrorEventMapper } from '../eventMappers/errorEventMapper';
|
|
@@ -523,7 +523,8 @@ describe('DdRum', () => {
|
|
|
523
523
|
...context,
|
|
524
524
|
'_dd.error.source_type': 'react-native'
|
|
525
525
|
},
|
|
526
|
-
expect.anything()
|
|
526
|
+
expect.anything(),
|
|
527
|
+
''
|
|
527
528
|
);
|
|
528
529
|
});
|
|
529
530
|
|
|
@@ -549,7 +550,8 @@ describe('DdRum', () => {
|
|
|
549
550
|
{
|
|
550
551
|
'_dd.error.source_type': 'react-native'
|
|
551
552
|
},
|
|
552
|
-
expect.anything()
|
|
553
|
+
expect.anything(),
|
|
554
|
+
''
|
|
553
555
|
);
|
|
554
556
|
});
|
|
555
557
|
|
|
@@ -576,7 +578,8 @@ describe('DdRum', () => {
|
|
|
576
578
|
context,
|
|
577
579
|
'_dd.error.source_type': 'react-native'
|
|
578
580
|
},
|
|
579
|
-
expect.anything()
|
|
581
|
+
expect.anything(),
|
|
582
|
+
''
|
|
580
583
|
);
|
|
581
584
|
});
|
|
582
585
|
});
|
|
@@ -678,6 +681,38 @@ describe('DdRum', () => {
|
|
|
678
681
|
);
|
|
679
682
|
});
|
|
680
683
|
|
|
684
|
+
it('M add error fingerprint W addError() { with custom fingerprint }', async () => {
|
|
685
|
+
// Given
|
|
686
|
+
const message = 'Oops I did it again!';
|
|
687
|
+
const source = ErrorSource.SOURCE;
|
|
688
|
+
const stacktrace = 'doSomething() at ./path/to/file.js:67:3';
|
|
689
|
+
|
|
690
|
+
// When
|
|
691
|
+
DdRum.addError(
|
|
692
|
+
message,
|
|
693
|
+
source,
|
|
694
|
+
stacktrace,
|
|
695
|
+
undefined,
|
|
696
|
+
undefined,
|
|
697
|
+
'custom-fingerprint'
|
|
698
|
+
);
|
|
699
|
+
|
|
700
|
+
// Then
|
|
701
|
+
expect(NativeModules.DdRum.addError.mock.calls.length).toBe(1);
|
|
702
|
+
expect(NativeModules.DdRum.addError.mock.calls[0][0]).toBe(message);
|
|
703
|
+
expect(NativeModules.DdRum.addError.mock.calls[0][1]).toBe(source);
|
|
704
|
+
expect(NativeModules.DdRum.addError.mock.calls[0][2]).toBe(
|
|
705
|
+
stacktrace
|
|
706
|
+
);
|
|
707
|
+
const context = NativeModules.DdRum.addError.mock.calls[0][3];
|
|
708
|
+
expect(context['_dd.error.source_type']).toStrictEqual(
|
|
709
|
+
'react-native'
|
|
710
|
+
);
|
|
711
|
+
expect(NativeModules.DdRum.addError.mock.calls[0][5]).toBe(
|
|
712
|
+
'custom-fingerprint'
|
|
713
|
+
);
|
|
714
|
+
});
|
|
715
|
+
|
|
681
716
|
it('M add error source type W addError() {with custom attributes}', async () => {
|
|
682
717
|
// Given
|
|
683
718
|
const message = 'Oops I did it again!';
|
|
@@ -730,7 +765,8 @@ describe('DdRum', () => {
|
|
|
730
765
|
'_dd.error.source_type': 'react-native',
|
|
731
766
|
isFatal: true
|
|
732
767
|
},
|
|
733
|
-
456
|
|
768
|
+
456,
|
|
769
|
+
''
|
|
734
770
|
);
|
|
735
771
|
});
|
|
736
772
|
|
|
@@ -929,7 +965,7 @@ describe('DdRum', () => {
|
|
|
929
965
|
|
|
930
966
|
describe('DdRum.getCurrentSessionId', () => {
|
|
931
967
|
it('calls the native API if SDK is initialized', async () => {
|
|
932
|
-
|
|
968
|
+
GlobalState.instance.isInitialized = true;
|
|
933
969
|
const sessionId = await DdRum.getCurrentSessionId();
|
|
934
970
|
expect(NativeModules.DdRum.getCurrentSessionId).toHaveBeenCalled();
|
|
935
971
|
expect(sessionId).toBe('test-session-id');
|
|
@@ -938,7 +974,7 @@ describe('DdRum', () => {
|
|
|
938
974
|
|
|
939
975
|
describe('DdRum.getCurrentSessionId', () => {
|
|
940
976
|
it('returns undefined if SDK is not initialized', async () => {
|
|
941
|
-
|
|
977
|
+
GlobalState.instance.isInitialized = false;
|
|
942
978
|
const sessionId = await DdRum.getCurrentSessionId();
|
|
943
979
|
expect(
|
|
944
980
|
NativeModules.DdRum.getCurrentSessionId
|
|
@@ -14,6 +14,7 @@ type RawError = {
|
|
|
14
14
|
stacktrace: string;
|
|
15
15
|
context: object;
|
|
16
16
|
timestampMs: number;
|
|
17
|
+
fingerprint: string;
|
|
17
18
|
};
|
|
18
19
|
|
|
19
20
|
type ErrorEvent = RawError & AdditionalEventDataForMapper;
|
|
@@ -24,6 +25,7 @@ type NativeError = {
|
|
|
24
25
|
stacktrace: string;
|
|
25
26
|
context: object;
|
|
26
27
|
timestampMs: number;
|
|
28
|
+
fingerprint: string;
|
|
27
29
|
};
|
|
28
30
|
|
|
29
31
|
export type ErrorEventMapper = (event: ErrorEvent) => ErrorEvent | null;
|
|
@@ -16,7 +16,7 @@ import type { DdEventsInterceptorOptions } from './DdEventsInterceptor';
|
|
|
16
16
|
import type EventsInterceptor from './EventsInterceptor';
|
|
17
17
|
import NoOpEventsInterceptor from './NoOpEventsInterceptor';
|
|
18
18
|
import { areObjectShallowEqual } from './ShallowObjectEqualityChecker';
|
|
19
|
-
import {
|
|
19
|
+
import { getJsxRuntimes } from './getJsxRuntime';
|
|
20
20
|
|
|
21
21
|
/**
|
|
22
22
|
* Provides RUM auto-instrumentation feature to track user interaction as RUM events.
|
|
@@ -28,6 +28,7 @@ export class DdRumUserInteractionTracking {
|
|
|
28
28
|
private static originalCreateElement = React.createElement;
|
|
29
29
|
private static originalMemo = React.memo;
|
|
30
30
|
private static originalJsx = null;
|
|
31
|
+
private static originalDevJsx = null;
|
|
31
32
|
|
|
32
33
|
private static patchCreateElementFunction = (
|
|
33
34
|
originalFunction: typeof React.createElement,
|
|
@@ -68,6 +69,7 @@ export class DdRumUserInteractionTracking {
|
|
|
68
69
|
);
|
|
69
70
|
return;
|
|
70
71
|
}
|
|
72
|
+
|
|
71
73
|
DdRumUserInteractionTracking.eventsInterceptor = new DdEventsInterceptor(
|
|
72
74
|
options
|
|
73
75
|
);
|
|
@@ -80,14 +82,31 @@ export class DdRumUserInteractionTracking {
|
|
|
80
82
|
};
|
|
81
83
|
|
|
82
84
|
try {
|
|
83
|
-
const jsxRuntime =
|
|
84
|
-
const originalJsx = jsxRuntime
|
|
85
|
+
const [jsxRuntime, jsxDevRuntime] = getJsxRuntimes();
|
|
86
|
+
const originalJsx = jsxRuntime?.jsx;
|
|
87
|
+
const originalDevJsx = jsxDevRuntime?.jsxDEV;
|
|
88
|
+
|
|
85
89
|
this.originalJsx = originalJsx;
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
)
|
|
89
|
-
|
|
90
|
-
|
|
90
|
+
this.originalDevJsx = originalDevJsx;
|
|
91
|
+
|
|
92
|
+
if (originalJsx) {
|
|
93
|
+
jsxRuntime.jsx = (
|
|
94
|
+
...args: Parameters<typeof React.createElement>
|
|
95
|
+
): ReturnType<typeof React.createElement> => {
|
|
96
|
+
return this.patchCreateElementFunction(originalJsx, args);
|
|
97
|
+
};
|
|
98
|
+
}
|
|
99
|
+
|
|
100
|
+
if (originalDevJsx) {
|
|
101
|
+
jsxRuntime.jsxDEV = (
|
|
102
|
+
...args: Parameters<typeof React.createElement>
|
|
103
|
+
): ReturnType<typeof React.createElement> => {
|
|
104
|
+
return this.patchCreateElementFunction(
|
|
105
|
+
originalDevJsx,
|
|
106
|
+
args
|
|
107
|
+
);
|
|
108
|
+
};
|
|
109
|
+
}
|
|
91
110
|
} catch (e) {
|
|
92
111
|
DdSdk.telemetryDebug(getErrorMessage(e));
|
|
93
112
|
}
|
|
@@ -135,10 +154,14 @@ export class DdRumUserInteractionTracking {
|
|
|
135
154
|
React.createElement = this.originalCreateElement;
|
|
136
155
|
React.memo = this.originalMemo;
|
|
137
156
|
DdRumUserInteractionTracking.isTracking = false;
|
|
138
|
-
if (this.originalJsx) {
|
|
139
|
-
const jsxRuntime =
|
|
157
|
+
if (this.originalJsx || this.originalDevJsx) {
|
|
158
|
+
const [jsxRuntime, jsxDevRuntime] = getJsxRuntimes();
|
|
159
|
+
|
|
140
160
|
jsxRuntime.jsx = this.originalJsx;
|
|
161
|
+
jsxDevRuntime.jsxDEV = this.originalDevJsx;
|
|
162
|
+
|
|
141
163
|
this.originalJsx = null;
|
|
164
|
+
this.originalDevJsx = null;
|
|
142
165
|
}
|
|
143
166
|
}
|
|
144
167
|
}
|
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
* Copyright 2016-Present Datadog, Inc.
|
|
5
5
|
*/
|
|
6
6
|
|
|
7
|
-
export const
|
|
7
|
+
export const getJsxRuntimes = () => {
|
|
8
8
|
// eslint-disable-next-line global-require, @typescript-eslint/no-var-requires
|
|
9
9
|
const [major, minor] = require('react/package.json').version.split('.');
|
|
10
10
|
// We need to check on the version of React before requiring 'react/jsx-runtime') as
|
|
@@ -21,12 +21,19 @@ export const getJsxRuntime = () => {
|
|
|
21
21
|
// disable all further imports.
|
|
22
22
|
// /!\/!\/!\/!\/!\/!\
|
|
23
23
|
//
|
|
24
|
+
let jsxDevRuntime;
|
|
25
|
+
if (__DEV__) {
|
|
26
|
+
// eslint-disable-next-line global-require, @typescript-eslint/no-var-requires
|
|
27
|
+
jsxDevRuntime = require('react/jsx-dev-runtime');
|
|
28
|
+
}
|
|
29
|
+
|
|
24
30
|
// eslint-disable-next-line global-require, @typescript-eslint/no-var-requires
|
|
25
31
|
const jsxRuntime = require('react/jsx-runtime');
|
|
26
|
-
if (!jsxRuntime.jsx) {
|
|
32
|
+
if (!jsxRuntime.jsx && !__DEV__) {
|
|
27
33
|
throw new Error('React jsx runtime does not export new jsx transform');
|
|
28
34
|
}
|
|
29
|
-
|
|
35
|
+
|
|
36
|
+
return [jsxRuntime, jsxDevRuntime];
|
|
30
37
|
};
|
|
31
38
|
|
|
32
39
|
/**
|
|
@@ -18,6 +18,7 @@ export class XMLHttpRequestMock implements XMLHttpRequest {
|
|
|
18
18
|
public requestHeaders: Map<string, string> = new Map();
|
|
19
19
|
public responseHeaders: Map<string, string> = new Map();
|
|
20
20
|
|
|
21
|
+
// eslint-disable-next-line no-empty-function
|
|
21
22
|
constructor() {}
|
|
22
23
|
responseText: string;
|
|
23
24
|
responseURL: string;
|
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
* Copyright 2016-Present Datadog, Inc.
|
|
5
5
|
*/
|
|
6
6
|
|
|
7
|
-
export
|
|
7
|
+
export class TracingIdentifierUtils {
|
|
8
8
|
/**
|
|
9
9
|
* Extracts the Unix timestamp from the 128-bit hex string representation.
|
|
10
10
|
* @param idHex - The 128-bit ID as a hexadecimal string.
|
|
@@ -6,7 +6,7 @@
|
|
|
6
6
|
|
|
7
7
|
import { TracingIdentifier, TracingIdFormat } from '../TracingIdentifier';
|
|
8
8
|
|
|
9
|
-
import TracingIdentifierUtils from './__utils__/tracingIdentifierUtils';
|
|
9
|
+
import { TracingIdentifierUtils } from './__utils__/tracingIdentifierUtils';
|
|
10
10
|
|
|
11
11
|
describe('TracingIdentifier', () => {
|
|
12
12
|
it('M return an unique identifier W toString', async () => {
|
package/src/rum/instrumentation/resourceTracking/requestProxy/XHRProxy/__tests__/XHRProxy.test.ts
CHANGED
|
@@ -12,7 +12,7 @@ import { BufferSingleton } from '../../../../../../sdk/DatadogProvider/Buffer/Bu
|
|
|
12
12
|
import { DdRum } from '../../../../../DdRum';
|
|
13
13
|
import { PropagatorType } from '../../../../../types';
|
|
14
14
|
import { XMLHttpRequestMock } from '../../../__tests__/__utils__/XMLHttpRequestMock';
|
|
15
|
-
import TracingIdentifierUtils from '../../../distributedTracing/__tests__/__utils__/tracingIdentifierUtils';
|
|
15
|
+
import { TracingIdentifierUtils } from '../../../distributedTracing/__tests__/__utils__/tracingIdentifierUtils';
|
|
16
16
|
import {
|
|
17
17
|
PARENT_ID_HEADER_KEY,
|
|
18
18
|
TRACE_ID_HEADER_KEY,
|
|
@@ -7,11 +7,11 @@
|
|
|
7
7
|
import { NativeModules } from 'react-native';
|
|
8
8
|
|
|
9
9
|
import { InitializationMode } from '../../../DdSdkReactNativeConfiguration';
|
|
10
|
-
import { DdSdkReactNative } from '../../../DdSdkReactNative';
|
|
11
10
|
import { DdRum } from '../../../rum/DdRum';
|
|
12
11
|
import { RumActionType } from '../../../rum/types';
|
|
13
12
|
import { DdTrace } from '../../../trace/DdTrace';
|
|
14
13
|
import { DefaultTimeProvider } from '../../../utils/time-provider/DefaultTimeProvider';
|
|
14
|
+
import { GlobalState } from '../../GlobalState/GlobalState';
|
|
15
15
|
import { BufferSingleton } from '../Buffer/BufferSingleton';
|
|
16
16
|
import {
|
|
17
17
|
DatadogProvider,
|
|
@@ -41,7 +41,7 @@ const flushPromises = () =>
|
|
|
41
41
|
describe('DatadogProvider', () => {
|
|
42
42
|
afterEach(() => {
|
|
43
43
|
jest.clearAllMocks();
|
|
44
|
-
|
|
44
|
+
GlobalState.instance.isInitialized = false;
|
|
45
45
|
__internalResetIsInitializedForTesting();
|
|
46
46
|
BufferSingleton.reset();
|
|
47
47
|
(nowMock as any).mockReturnValue('timestamp_not_specified');
|
|
@@ -73,7 +73,7 @@ describe('DatadogProvider', () => {
|
|
|
73
73
|
"clientToken": "fakeToken",
|
|
74
74
|
"configurationForTelemetry": {
|
|
75
75
|
"initializationType": "SYNC",
|
|
76
|
-
"reactNativeVersion": "0.73.
|
|
76
|
+
"reactNativeVersion": "0.73.9",
|
|
77
77
|
"reactVersion": "18.2.0",
|
|
78
78
|
"trackErrors": true,
|
|
79
79
|
"trackInteractions": true,
|
|
@@ -12,6 +12,7 @@ import { DdSdkReactNative } from '../../../DdSdkReactNative';
|
|
|
12
12
|
import { DdRumUserInteractionTracking } from '../../../rum/instrumentation/interactionTracking/DdRumUserInteractionTracking';
|
|
13
13
|
import { XMLHttpRequestMock } from '../../../rum/instrumentation/resourceTracking/__tests__/__utils__/XMLHttpRequestMock';
|
|
14
14
|
import { DefaultTimeProvider } from '../../../utils/time-provider/DefaultTimeProvider';
|
|
15
|
+
import { GlobalState } from '../../GlobalState/GlobalState';
|
|
15
16
|
import { BufferSingleton } from '../Buffer/BufferSingleton';
|
|
16
17
|
import {
|
|
17
18
|
DatadogProvider,
|
|
@@ -41,13 +42,13 @@ const flushPromises = () =>
|
|
|
41
42
|
describe('DatadogProvider', () => {
|
|
42
43
|
beforeEach(() => {
|
|
43
44
|
jest.clearAllMocks();
|
|
44
|
-
|
|
45
|
+
GlobalState.instance.isInitialized = false;
|
|
45
46
|
DdSdkReactNative['wasAutoInstrumented'] = false;
|
|
46
47
|
__internalResetIsInitializedForTesting();
|
|
47
48
|
BufferSingleton.reset();
|
|
48
49
|
DdRumUserInteractionTracking.stopTracking();
|
|
49
50
|
(nowMock as any).mockReturnValue('timestamp_not_specified');
|
|
50
|
-
global.XMLHttpRequest = XMLHttpRequestMock;
|
|
51
|
+
global.XMLHttpRequest = XMLHttpRequestMock as any;
|
|
51
52
|
});
|
|
52
53
|
|
|
53
54
|
describe('initializationMode SYNC', () => {
|
|
@@ -0,0 +1,26 @@
|
|
|
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
|
+
* A singleton container for attributes that are shared internally across all
|
|
9
|
+
* the SDK classes.
|
|
10
|
+
*/
|
|
11
|
+
export class GlobalState {
|
|
12
|
+
/**
|
|
13
|
+
* `true` if the SDK is initialized, `false` otherwise.
|
|
14
|
+
*/
|
|
15
|
+
public isInitialized = false;
|
|
16
|
+
|
|
17
|
+
// Singleton implementation
|
|
18
|
+
private static _instance: GlobalState | undefined = undefined;
|
|
19
|
+
public static get instance(): GlobalState {
|
|
20
|
+
if (this._instance === undefined) {
|
|
21
|
+
this._instance = new GlobalState();
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
return this._instance;
|
|
25
|
+
}
|
|
26
|
+
}
|