@datadog/mobile-react-native 2.4.1 → 2.4.3
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 +6 -6
- 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 +12 -4
- 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 +107 -145
- 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 +50 -66
- 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 +1 -4
- package/lib/commonjs/polyfills.js.map +1 -1
- package/lib/commonjs/rum/DdAttributes.js +26 -0
- package/lib/commonjs/rum/DdAttributes.js.map +1 -0
- package/lib/commonjs/rum/DdRum.js +143 -208
- 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 +6 -11
- package/lib/commonjs/sdk/GlobalState/GlobalState.js.map +1 -1
- 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 +4 -6
- package/lib/commonjs/specs/NativeDdLogs.js.map +1 -1
- package/lib/commonjs/specs/NativeDdRum.js +4 -6
- package/lib/commonjs/specs/NativeDdRum.js.map +1 -1
- package/lib/commonjs/specs/NativeDdSdk.js +4 -6
- package/lib/commonjs/specs/NativeDdSdk.js.map +1 -1
- package/lib/commonjs/specs/NativeDdTrace.js +4 -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 +104 -116
- 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 +2 -2
- 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 +1 -3
- package/lib/module/polyfills.js.map +1 -1
- package/lib/module/rum/DdAttributes.js +20 -0
- package/lib/module/rum/DdAttributes.js.map +1 -0
- package/lib/module/rum/DdRum.js +138 -185
- 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 +6 -9
- package/lib/module/sdk/GlobalState/GlobalState.js.map +1 -1
- 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 +2 -0
- package/lib/module/specs/NativeDdLogs.js.map +1 -1
- package/lib/module/specs/NativeDdRum.js +2 -0
- package/lib/module/specs/NativeDdRum.js.map +1 -1
- package/lib/module/specs/NativeDdSdk.js +2 -0
- package/lib/module/specs/NativeDdSdk.js.map +1 -1
- package/lib/module/specs/NativeDdTrace.js +2 -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 -0
- 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 +1 -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 +1 -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/__tests__/DdSdkReactNative.test.tsx +2 -1
- package/src/__tests__/rum/instrumentation/DdRumErrorTracking.test.tsx +32 -16
- package/src/__tests__/rum/instrumentation/DdRumUserInteractionTracking.test.tsx +17 -15
- 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/rum/DdAttributes.ts +20 -0
- package/src/rum/DdRum.ts +11 -6
- package/src/rum/__tests__/DdRum.test.ts +40 -4
- 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/sdk/DatadogProvider/__tests__/initialization.test.tsx +1 -1
- package/src/specs/NativeDdRum.ts +3 -1
- package/src/version.ts +1 -1
- package/android/src/main/kotlin/com/datadog/reactnative/VitalFrameCallback.kt +0 -41
|
@@ -3,26 +3,25 @@
|
|
|
3
3
|
* This product includes software developed at Datadog (https://www.datadoghq.com/).
|
|
4
4
|
* Copyright 2016-Present Datadog, Inc.
|
|
5
5
|
*/
|
|
6
|
+
|
|
6
7
|
import { DatadogProviderConfiguration, DEFAULTS } from '../../DdSdkReactNativeConfiguration';
|
|
7
8
|
import { SdkVerbosity } from '../../SdkVerbosity';
|
|
8
9
|
import { TrackingConsent } from '../../TrackingConsent';
|
|
9
10
|
import { PropagatorType } from '../../rum/types';
|
|
10
11
|
export class FileBasedConfiguration extends DatadogProviderConfiguration {
|
|
11
12
|
constructor(params) {
|
|
12
|
-
const configuration = getJSONConfiguration(params
|
|
13
|
+
const configuration = getJSONConfiguration(params?.configuration);
|
|
13
14
|
super(configuration.clientToken, configuration.env, configuration.applicationId, configuration.trackInteractions, configuration.trackResources, configuration.trackErrors, configuration.trackingConsent);
|
|
14
15
|
this.longTaskThresholdMs = configuration.longTaskThresholdMs || DEFAULTS.longTaskThresholdMs;
|
|
15
16
|
this.verbosity = configuration.verbosity;
|
|
16
17
|
this.actionNameAttribute = configuration.actionNameAttribute;
|
|
17
18
|
this.resourceTracingSamplingRate = configuration.resourceTracingSamplingRate || DEFAULTS.resourceTracingSamplingRate;
|
|
18
19
|
this.firstPartyHosts = configuration.firstPartyHosts || DEFAULTS.getFirstPartyHosts();
|
|
19
|
-
this.errorEventMapper =
|
|
20
|
-
this.resourceEventMapper =
|
|
21
|
-
this.actionEventMapper =
|
|
20
|
+
this.errorEventMapper = params?.errorEventMapper || DEFAULTS.errorEventMapper;
|
|
21
|
+
this.resourceEventMapper = params?.resourceEventMapper || DEFAULTS.resourceEventMapper;
|
|
22
|
+
this.actionEventMapper = params?.actionEventMapper || DEFAULTS.actionEventMapper;
|
|
22
23
|
}
|
|
23
|
-
|
|
24
24
|
}
|
|
25
|
-
|
|
26
25
|
const resolveJSONConfiguration = userSpecifiedConfiguration => {
|
|
27
26
|
if (userSpecifiedConfiguration === undefined || userSpecifiedConfiguration === null) {
|
|
28
27
|
try {
|
|
@@ -30,7 +29,6 @@ const resolveJSONConfiguration = userSpecifiedConfiguration => {
|
|
|
30
29
|
// /!\ We have to write the require this way as dynamic requires are not supported by Hermes.
|
|
31
30
|
// eslint-disable-next-line global-require, @typescript-eslint/no-var-requires
|
|
32
31
|
const jsonContent = require('../../../../../../datadog-configuration.json');
|
|
33
|
-
|
|
34
32
|
if (typeof jsonContent !== 'object' || !jsonContent['configuration']) {
|
|
35
33
|
console.error(`Failed to parse the Datadog configuration file located at the root of the project.
|
|
36
34
|
Your configuration must validate the node_modules/@datadog/mobile-react-native/datadog-configuration.schema.json JSON schema.
|
|
@@ -40,7 +38,6 @@ You can use VSCode to check your configuration by adding the following line to y
|
|
|
40
38
|
}`);
|
|
41
39
|
return {};
|
|
42
40
|
}
|
|
43
|
-
|
|
44
41
|
return jsonContent.configuration;
|
|
45
42
|
} catch (error) {
|
|
46
43
|
console.error(`Failed to read Datadog configuration file at the root of the project.
|
|
@@ -51,7 +48,6 @@ new FileBasedConfiguration({configuration: require('./file/to/configuration-file
|
|
|
51
48
|
return {};
|
|
52
49
|
}
|
|
53
50
|
}
|
|
54
|
-
|
|
55
51
|
if (typeof userSpecifiedConfiguration !== 'object' || !userSpecifiedConfiguration['configuration']) {
|
|
56
52
|
console.error(`Failed to parse the Datadog configuration file you provided.
|
|
57
53
|
Your configuration must validate the node_modules/@datadog/mobile-react-native/datadog-configuration.schema.json JSON schema.
|
|
@@ -61,10 +57,8 @@ You can use VSCode to check your configuration by adding the following line to y
|
|
|
61
57
|
}`);
|
|
62
58
|
return {};
|
|
63
59
|
}
|
|
64
|
-
|
|
65
60
|
return userSpecifiedConfiguration['configuration'];
|
|
66
61
|
};
|
|
67
|
-
|
|
68
62
|
export const getJSONConfiguration = userSpecifiedConfiguration => {
|
|
69
63
|
const configuration = resolveJSONConfiguration(userSpecifiedConfiguration);
|
|
70
64
|
return {
|
|
@@ -82,12 +76,10 @@ export const getJSONConfiguration = userSpecifiedConfiguration => {
|
|
|
82
76
|
firstPartyHosts: buildFirstPartyHosts(configuration.firstPartyHosts)
|
|
83
77
|
};
|
|
84
78
|
};
|
|
85
|
-
|
|
86
79
|
const buildFirstPartyHosts = firstPartyHosts => {
|
|
87
80
|
if (!firstPartyHosts) {
|
|
88
81
|
return undefined;
|
|
89
82
|
}
|
|
90
|
-
|
|
91
83
|
try {
|
|
92
84
|
return firstPartyHosts.map(({
|
|
93
85
|
match,
|
|
@@ -104,90 +96,74 @@ The first party hosts will not be set for this session.
|
|
|
104
96
|
return undefined;
|
|
105
97
|
}
|
|
106
98
|
};
|
|
107
|
-
|
|
108
99
|
export const formatPropagatorType = propagatorType => {
|
|
109
100
|
switch (propagatorType.toLowerCase()) {
|
|
110
101
|
case 'b3':
|
|
111
102
|
{
|
|
112
103
|
return PropagatorType.B3;
|
|
113
104
|
}
|
|
114
|
-
|
|
115
105
|
case 'b3multi':
|
|
116
106
|
{
|
|
117
107
|
return PropagatorType.B3MULTI;
|
|
118
108
|
}
|
|
119
|
-
|
|
120
109
|
case 'datadog':
|
|
121
110
|
{
|
|
122
111
|
return PropagatorType.DATADOG;
|
|
123
112
|
}
|
|
124
|
-
|
|
125
113
|
case 'tracecontext':
|
|
126
114
|
{
|
|
127
115
|
return PropagatorType.TRACECONTEXT;
|
|
128
116
|
}
|
|
129
|
-
|
|
130
117
|
default:
|
|
131
118
|
{
|
|
132
119
|
throw new Error(`Failed to parse propagator type ${propagatorType}.`);
|
|
133
120
|
}
|
|
134
121
|
}
|
|
135
122
|
};
|
|
136
|
-
|
|
137
123
|
const buildTrackingConsent = trackingConsent => {
|
|
138
124
|
if (trackingConsent === undefined) {
|
|
139
125
|
return undefined;
|
|
140
126
|
}
|
|
141
|
-
|
|
142
127
|
switch (trackingConsent.toLowerCase()) {
|
|
143
128
|
case 'granted':
|
|
144
129
|
{
|
|
145
130
|
return TrackingConsent.GRANTED;
|
|
146
131
|
}
|
|
147
|
-
|
|
148
132
|
case 'pending':
|
|
149
133
|
{
|
|
150
134
|
return TrackingConsent.PENDING;
|
|
151
135
|
}
|
|
152
|
-
|
|
153
136
|
case 'not_granted':
|
|
154
137
|
{
|
|
155
138
|
return TrackingConsent.NOT_GRANTED;
|
|
156
139
|
}
|
|
157
|
-
|
|
158
140
|
default:
|
|
159
141
|
{
|
|
160
142
|
return DEFAULTS.trackingConsent;
|
|
161
143
|
}
|
|
162
144
|
}
|
|
163
145
|
};
|
|
164
|
-
|
|
165
146
|
const buildSdkVerbosity = verbosity => {
|
|
166
147
|
if (verbosity === undefined) {
|
|
167
148
|
return undefined;
|
|
168
149
|
}
|
|
169
|
-
|
|
170
150
|
switch (verbosity.toLowerCase()) {
|
|
171
151
|
case 'debug':
|
|
172
152
|
{
|
|
173
153
|
return SdkVerbosity.DEBUG;
|
|
174
154
|
}
|
|
175
|
-
|
|
176
155
|
case 'info':
|
|
177
156
|
{
|
|
178
157
|
return SdkVerbosity.INFO;
|
|
179
158
|
}
|
|
180
|
-
|
|
181
159
|
case 'warn':
|
|
182
160
|
{
|
|
183
161
|
return SdkVerbosity.WARN;
|
|
184
162
|
}
|
|
185
|
-
|
|
186
163
|
case 'error':
|
|
187
164
|
{
|
|
188
165
|
return SdkVerbosity.ERROR;
|
|
189
166
|
}
|
|
190
|
-
|
|
191
167
|
default:
|
|
192
168
|
{
|
|
193
169
|
return undefined;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["FileBasedConfiguration.ts"],"names":["DatadogProviderConfiguration","DEFAULTS","SdkVerbosity","TrackingConsent","PropagatorType","FileBasedConfiguration","constructor","params","configuration","getJSONConfiguration","clientToken","env","applicationId","trackInteractions","trackResources","trackErrors","trackingConsent","longTaskThresholdMs","verbosity","actionNameAttribute","resourceTracingSamplingRate","firstPartyHosts","getFirstPartyHosts","errorEventMapper","resourceEventMapper","actionEventMapper","resolveJSONConfiguration","userSpecifiedConfiguration","undefined","jsonContent","require","console","error","buildTrackingConsent","buildSdkVerbosity","buildFirstPartyHosts","map","match","propagatorTypes","formatPropagatorType","message","propagatorType","toLowerCase","B3","B3MULTI","DATADOG","TRACECONTEXT","Error","GRANTED","PENDING","NOT_GRANTED","DEBUG","INFO","WARN","ERROR"],"mappings":"AAAA;AACA;AACA;AACA;AACA;AAGA,SACIA,4BADJ,EAEIC,QAFJ,QAGO,qCAHP;AAIA,SAASC,YAAT,QAA6B,oBAA7B;AACA,SAASC,eAAT,QAAgC,uBAAhC;AAIA,SAASC,cAAT,QAA+B,iBAA/B;AAEA,OAAO,MAAMC,sBAAN,SAAqCL,4BAArC,CAAkE;AACrEM,EAAAA,WAAW,CAACC,MAAD,EAKR;AACC,UAAMC,aAAa,GAAGC,oBAAoB,CAACF,MAAD,aAACA,MAAD,uBAACA,MAAM,CAAEC,aAAT,CAA1C;AACA,UACIA,aAAa,CAACE,WADlB,EAEIF,aAAa,CAACG,GAFlB,EAGIH,aAAa,CAACI,aAHlB,EAIIJ,aAAa,CAACK,iBAJlB,EAKIL,aAAa,CAACM,cALlB,EAMIN,aAAa,CAACO,WANlB,EAOIP,aAAa,CAACQ,eAPlB;AASA,SAAKC,mBAAL,GACIT,aAAa,CAACS,mBAAd,IAAqChB,QAAQ,CAACgB,mBADlD;AAEA,SAAKC,SAAL,GAAiBV,aAAa,CAACU,SAA/B;AACA,SAAKC,mBAAL,GAA2BX,aAAa,CAACW,mBAAzC;AACA,SAAKC,2BAAL,GACIZ,aAAa,CAACY,2BAAd,IACAnB,QAAQ,CAACmB,2BAFb;AAGA,SAAKC,eAAL,GACIb,aAAa,CAACa,eAAd,IAAiCpB,QAAQ,CAACqB,kBAAT,EADrC;AAEA,SAAKC,gBAAL,GACI,CAAAhB,MAAM,SAAN,IAAAA,MAAM,WAAN,YAAAA,MAAM,CAAEgB,gBAAR,KAA4BtB,QAAQ,CAACsB,gBADzC;AAEA,SAAKC,mBAAL,GACI,CAAAjB,MAAM,SAAN,IAAAA,MAAM,WAAN,YAAAA,MAAM,CAAEiB,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AOxC,cAAc,CAACyC,OAAtB;AACH;;AACD,SAAK,cAAL;AAAqB;AACjB,eAAOzC,cAAc,CAAC0C,YAAtB;AACH;;AACD;AAAS;AACL,cAAM,IAAIC,KAAJ,CACD,mCAAkCN,cAAe,GADhD,CAAN;AAGH;AAjBL;AAmBH,CAtBM;;AAwBP,MAAMR,oBAAoB,GACtBjB,eADyB,IAEK;AAC9B,MAAIA,eAAe,KAAKY,SAAxB,EAAmC;AAC/B,WAAOA,SAAP;AACH;;AACD,UAAQZ,eAAe,CAAC0B,WAAhB,EAAR;AACI,SAAK,SAAL;AAAgB;AACZ,eAAOvC,eAAe,CAAC6C,OAAvB;AACH;;AACD,SAAK,SAAL;AAAgB;AACZ,eAAO7C,eAAe,CAAC8C,OAAvB;AACH;;AACD,SAAK,aAAL;AAAoB;AAChB,eAAO9C,eAAe,CAAC+C,WAAvB;AACH;;AACD;AAAS;AACL,eAAOjD,QAAQ,CAACe,eAAhB;AACH;AAZL;AAcH,CApBD;;AAsBA,MAAMkB,iBAAiB,GACnBhB,SADsB,IAEK;AAC3B,MAAIA,SAAS,KAAKU,SAAlB,EAA6B;AACzB,WAAOA,SAAP;AACH;;AACD,UAAQV,SAAS,CAACwB,WAAV,EAAR;AACI,SAAK,OAAL;AAAc;AACV,eAAOxC,YAAY,CAACiD,KAApB;AACH;;AACD,SAAK,MAAL;AAAa;AACT,eAAOjD,YAAY,CAACkD,IAApB;AACH;;AACD,SAAK,MAAL;AAAa;AACT,eAAOlD,YAAY,CAACmD,IAApB;AACH;;AACD,SAAK,OAAL;AAAc;AACV,eAAOnD,YAAY,CAACoD,KAApB;AACH;;AACD;AAAS;AACL,eAAO1B,SAAP;AACH;AAfL;AAiBH,CAvBD","sourcesContent":["/*\n * Unless explicitly stated otherwise all files in this repository are licensed under the Apache License Version 2.0.\n * This product includes software developed at Datadog (https://www.datadoghq.com/).\n * Copyright 2016-Present Datadog, Inc.\n */\n\nimport type { FirstPartyHostsConfiguration } from '../../DdSdkReactNativeConfiguration';\nimport {\n DatadogProviderConfiguration,\n DEFAULTS\n} from '../../DdSdkReactNativeConfiguration';\nimport { SdkVerbosity } from '../../SdkVerbosity';\nimport { TrackingConsent } from '../../TrackingConsent';\nimport type { ActionEventMapper } from '../../rum/eventMappers/actionEventMapper';\nimport type { ErrorEventMapper } from '../../rum/eventMappers/errorEventMapper';\nimport type { ResourceEventMapper } from '../../rum/eventMappers/resourceEventMapper';\nimport { PropagatorType } from '../../rum/types';\n\nexport class FileBasedConfiguration extends DatadogProviderConfiguration {\n constructor(params?: {\n configuration?: unknown;\n errorEventMapper?: ErrorEventMapper;\n resourceEventMapper?: ResourceEventMapper;\n actionEventMapper?: ActionEventMapper;\n }) {\n const configuration = getJSONConfiguration(params?.configuration);\n super(\n configuration.clientToken,\n configuration.env,\n configuration.applicationId,\n configuration.trackInteractions,\n configuration.trackResources,\n configuration.trackErrors,\n configuration.trackingConsent\n );\n this.longTaskThresholdMs =\n configuration.longTaskThresholdMs || DEFAULTS.longTaskThresholdMs;\n this.verbosity = configuration.verbosity;\n this.actionNameAttribute = configuration.actionNameAttribute;\n this.resourceTracingSamplingRate =\n configuration.resourceTracingSamplingRate ||\n DEFAULTS.resourceTracingSamplingRate;\n this.firstPartyHosts =\n configuration.firstPartyHosts || DEFAULTS.getFirstPartyHosts();\n this.errorEventMapper =\n params?.errorEventMapper || DEFAULTS.errorEventMapper;\n this.resourceEventMapper =\n params?.resourceEventMapper || DEFAULTS.resourceEventMapper;\n this.actionEventMapper =\n params?.actionEventMapper || DEFAULTS.actionEventMapper;\n }\n}\n\nconst resolveJSONConfiguration = (\n userSpecifiedConfiguration: unknown\n): Record<string, any> => {\n if (\n userSpecifiedConfiguration === undefined ||\n userSpecifiedConfiguration === null\n ) {\n try {\n // This corresponds to a file located at the root of a RN project.\n // /!\\ We have to write the require this way as dynamic requires are not supported by Hermes.\n // eslint-disable-next-line global-require, @typescript-eslint/no-var-requires\n const jsonContent = require('../../../../../../datadog-configuration.json');\n\n if (\n typeof jsonContent !== 'object' ||\n !jsonContent['configuration']\n ) {\n console.error(`Failed to parse the Datadog configuration file located at the root of the project.\nYour configuration must validate the node_modules/@datadog/mobile-react-native/datadog-configuration.schema.json JSON schema.\nYou can use VSCode to check your configuration by adding the following line to your JSON file:\n{\n \"$schema\": \"./node_modules/@datadog/mobile-react-native/datadog-configuration.schema.json\",\n}`);\n\n return {};\n }\n\n return jsonContent.configuration as Record<string, any>;\n } catch (error) {\n console.error(`Failed to read Datadog configuration file at the root of the project.\nIf you don't have a datadog-configuration.json file at the same level as your node_modules directory,\\\nplease use the following syntax:\\n\nnew FileBasedConfiguration({configuration: require('./file/to/configuration-file.json')})\n`);\n return {};\n }\n }\n if (\n typeof userSpecifiedConfiguration !== 'object' ||\n !(userSpecifiedConfiguration as any)['configuration']\n ) {\n console.error(`Failed to parse the Datadog configuration file you provided.\nYour configuration must validate the node_modules/@datadog/mobile-react-native/datadog-configuration.schema.json JSON schema.\nYou can use VSCode to check your configuration by adding the following line to your JSON file:\n{\n \"$schema\": \"./node_modules/@datadog/mobile-react-native/datadog-configuration.schema.json\",\n}`);\n\n return {};\n }\n\n return (userSpecifiedConfiguration as any)['configuration'] as Record<\n string,\n any\n >;\n};\n\nexport const getJSONConfiguration = (\n userSpecifiedConfiguration: unknown\n): {\n clientToken: string;\n env: string;\n applicationId: string;\n trackInteractions: boolean | undefined;\n trackResources: boolean | undefined;\n trackErrors: boolean | undefined;\n trackingConsent: TrackingConsent | undefined;\n longTaskThresholdMs: number | undefined;\n verbosity: SdkVerbosity | undefined;\n actionNameAttribute: string | undefined;\n resourceTracingSamplingRate: number | undefined;\n firstPartyHosts: FirstPartyHostsConfiguration | undefined;\n} => {\n const configuration = resolveJSONConfiguration(userSpecifiedConfiguration);\n\n return {\n clientToken: configuration.clientToken,\n env: configuration.env,\n applicationId: configuration.applicationId,\n trackInteractions: configuration.trackInteractions,\n trackResources: configuration.trackResources,\n trackErrors: configuration.trackErrors,\n trackingConsent: buildTrackingConsent(configuration.trackingConsent),\n longTaskThresholdMs: configuration.longTaskThresholdMs,\n verbosity: buildSdkVerbosity(configuration.verbosity),\n actionNameAttribute: configuration.actionNameAttribute,\n resourceTracingSamplingRate: configuration.resourceTracingSamplingRate,\n firstPartyHosts: buildFirstPartyHosts(configuration.firstPartyHosts)\n };\n};\n\nconst buildFirstPartyHosts = (\n firstPartyHosts: { match: string; propagatorTypes: string[] }[] | undefined\n): FirstPartyHostsConfiguration | undefined => {\n if (!firstPartyHosts) {\n return undefined;\n }\n\n try {\n return firstPartyHosts.map(({ match, propagatorTypes }) => ({\n match,\n propagatorTypes: propagatorTypes.map(formatPropagatorType)\n }));\n } catch (error) {\n console.error(`Failed to parse the first party hosts from the Datadog configuration file you provided:\n${(error as any).message}\nThe first party hosts will not be set for this session.\n`);\n return undefined;\n }\n};\n\nexport const formatPropagatorType = (\n propagatorType: string\n): PropagatorType => {\n switch (propagatorType.toLowerCase()) {\n case 'b3': {\n return PropagatorType.B3;\n }\n case 'b3multi': {\n return PropagatorType.B3MULTI;\n }\n case 'datadog': {\n return PropagatorType.DATADOG;\n }\n case 'tracecontext': {\n return PropagatorType.TRACECONTEXT;\n }\n default: {\n throw new Error(\n `Failed to parse propagator type ${propagatorType}.`\n );\n }\n }\n};\n\nconst buildTrackingConsent = (\n trackingConsent: string | undefined\n): TrackingConsent | undefined => {\n if (trackingConsent === undefined) {\n return undefined;\n }\n switch (trackingConsent.toLowerCase()) {\n case 'granted': {\n return TrackingConsent.GRANTED;\n }\n case 'pending': {\n return TrackingConsent.PENDING;\n }\n case 'not_granted': {\n return TrackingConsent.NOT_GRANTED;\n }\n default: {\n return DEFAULTS.trackingConsent;\n }\n }\n};\n\nconst buildSdkVerbosity = (\n verbosity: string | undefined\n): SdkVerbosity | undefined => {\n if (verbosity === undefined) {\n return undefined;\n }\n switch (verbosity.toLowerCase()) {\n case 'debug': {\n return SdkVerbosity.DEBUG;\n }\n case 'info': {\n return SdkVerbosity.INFO;\n }\n case 'warn': {\n return SdkVerbosity.WARN;\n }\n case 'error': {\n return SdkVerbosity.ERROR;\n }\n default: {\n return undefined;\n }\n }\n};\n"]}
|
|
1
|
+
{"version":3,"names":["DatadogProviderConfiguration","DEFAULTS","SdkVerbosity","TrackingConsent","PropagatorType","FileBasedConfiguration","constructor","params","configuration","getJSONConfiguration","clientToken","env","applicationId","trackInteractions","trackResources","trackErrors","trackingConsent","longTaskThresholdMs","verbosity","actionNameAttribute","resourceTracingSamplingRate","firstPartyHosts","getFirstPartyHosts","errorEventMapper","resourceEventMapper","actionEventMapper","resolveJSONConfiguration","userSpecifiedConfiguration","undefined","jsonContent","require","console","error","buildTrackingConsent","buildSdkVerbosity","buildFirstPartyHosts","map","match","propagatorTypes","formatPropagatorType","message","propagatorType","toLowerCase","B3","B3MULTI","DATADOG","TRACECONTEXT","Error","GRANTED","PENDING","NOT_GRANTED","DEBUG","INFO","WARN","ERROR"],"sourceRoot":"../../../../src","sources":["sdk/FileBasedConfiguration/FileBasedConfiguration.ts"],"mappings":"AAAA;AACA;AACA;AACA;AACA;;AAGA,SACIA,4BAA4B,EAC5BC,QAAQ,QACL,qCAAqC;AAC5C,SAASC,YAAY,QAAQ,oBAAoB;AACjD,SAASC,eAAe,QAAQ,uBAAuB;AAIvD,SAASC,cAAc,QAAQ,iBAAiB;AAEhD,OAAO,MAAMC,sBAAsB,SAASL,4BAA4B,CAAC;EACrEM,WAAWA,CAACC,MAKX,EAAE;IACC,MAAMC,aAAa,GAAGC,oBAAoB,CAACF,MAAM,EAAEC,aAAa,CAAC;IACjE,KAAK,CACDA,aAAa,CAACE,WAAW,EACzBF,aAAa,CAACG,GAAG,EACjBH,aAAa,CAACI,aAAa,EAC3BJ,aAAa,CAACK,iBAAiB,EAC/BL,aAAa,CAACM,cAAc,EAC5BN,aAAa,CAACO,WAAW,EACzBP,aAAa,CAACQ,eAClB,CAAC;IACD,IAAI,CAACC,mBAAmB,GACpBT,aAAa,CAACS,mBAAmB,IAAIhB,QAAQ,C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V,OAAOnD,YAAY,CAACoD,KAAK;MAC7B;IACA;MAAS;QACL,OAAO1B,SAAS;MACpB;EACJ;AACJ,CAAC","ignoreList":[]}
|
|
@@ -1,5 +1,3 @@
|
|
|
1
|
-
function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
|
|
2
|
-
|
|
3
1
|
/*
|
|
4
2
|
* Unless explicitly stated otherwise all files in this repository are licensed under the Apache License Version 2.0.
|
|
5
3
|
* This product includes software developed at Datadog (https://www.datadoghq.com/).
|
|
@@ -11,19 +9,18 @@ function _defineProperty(obj, key, value) { if (key in obj) { Object.definePrope
|
|
|
11
9
|
* the SDK classes.
|
|
12
10
|
*/
|
|
13
11
|
export class GlobalState {
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
12
|
+
/**
|
|
13
|
+
* `true` if the SDK is initialized, `false` otherwise.
|
|
14
|
+
*/
|
|
15
|
+
isInitialized = false;
|
|
17
16
|
|
|
17
|
+
// Singleton implementation
|
|
18
|
+
static _instance = undefined;
|
|
18
19
|
static get instance() {
|
|
19
20
|
if (this._instance === undefined) {
|
|
20
21
|
this._instance = new GlobalState();
|
|
21
22
|
}
|
|
22
|
-
|
|
23
23
|
return this._instance;
|
|
24
24
|
}
|
|
25
|
-
|
|
26
25
|
}
|
|
27
|
-
|
|
28
|
-
_defineProperty(GlobalState, "_instance", undefined);
|
|
29
26
|
//# sourceMappingURL=GlobalState.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"
|
|
1
|
+
{"version":3,"names":["GlobalState","isInitialized","_instance","undefined","instance"],"sourceRoot":"../../../../src","sources":["sdk/GlobalState/GlobalState.tsx"],"mappings":"AAAA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA,OAAO,MAAMA,WAAW,CAAC;EACrB;AACJ;AACA;EACWC,aAAa,GAAG,KAAK;;EAE5B;EACA,OAAeC,SAAS,GAA4BC,SAAS;EAC7D,WAAkBC,QAAQA,CAAA,EAAgB;IACtC,IAAI,IAAI,CAACF,SAAS,KAAKC,SAAS,EAAE;MAC9B,IAAI,CAACD,SAAS,GAAG,IAAIF,WAAW,CAAC,CAAC;IACtC;IAEA,OAAO,IAAI,CAACE,SAAS;EACzB;AACJ","ignoreList":[]}
|
|
@@ -1,34 +1,25 @@
|
|
|
1
|
-
function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
|
|
2
|
-
|
|
3
1
|
/*
|
|
4
2
|
* Unless explicitly stated otherwise all files in this repository are licensed under the Apache License Version 2.0.
|
|
5
3
|
* This product includes software developed at Datadog (https://www.datadoghq.com/).
|
|
6
4
|
* Copyright 2016-Present Datadog, Inc.
|
|
7
5
|
*/
|
|
8
|
-
class UserInfoProvider {
|
|
9
|
-
constructor() {
|
|
10
|
-
_defineProperty(this, "userInfo", {});
|
|
11
|
-
|
|
12
|
-
_defineProperty(this, "setUserInfo", userInfo => {
|
|
13
|
-
this.userInfo = userInfo;
|
|
14
|
-
});
|
|
15
|
-
|
|
16
|
-
_defineProperty(this, "getUserInfo", () => {
|
|
17
|
-
return this.userInfo;
|
|
18
|
-
});
|
|
19
|
-
}
|
|
20
6
|
|
|
7
|
+
class UserInfoProvider {
|
|
8
|
+
userInfo = {};
|
|
9
|
+
setUserInfo = userInfo => {
|
|
10
|
+
this.userInfo = userInfo;
|
|
11
|
+
};
|
|
12
|
+
getUserInfo = () => {
|
|
13
|
+
return this.userInfo;
|
|
14
|
+
};
|
|
15
|
+
}
|
|
16
|
+
export class UserInfoSingleton {
|
|
17
|
+
static userInfoProvider = new UserInfoProvider();
|
|
18
|
+
static getInstance = () => {
|
|
19
|
+
return UserInfoSingleton.userInfoProvider;
|
|
20
|
+
};
|
|
21
|
+
static reset = () => {
|
|
22
|
+
UserInfoSingleton.userInfoProvider = new UserInfoProvider();
|
|
23
|
+
};
|
|
21
24
|
}
|
|
22
|
-
|
|
23
|
-
export class UserInfoSingleton {}
|
|
24
|
-
|
|
25
|
-
_defineProperty(UserInfoSingleton, "userInfoProvider", new UserInfoProvider());
|
|
26
|
-
|
|
27
|
-
_defineProperty(UserInfoSingleton, "getInstance", () => {
|
|
28
|
-
return UserInfoSingleton.userInfoProvider;
|
|
29
|
-
});
|
|
30
|
-
|
|
31
|
-
_defineProperty(UserInfoSingleton, "reset", () => {
|
|
32
|
-
UserInfoSingleton.userInfoProvider = new UserInfoProvider();
|
|
33
|
-
});
|
|
34
25
|
//# sourceMappingURL=UserInfoSingleton.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"
|
|
1
|
+
{"version":3,"names":["UserInfoProvider","userInfo","setUserInfo","getUserInfo","UserInfoSingleton","userInfoProvider","getInstance","reset"],"sourceRoot":"../../../../src","sources":["sdk/UserInfoSingleton/UserInfoSingleton.ts"],"mappings":"AAAA;AACA;AACA;AACA;AACA;;AAIA,MAAMA,gBAAgB,CAAC;EACXC,QAAQ,GAAa,CAAC,CAAC;EAE/BC,WAAW,GAAID,QAAkB,IAAK;IAClC,IAAI,CAACA,QAAQ,GAAGA,QAAQ;EAC5B,CAAC;EAEDE,WAAW,GAAGA,CAAA,KAAgB;IAC1B,OAAO,IAAI,CAACF,QAAQ;EACxB,CAAC;AACL;AAEA,OAAO,MAAMG,iBAAiB,CAAC;EAC3B,OAAeC,gBAAgB,GAAG,IAAIL,gBAAgB,CAAC,CAAC;EAExD,OAAOM,WAAW,GAAGA,CAAA,KAAwB;IACzC,OAAOF,iBAAiB,CAACC,gBAAgB;EAC7C,CAAC;EAED,OAAOE,KAAK,GAAGA,CAAA,KAAM;IACjBH,iBAAiB,CAACC,gBAAgB,GAAG,IAAIL,gBAAgB,CAAC,CAAC;EAC/D,CAAC;AACL","ignoreList":[]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"
|
|
1
|
+
{"version":3,"names":[],"sourceRoot":"../../../../src","sources":["sdk/UserInfoSingleton/types.ts"],"mappings":"","ignoreList":[]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"
|
|
1
|
+
{"version":3,"names":["TurboModuleRegistry","get"],"sourceRoot":"../../../src","sources":["specs/NativeDdLogs.ts"],"mappings":"AAAA;AACA;AACA;AACA;AACA;;AAEA;;AAEA,SAASA,mBAAmB,QAAQ,cAAc;;AAElD;AACA;AACA;;AAiGA;AACA,eAAeA,mBAAmB,CAACC,GAAG,CAAO,QAAQ,CAAC","ignoreList":[]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"
|
|
1
|
+
{"version":3,"names":["TurboModuleRegistry","get"],"sourceRoot":"../../../src","sources":["specs/NativeDdRum.ts"],"mappings":"AAAA;AACA;AACA;AACA;AACA;;AAEA;;AAEA,SAASA,mBAAmB,QAAQ,cAAc;;AAElD;AACA;AACA;;AAiJA;AACA,eAAeA,mBAAmB,CAACC,GAAG,CAAO,OAAO,CAAC","ignoreList":[]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"
|
|
1
|
+
{"version":3,"names":["TurboModuleRegistry","get"],"sourceRoot":"../../../src","sources":["specs/NativeDdSdk.ts"],"mappings":"AAAA;AACA;AACA;AACA;AACA;;AAEA;;AAEA,SAASA,mBAAmB,QAAQ,cAAc;;AAElD;AACA;AACA;;AAsDA;AACA,eAAeA,mBAAmB,CAACC,GAAG,CAAO,OAAO,CAAC","ignoreList":[]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"
|
|
1
|
+
{"version":3,"names":["TurboModuleRegistry","get"],"sourceRoot":"../../../src","sources":["specs/NativeDdTrace.ts"],"mappings":"AAAA;AACA;AACA;AACA;AACA;;AAEA;;AAEA,SAASA,mBAAmB,QAAQ,cAAc;;AAElD;AACA;AACA;;AA6BA;AACA,eAAeA,mBAAmB,CAACC,GAAG,CAAO,SAAS,CAAC","ignoreList":[]}
|
|
@@ -1,35 +1,28 @@
|
|
|
1
|
-
function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
|
|
2
|
-
|
|
3
1
|
/*
|
|
4
2
|
* Unless explicitly stated otherwise all files in this repository are licensed under the Apache License Version 2.0.
|
|
5
3
|
* This product includes software developed at Datadog (https://www.datadoghq.com/).
|
|
6
4
|
* Copyright 2016-Present Datadog, Inc.
|
|
7
5
|
*/
|
|
6
|
+
|
|
8
7
|
import { InternalLog } from '../InternalLog';
|
|
9
8
|
import { SdkVerbosity } from '../SdkVerbosity';
|
|
10
9
|
import { bufferNativeCallReturningId, bufferNativeCallWithId } from '../sdk/DatadogProvider/Buffer/bufferNativeCall';
|
|
11
10
|
import { validateContext } from '../utils/argsUtils';
|
|
12
11
|
import { DefaultTimeProvider } from '../utils/time-provider/DefaultTimeProvider';
|
|
13
12
|
const timeProvider = new DefaultTimeProvider();
|
|
14
|
-
|
|
15
13
|
class DdTraceWrapper {
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
return bufferNativeCallWithId(id => this.nativeTrace.finishSpan(id, validateContext(context), timestampMs), spanId);
|
|
28
|
-
});
|
|
29
|
-
}
|
|
30
|
-
|
|
14
|
+
// eslint-disable-next-line global-require, @typescript-eslint/no-var-requires
|
|
15
|
+
nativeTrace = require('../specs/NativeDdTrace').default;
|
|
16
|
+
startSpan = (operation, context = {}, timestampMs = timeProvider.now()) => {
|
|
17
|
+
const spanId = bufferNativeCallReturningId(() => this.nativeTrace.startSpan(operation, validateContext(context), timestampMs));
|
|
18
|
+
InternalLog.log(`Starting span “${operation}” #${spanId}`, SdkVerbosity.DEBUG);
|
|
19
|
+
return spanId;
|
|
20
|
+
};
|
|
21
|
+
finishSpan = (spanId, context = {}, timestampMs = timeProvider.now()) => {
|
|
22
|
+
InternalLog.log(`Finishing span #${spanId}`, SdkVerbosity.DEBUG);
|
|
23
|
+
return bufferNativeCallWithId(id => this.nativeTrace.finishSpan(id, validateContext(context), timestampMs), spanId);
|
|
24
|
+
};
|
|
31
25
|
}
|
|
32
|
-
|
|
33
26
|
const DdTrace = new DdTraceWrapper();
|
|
34
27
|
export { DdTrace };
|
|
35
28
|
//# sourceMappingURL=DdTrace.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"
|
|
1
|
+
{"version":3,"names":["InternalLog","SdkVerbosity","bufferNativeCallReturningId","bufferNativeCallWithId","validateContext","DefaultTimeProvider","timeProvider","DdTraceWrapper","nativeTrace","require","default","startSpan","operation","context","timestampMs","now","spanId","log","DEBUG","finishSpan","id","DdTrace"],"sourceRoot":"../../../src","sources":["trace/DdTrace.ts"],"mappings":"AAAA;AACA;AACA;AACA;AACA;;AAEA,SAASA,WAAW,QAAQ,gBAAgB;AAC5C,SAASC,YAAY,QAAQ,iBAAiB;AAE9C,SACIC,2BAA2B,EAC3BC,sBAAsB,QACnB,gDAAgD;AAEvD,SAASC,eAAe,QAAQ,oBAAoB;AACpD,SAASC,mBAAmB,QAAQ,4CAA4C;AAEhF,MAAMC,YAAY,GAAG,IAAID,mBAAmB,CAAC,CAAC;AAE9C,MAAME,cAAc,CAAwB;EACxC;EACQC,WAAW,GAAsBC,OAAO,CAAC,wBAAwB,CAAC,CACrEC,OAAO;EAEZC,SAAS,GAAGA,CACRC,SAAiB,EACjBC,OAAe,GAAG,CAAC,CAAC,EACpBC,WAAmB,GAAGR,YAAY,CAACS,GAAG,CAAC,CAAC,KACtB;IAClB,MAAMC,MAAM,GAAGd,2BAA2B,CAAC,MACvC,IAAI,CAACM,WAAW,CAACG,SAAS,CACtBC,SAAS,EACTR,eAAe,CAACS,OAAO,CAAC,EACxBC,WACJ,CACJ,CAAC;IACDd,WAAW,CAACiB,GAAG,CACX,kBAAkBL,SAAS,MAAMI,MAAM,EAAE,EACzCf,YAAY,CAACiB,KACjB,CAAC;IACD,OAAOF,MAAM;EACjB,CAAC;EAEDG,UAAU,GAAGA,CACTH,MAAc,EACdH,OAAe,GAAG,CAAC,CAAC,EACpBC,WAAmB,GAAGR,YAAY,CAACS,GAAG,CAAC,CAAC,KACxB;IAChBf,WAAW,CAACiB,GAAG,CAAC,mBAAmBD,MAAM,EAAE,EAAEf,YAAY,CAACiB,KAAK,CAAC;IAChE,OAAOf,sBAAsB,CACzBiB,EAAE,IACE,IAAI,CAACZ,WAAW,CAACW,UAAU,CACvBC,EAAE,EACFhB,eAAe,CAACS,OAAO,CAAC,EACxBC,WACJ,CAAC,EACLE,MACJ,CAAC;EACL,CAAC;AACL;AAEA,MAAMK,OAAoB,GAAG,IAAId,cAAc,CAAC,CAAC;AAEjD,SAASc,OAAO","ignoreList":[]}
|
package/lib/module/types.js
CHANGED
|
@@ -36,9 +36,13 @@ export class DdSdkConfiguration {
|
|
|
36
36
|
this.bundleLogsWithRum = bundleLogsWithRum;
|
|
37
37
|
this.bundleLogsWithTraces = bundleLogsWithTraces;
|
|
38
38
|
}
|
|
39
|
-
|
|
40
39
|
}
|
|
40
|
+
|
|
41
41
|
/**
|
|
42
42
|
* The entry point to initialize Datadog's features.
|
|
43
43
|
*/
|
|
44
|
+
|
|
45
|
+
/**
|
|
46
|
+
* The entry point to use Datadog's Trace feature.
|
|
47
|
+
*/
|
|
44
48
|
//# sourceMappingURL=types.js.map
|
package/lib/module/types.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"
|
|
1
|
+
{"version":3,"names":["DdSdkConfiguration","constructor","clientToken","env","applicationId","nativeCrashReportEnabled","nativeLongTaskThresholdMs","longTaskThresholdMs","sampleRate","site","trackingConsent","additionalConfiguration","telemetrySampleRate","vitalsUpdateFrequency","uploadFrequency","batchSize","trackFrustrations","trackBackgroundEvents","customEndpoints","configurationForTelemetry","nativeViewTracking","nativeInteractionTracking","verbosity","proxyConfig","serviceName","firstPartyHosts","bundleLogsWithRum","bundleLogsWithTraces"],"sourceRoot":"../../src","sources":["types.tsx"],"mappings":"AAAA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA,OAAO,MAAMA,kBAAkB,CAAC;EAC5BC,WAAWA,CACEC,WAAmB,EACnBC,GAAW,EACXC,aAAqB,EACrBC,wBAAiC,EACjCC,yBAAiC,EACjCC,mBAA2B,EAC3BC,UAAkB,EAClBC,IAAY,EACZC,eAAuB,EACvBC,uBAA+B,EAC/BC,mBAA2B,EAC3BC,qBAA6B,EAC7BC,eAAuB,EACvBC,SAAiB,EACjBC,iBAA0B,EAC1BC,qBAA8B,EAC9BC,eAIR,EACQC,yBAOR,EACQC,kBAA2B,EAC3BC,yBAAkC,EAClCC,SAA6B,EAC7BC,WAQM,EACNC,WAA+B,EAC/BC,eAGN,EACMC,iBAA0B,EAC1BC,oBAA6B,EACxC;IAAA,KAhDWzB,WAAmB,GAAnBA,WAAmB;IAAA,KACnBC,GAAW,GAAXA,GAAW;IAAA,KACXC,aAAqB,GAArBA,aAAqB;IAAA,KACrBC,wBAAiC,GAAjCA,wBAAiC;IAAA,KACjCC,yBAAiC,GAAjCA,yBAAiC;IAAA,KACjCC,mBAA2B,GAA3BA,mBAA2B;IAAA,KAC3BC,UAAkB,GAAlBA,UAAkB;IAAA,KAClBC,IAAY,GAAZA,IAAY;IAAA,KACZC,eAAuB,GAAvBA,eAAuB;IAAA,KACvBC,uBAA+B,GAA/BA,uBAA+B;IAAA,KAC/BC,mBAA2B,GAA3BA,mBAA2B;IAAA,KAC3BC,qBAA6B,GAA7BA,qBAA6B;IAAA,KAC7BC,eAAuB,GAAvBA,eAAuB;IAAA,KACvBC,SAAiB,GAAjBA,SAAiB;IAAA,KACjBC,iBAA0B,GAA1BA,iBAA0B;IAAA,KAC1BC,qBAA8B,GAA9BA,qBAA8B;IAAA,KAC9BC,eAIR,GAJQA,eAIR;IAAA,KACQC,yBAOR,GAPQA,yBAOR;IAAA,KACQC,kBAA2B,GAA3BA,kBAA2B;IAAA,KAC3BC,yBAAkC,GAAlCA,yBAAkC;IAAA,KAClCC,SAA6B,GAA7BA,SAA6B;IAAA,KAC7BC,WAQM,GARNA,WAQM;IAAA,KACNC,WAA+B,GAA/BA,WAA+B;IAAA,KAC/BC,eAGN,GAHMA,eAGN;IAAA,KACMC,iBAA0B,GAA1BA,iBAA0B;IAAA,KAC1BC,oBAA6B,GAA7BA,oBAA6B;EACvC;AACP;;AAEA;AACA;AACA;;AA2BA;AACA;AACA","ignoreList":[]}
|
|
@@ -1,51 +1,40 @@
|
|
|
1
|
-
function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
|
|
2
|
-
|
|
3
1
|
/*
|
|
4
2
|
* Unless explicitly stated otherwise all files in this repository are licensed under the Apache License Version 2.0.
|
|
5
3
|
* This product includes software developed at Datadog (https://www.datadoghq.com/).
|
|
6
4
|
* Copyright 2016-Present Datadog, Inc.
|
|
7
5
|
*/
|
|
6
|
+
|
|
8
7
|
import { DefaultTimeProvider } from './time-provider/DefaultTimeProvider';
|
|
9
8
|
const START_LABEL = '__start';
|
|
10
9
|
const STOP_LABEL = '__stop';
|
|
10
|
+
|
|
11
11
|
/**
|
|
12
12
|
* Simple timer which records time ticks. Shouldn't be re-used once stopped.
|
|
13
13
|
* All timestamps/durations returned are in milliseconds.
|
|
14
14
|
*/
|
|
15
|
-
|
|
16
15
|
export default class Timer {
|
|
16
|
+
times = {};
|
|
17
17
|
constructor(timeProvider = new DefaultTimeProvider()) {
|
|
18
|
-
_defineProperty(this, "timeProvider", void 0);
|
|
19
|
-
|
|
20
|
-
_defineProperty(this, "times", {});
|
|
21
|
-
|
|
22
18
|
this.timeProvider = timeProvider;
|
|
23
19
|
}
|
|
24
|
-
|
|
25
20
|
get startTime() {
|
|
26
21
|
return this.times[START_LABEL].unix;
|
|
27
22
|
}
|
|
28
|
-
|
|
29
23
|
get stopTime() {
|
|
30
24
|
return this.startTime + this.durationBetween(START_LABEL, STOP_LABEL);
|
|
31
25
|
}
|
|
32
|
-
|
|
33
26
|
start() {
|
|
34
27
|
this.recordTick(START_LABEL);
|
|
35
28
|
}
|
|
36
|
-
|
|
37
29
|
stop() {
|
|
38
30
|
this.recordTick(STOP_LABEL);
|
|
39
31
|
}
|
|
40
|
-
|
|
41
32
|
recordTick(label) {
|
|
42
33
|
this.times[label] = this.timeProvider.getTimestamp();
|
|
43
34
|
}
|
|
44
|
-
|
|
45
35
|
hasTickFor(label) {
|
|
46
36
|
return label in this.times;
|
|
47
37
|
}
|
|
48
|
-
|
|
49
38
|
durationBetween(startLabel, endLabel) {
|
|
50
39
|
this.checkLabelExists(startLabel);
|
|
51
40
|
this.checkLabelExists(endLabel);
|
|
@@ -53,29 +42,23 @@ export default class Timer {
|
|
|
53
42
|
const endTick = this.times[endLabel];
|
|
54
43
|
return this.durationBetweenTicks(startTick, endTick);
|
|
55
44
|
}
|
|
56
|
-
|
|
57
45
|
timeAt(label) {
|
|
58
46
|
this.checkLabelExists(label);
|
|
59
47
|
return this.startTime + this.durationBetween(START_LABEL, label);
|
|
60
48
|
}
|
|
61
|
-
|
|
62
49
|
reset() {
|
|
63
50
|
this.times = {};
|
|
64
51
|
}
|
|
65
|
-
|
|
66
52
|
durationBetweenTicks(start, end) {
|
|
67
53
|
if (start.reactNative != null && end.reactNative != null) {
|
|
68
54
|
return end.reactNative - start.reactNative;
|
|
69
55
|
}
|
|
70
|
-
|
|
71
56
|
return end.unix - start.unix;
|
|
72
57
|
}
|
|
73
|
-
|
|
74
58
|
checkLabelExists(label) {
|
|
75
59
|
if (!this.hasTickFor(label)) {
|
|
76
60
|
throw new Error(`Label ${label} is not registered`);
|
|
77
61
|
}
|
|
78
62
|
}
|
|
79
|
-
|
|
80
63
|
}
|
|
81
64
|
//# sourceMappingURL=Timer.js.map
|