@datadog/mobile-react-native 1.2.1 → 1.3.1
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 +2 -2
- package/android/build.gradle +58 -64
- package/android/src/main/kotlin/com/datadog/reactnative/DdSdk.kt +31 -1
- package/android/src/test/kotlin/com/datadog/reactnative/DdSdkTest.kt +242 -14
- package/android/src/test/kotlin/com/datadog/tools/unit/GenericAssert.kt +6 -0
- package/android/src/test/kotlin/com/datadog/tools/unit/forge/ActionEventForgeryFactory.kt +106 -0
- package/android/src/test/kotlin/com/datadog/tools/unit/forge/BaseConfigurator.kt +2 -0
- package/android/src/test/kotlin/com/datadog/tools/unit/forge/ResourceEventForgeryFactory.kt +116 -0
- package/ios/Sources/Attributes.swift +14 -0
- package/ios/Sources/DdSdk.swift +18 -0
- package/lib/commonjs/DdSdkReactNative.js +40 -8
- package/lib/commonjs/DdSdkReactNative.js.map +1 -1
- package/lib/commonjs/DdSdkReactNativeConfiguration.js +42 -2
- package/lib/commonjs/DdSdkReactNativeConfiguration.js.map +1 -1
- package/lib/commonjs/foundation.js +2 -139
- package/lib/commonjs/foundation.js.map +1 -1
- package/lib/commonjs/index.js +18 -14
- package/lib/commonjs/index.js.map +1 -1
- package/lib/commonjs/logs/DdLogs.js +71 -0
- package/lib/commonjs/logs/DdLogs.js.map +1 -0
- package/lib/commonjs/logs/eventMapper.js +39 -0
- package/lib/commonjs/logs/eventMapper.js.map +1 -0
- package/lib/commonjs/logs/types.js +2 -0
- package/lib/commonjs/{rum/instrumentation/EventsInterceptor.js.map → logs/types.js.map} +0 -0
- package/lib/commonjs/nativeModulesTypes.js.map +1 -1
- package/lib/commonjs/rum/DdRum.js +234 -0
- package/lib/commonjs/rum/DdRum.js.map +1 -0
- package/lib/commonjs/rum/eventMappers/actionEventMapper.js +36 -0
- package/lib/commonjs/rum/eventMappers/actionEventMapper.js.map +1 -0
- package/lib/commonjs/rum/eventMappers/errorEventMapper.js +32 -0
- package/lib/commonjs/rum/eventMappers/errorEventMapper.js.map +1 -0
- package/lib/commonjs/rum/eventMappers/resourceEventMapper.js +38 -0
- package/lib/commonjs/rum/eventMappers/resourceEventMapper.js.map +1 -0
- package/lib/commonjs/rum/instrumentation/DdRumErrorTracking.js +4 -4
- package/lib/commonjs/rum/instrumentation/DdRumErrorTracking.js.map +1 -1
- package/lib/commonjs/rum/instrumentation/{DdEventsInterceptor.js → interactionTracking/DdEventsInterceptor.js} +6 -6
- package/lib/commonjs/rum/instrumentation/interactionTracking/DdEventsInterceptor.js.map +1 -0
- package/lib/commonjs/rum/instrumentation/{DdRumUserInteractionTracking.js → interactionTracking/DdRumUserInteractionTracking.js} +13 -4
- package/lib/commonjs/rum/instrumentation/interactionTracking/DdRumUserInteractionTracking.js.map +1 -0
- package/lib/commonjs/rum/instrumentation/{EventsInterceptor.js → interactionTracking/EventsInterceptor.js} +0 -0
- package/lib/{module/rum/instrumentation → commonjs/rum/instrumentation/interactionTracking}/EventsInterceptor.js.map +0 -0
- package/lib/commonjs/rum/instrumentation/{NoOpEventsInterceptor.js → interactionTracking/NoOpEventsInterceptor.js} +0 -0
- package/lib/commonjs/rum/instrumentation/{NoOpEventsInterceptor.js.map → interactionTracking/NoOpEventsInterceptor.js.map} +0 -0
- package/lib/commonjs/rum/instrumentation/{ShallowObjectEqualityChecker.js → interactionTracking/ShallowObjectEqualityChecker.js} +0 -0
- package/lib/commonjs/rum/instrumentation/{ShallowObjectEqualityChecker.js.map → interactionTracking/ShallowObjectEqualityChecker.js.map} +0 -0
- package/lib/commonjs/rum/instrumentation/{getJsxRuntime.js → interactionTracking/getJsxRuntime.js} +0 -0
- package/lib/commonjs/rum/instrumentation/{getJsxRuntime.js.map → interactionTracking/getJsxRuntime.js.map} +0 -0
- package/lib/commonjs/rum/instrumentation/resourceTracking/implementation/DatadogRumResource/ResourceReporter.js +3 -3
- package/lib/commonjs/rum/instrumentation/resourceTracking/implementation/DatadogRumResource/ResourceReporter.js.map +1 -1
- package/lib/commonjs/rum/instrumentation/resourceTracking/implementation/XHRProxy.js +2 -1
- package/lib/commonjs/rum/instrumentation/resourceTracking/implementation/XHRProxy.js.map +1 -1
- package/lib/commonjs/rum/types.js +42 -0
- package/lib/commonjs/rum/types.js.map +1 -0
- package/lib/commonjs/sdk/AttributesSingleton/AttributesSingleton.js +45 -0
- package/lib/commonjs/sdk/AttributesSingleton/AttributesSingleton.js.map +1 -0
- package/lib/commonjs/sdk/AttributesSingleton/types.js +2 -0
- package/lib/commonjs/sdk/AttributesSingleton/types.js.map +1 -0
- package/lib/commonjs/{DatadogProvider → sdk/DatadogProvider}/Buffer/BoundedBuffer.js +4 -4
- package/lib/commonjs/sdk/DatadogProvider/Buffer/BoundedBuffer.js.map +1 -0
- package/lib/commonjs/{DatadogProvider → sdk/DatadogProvider}/Buffer/BufferSingleton.js +0 -0
- package/lib/commonjs/{DatadogProvider → sdk/DatadogProvider}/Buffer/BufferSingleton.js.map +0 -0
- package/lib/commonjs/{DatadogProvider → sdk/DatadogProvider}/Buffer/DatadogBuffer.js +0 -0
- package/lib/commonjs/{DatadogProvider → sdk/DatadogProvider}/Buffer/DatadogBuffer.js.map +0 -0
- package/lib/commonjs/{DatadogProvider → sdk/DatadogProvider}/Buffer/PassThroughBuffer.js +0 -0
- package/lib/commonjs/{DatadogProvider → sdk/DatadogProvider}/Buffer/PassThroughBuffer.js.map +0 -0
- package/lib/commonjs/{DatadogProvider → sdk/DatadogProvider}/Buffer/bufferNativeCall.js +0 -0
- package/lib/commonjs/{DatadogProvider → sdk/DatadogProvider}/Buffer/bufferNativeCall.js.map +0 -0
- package/lib/commonjs/{DatadogProvider → sdk/DatadogProvider}/DatadogProvider.js +4 -4
- package/lib/commonjs/sdk/DatadogProvider/DatadogProvider.js.map +1 -0
- package/lib/commonjs/sdk/EventMappers/EventMapper.js +85 -0
- package/lib/commonjs/sdk/EventMappers/EventMapper.js.map +1 -0
- package/lib/commonjs/sdk/EventMappers/utils/deepClone.js +98 -0
- package/lib/commonjs/sdk/EventMappers/utils/deepClone.js.map +1 -0
- package/lib/commonjs/sdk/UserInfoSingleton/UserInfoSingleton.js +43 -0
- package/lib/commonjs/sdk/UserInfoSingleton/UserInfoSingleton.js.map +1 -0
- package/lib/commonjs/sdk/UserInfoSingleton/types.js +2 -0
- package/lib/commonjs/sdk/UserInfoSingleton/types.js.map +1 -0
- package/lib/commonjs/types.js +1 -26
- package/lib/commonjs/types.js.map +1 -1
- package/lib/commonjs/version.js +1 -1
- package/lib/commonjs/version.js.map +1 -1
- package/lib/module/DdSdkReactNative.js +33 -7
- package/lib/module/DdSdkReactNative.js.map +1 -1
- package/lib/module/DdSdkReactNativeConfiguration.js +42 -2
- package/lib/module/DdSdkReactNativeConfiguration.js.map +1 -1
- package/lib/module/foundation.js +2 -124
- package/lib/module/foundation.js.map +1 -1
- package/lib/module/index.js +5 -3
- package/lib/module/index.js.map +1 -1
- package/lib/module/logs/DdLogs.js +64 -0
- package/lib/module/logs/DdLogs.js.map +1 -0
- package/lib/module/logs/eventMapper.js +20 -0
- package/lib/module/logs/eventMapper.js.map +1 -0
- package/lib/module/logs/types.js +2 -0
- package/lib/module/logs/types.js.map +1 -0
- package/lib/module/nativeModulesTypes.js.map +1 -1
- package/lib/module/rum/DdRum.js +212 -0
- package/lib/module/rum/DdRum.js.map +1 -0
- package/lib/module/rum/eventMappers/actionEventMapper.js +26 -0
- package/lib/module/rum/eventMappers/actionEventMapper.js.map +1 -0
- package/lib/module/rum/eventMappers/errorEventMapper.js +22 -0
- package/lib/module/rum/eventMappers/errorEventMapper.js.map +1 -0
- package/lib/module/rum/eventMappers/resourceEventMapper.js +28 -0
- package/lib/module/rum/eventMappers/resourceEventMapper.js.map +1 -0
- package/lib/module/rum/instrumentation/DdRumErrorTracking.js +2 -2
- package/lib/module/rum/instrumentation/DdRumErrorTracking.js.map +1 -1
- package/lib/module/rum/instrumentation/{DdEventsInterceptor.js → interactionTracking/DdEventsInterceptor.js} +6 -6
- package/lib/module/rum/instrumentation/interactionTracking/DdEventsInterceptor.js.map +1 -0
- package/lib/module/rum/instrumentation/{DdRumUserInteractionTracking.js → interactionTracking/DdRumUserInteractionTracking.js} +13 -4
- package/lib/module/rum/instrumentation/interactionTracking/DdRumUserInteractionTracking.js.map +1 -0
- package/lib/module/rum/instrumentation/{EventsInterceptor.js → interactionTracking/EventsInterceptor.js} +0 -0
- package/lib/module/rum/instrumentation/interactionTracking/EventsInterceptor.js.map +1 -0
- package/lib/module/rum/instrumentation/{NoOpEventsInterceptor.js → interactionTracking/NoOpEventsInterceptor.js} +0 -0
- package/lib/module/rum/instrumentation/{NoOpEventsInterceptor.js.map → interactionTracking/NoOpEventsInterceptor.js.map} +0 -0
- package/lib/module/rum/instrumentation/{ShallowObjectEqualityChecker.js → interactionTracking/ShallowObjectEqualityChecker.js} +0 -0
- package/lib/module/rum/instrumentation/{ShallowObjectEqualityChecker.js.map → interactionTracking/ShallowObjectEqualityChecker.js.map} +0 -0
- package/lib/module/rum/instrumentation/{getJsxRuntime.js → interactionTracking/getJsxRuntime.js} +0 -0
- package/lib/module/rum/instrumentation/{getJsxRuntime.js.map → interactionTracking/getJsxRuntime.js.map} +0 -0
- package/lib/module/rum/instrumentation/resourceTracking/implementation/DatadogRumResource/ResourceReporter.js +2 -2
- package/lib/module/rum/instrumentation/resourceTracking/implementation/DatadogRumResource/ResourceReporter.js.map +1 -1
- package/lib/module/rum/instrumentation/resourceTracking/implementation/XHRProxy.js +2 -1
- package/lib/module/rum/instrumentation/resourceTracking/implementation/XHRProxy.js.map +1 -1
- package/lib/module/rum/types.js +33 -0
- package/lib/module/rum/types.js.map +1 -0
- package/lib/module/sdk/AttributesSingleton/AttributesSingleton.js +36 -0
- package/lib/module/sdk/AttributesSingleton/AttributesSingleton.js.map +1 -0
- package/lib/module/sdk/AttributesSingleton/types.js +2 -0
- package/lib/module/sdk/AttributesSingleton/types.js.map +1 -0
- package/lib/module/{DatadogProvider → sdk/DatadogProvider}/Buffer/BoundedBuffer.js +4 -4
- package/lib/module/sdk/DatadogProvider/Buffer/BoundedBuffer.js.map +1 -0
- package/lib/module/{DatadogProvider → sdk/DatadogProvider}/Buffer/BufferSingleton.js +0 -0
- package/lib/module/{DatadogProvider → sdk/DatadogProvider}/Buffer/BufferSingleton.js.map +0 -0
- package/lib/module/{DatadogProvider → sdk/DatadogProvider}/Buffer/DatadogBuffer.js +0 -0
- package/lib/module/{DatadogProvider → sdk/DatadogProvider}/Buffer/DatadogBuffer.js.map +0 -0
- package/lib/module/{DatadogProvider → sdk/DatadogProvider}/Buffer/PassThroughBuffer.js +0 -0
- package/lib/module/{DatadogProvider → sdk/DatadogProvider}/Buffer/PassThroughBuffer.js.map +0 -0
- package/lib/module/{DatadogProvider → sdk/DatadogProvider}/Buffer/bufferNativeCall.js +0 -0
- package/lib/module/{DatadogProvider → sdk/DatadogProvider}/Buffer/bufferNativeCall.js.map +0 -0
- package/lib/module/{DatadogProvider → sdk/DatadogProvider}/DatadogProvider.js +4 -4
- package/lib/module/sdk/DatadogProvider/DatadogProvider.js.map +1 -0
- package/lib/module/sdk/EventMappers/EventMapper.js +72 -0
- package/lib/module/sdk/EventMappers/EventMapper.js.map +1 -0
- package/lib/module/sdk/EventMappers/utils/deepClone.js +89 -0
- package/lib/module/sdk/EventMappers/utils/deepClone.js.map +1 -0
- package/lib/module/sdk/UserInfoSingleton/UserInfoSingleton.js +34 -0
- package/lib/module/sdk/UserInfoSingleton/UserInfoSingleton.js.map +1 -0
- package/lib/module/sdk/UserInfoSingleton/types.js +2 -0
- package/lib/module/sdk/UserInfoSingleton/types.js.map +1 -0
- package/lib/module/types.js +0 -23
- package/lib/module/types.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 +7 -3
- package/lib/typescript/DdSdkReactNativeConfiguration.d.ts +22 -0
- package/lib/typescript/foundation.d.ts +2 -4
- package/lib/typescript/index.d.ts +5 -3
- package/lib/typescript/logs/DdLogs.d.ts +14 -0
- package/lib/typescript/logs/eventMapper.d.ts +11 -0
- package/lib/typescript/logs/types.d.ts +54 -0
- package/lib/typescript/nativeModulesTypes.d.ts +1 -1
- package/lib/typescript/rum/DdRum.d.ts +36 -0
- package/lib/typescript/rum/eventMappers/actionEventMapper.d.ts +21 -0
- package/lib/typescript/rum/eventMappers/errorEventMapper.d.ts +21 -0
- package/lib/typescript/rum/eventMappers/resourceEventMapper.d.ts +24 -0
- package/lib/typescript/rum/instrumentation/{DdEventsInterceptor.d.ts → interactionTracking/DdEventsInterceptor.d.ts} +0 -0
- package/lib/typescript/rum/instrumentation/{DdRumUserInteractionTracking.d.ts → interactionTracking/DdRumUserInteractionTracking.d.ts} +1 -0
- package/lib/typescript/rum/instrumentation/{EventsInterceptor.d.ts → interactionTracking/EventsInterceptor.d.ts} +0 -0
- package/lib/typescript/rum/instrumentation/{NoOpEventsInterceptor.d.ts → interactionTracking/NoOpEventsInterceptor.d.ts} +0 -0
- package/lib/typescript/rum/instrumentation/{ShallowObjectEqualityChecker.d.ts → interactionTracking/ShallowObjectEqualityChecker.d.ts} +0 -0
- package/lib/typescript/rum/instrumentation/{getJsxRuntime.d.ts → interactionTracking/getJsxRuntime.d.ts} +0 -0
- package/lib/typescript/rum/instrumentation/resourceTracking/domain/interfaces/RumResource.d.ts +2 -1
- package/lib/typescript/rum/instrumentation/resourceTracking/implementation/XHRProxy.d.ts +0 -1
- package/lib/typescript/rum/instrumentation/resourceTracking/implementation/responseSize.d.ts +0 -1
- package/lib/typescript/rum/types.d.ts +110 -0
- package/lib/typescript/sdk/AttributesSingleton/AttributesSingleton.d.ts +12 -0
- package/lib/typescript/sdk/AttributesSingleton/types.d.ts +3 -0
- package/lib/typescript/{DatadogProvider → sdk/DatadogProvider}/Buffer/BoundedBuffer.d.ts +0 -0
- package/lib/typescript/{DatadogProvider → sdk/DatadogProvider}/Buffer/BufferSingleton.d.ts +0 -0
- package/lib/typescript/{DatadogProvider → sdk/DatadogProvider}/Buffer/DatadogBuffer.d.ts +0 -0
- package/lib/typescript/{DatadogProvider → sdk/DatadogProvider}/Buffer/PassThroughBuffer.d.ts +0 -0
- package/lib/typescript/{DatadogProvider → sdk/DatadogProvider}/Buffer/bufferNativeCall.d.ts +0 -0
- package/lib/typescript/{DatadogProvider → sdk/DatadogProvider}/DatadogProvider.d.ts +2 -2
- package/lib/typescript/sdk/EventMappers/EventMapper.d.ts +24 -0
- package/lib/typescript/sdk/EventMappers/utils/deepClone.d.ts +10 -0
- package/lib/typescript/sdk/UserInfoSingleton/UserInfoSingleton.d.ts +12 -0
- package/lib/typescript/sdk/UserInfoSingleton/types.d.ts +6 -0
- package/lib/typescript/types.d.ts +0 -139
- package/lib/typescript/version.d.ts +1 -1
- package/package.json +2 -2
- package/scripts/replace-react-require.js +3 -2
- package/src/DdSdkReactNative.tsx +41 -7
- package/src/DdSdkReactNativeConfiguration.tsx +83 -3
- package/src/__tests__/DdSdkReactNative.test.tsx +244 -13
- package/src/__tests__/DdSdkReactNativeConfiguration.test.ts +29 -7
- package/src/__tests__/{longTasksUtils.ts → longTasksUtils.test.ts} +0 -0
- package/src/__tests__/rum/instrumentation/DdEventsInterceptor.test.tsx +4 -3
- package/src/__tests__/rum/instrumentation/DdRumErrorTracking.test.tsx +3 -2
- package/src/__tests__/rum/instrumentation/DdRumUserInteractionTracking.test.tsx +135 -117
- package/src/__tests__/rum/instrumentation/ShallowObjectEqualityChecker.test.ts +1 -1
- package/src/foundation.tsx +4 -114
- package/src/index.tsx +5 -3
- package/src/logs/DdLogs.ts +67 -0
- package/src/logs/__tests__/DdLogs.test.ts +51 -0
- package/src/logs/__tests__/eventMapper.test.ts +53 -0
- package/src/logs/eventMapper.ts +43 -0
- package/src/logs/types.ts +70 -0
- package/src/nativeModulesTypes.ts +1 -1
- package/src/rum/DdRum.ts +387 -0
- package/src/rum/__tests__/DdRum.test.ts +386 -0
- package/src/rum/eventMappers/actionEventMapper.ts +66 -0
- package/src/rum/eventMappers/errorEventMapper.ts +57 -0
- package/src/rum/eventMappers/resourceEventMapper.ts +74 -0
- package/src/rum/instrumentation/DdRumErrorTracking.tsx +2 -2
- package/src/rum/instrumentation/{DdEventsInterceptor.tsx → interactionTracking/DdEventsInterceptor.tsx} +14 -6
- package/src/rum/instrumentation/{DdRumUserInteractionTracking.tsx → interactionTracking/DdRumUserInteractionTracking.tsx} +12 -4
- package/src/rum/instrumentation/{EventsInterceptor.tsx → interactionTracking/EventsInterceptor.tsx} +0 -0
- package/src/rum/instrumentation/{NoOpEventsInterceptor.tsx → interactionTracking/NoOpEventsInterceptor.tsx} +0 -0
- package/src/rum/instrumentation/{ShallowObjectEqualityChecker.ts → interactionTracking/ShallowObjectEqualityChecker.ts} +0 -0
- package/src/rum/instrumentation/{getJsxRuntime.ts → interactionTracking/getJsxRuntime.ts} +0 -0
- package/src/rum/instrumentation/resourceTracking/__tests__/DdRumResourceTracking.test.ts +3 -2
- package/src/rum/instrumentation/resourceTracking/domain/interfaces/RumResource.ts +2 -1
- package/src/rum/instrumentation/resourceTracking/implementation/DatadogRumResource/ResourceReporter.ts +3 -2
- package/src/rum/instrumentation/resourceTracking/implementation/DatadogRumResource/__tests__/ResourceReporter.test.ts +3 -2
- package/src/rum/instrumentation/resourceTracking/implementation/XHRProxy.ts +2 -1
- package/src/rum/instrumentation/resourceTracking/implementation/__tests__/XHRProxy.test.ts +89 -40
- package/src/rum/types.ts +182 -0
- package/src/sdk/AttributesSingleton/AttributesSingleton.ts +34 -0
- package/src/sdk/AttributesSingleton/__tests__/AttributesSingleton.test.ts +44 -0
- package/src/sdk/AttributesSingleton/types.ts +9 -0
- package/src/{DatadogProvider → sdk/DatadogProvider}/Buffer/BoundedBuffer.ts +4 -4
- package/src/{DatadogProvider → sdk/DatadogProvider}/Buffer/BufferSingleton.ts +0 -0
- package/src/{DatadogProvider → sdk/DatadogProvider}/Buffer/DatadogBuffer.ts +0 -0
- package/src/{DatadogProvider → sdk/DatadogProvider}/Buffer/PassThroughBuffer.ts +0 -0
- package/src/{DatadogProvider → sdk/DatadogProvider}/Buffer/__tests__/BoundedBuffer.test.ts +2 -2
- package/src/{DatadogProvider → sdk/DatadogProvider}/Buffer/__tests__/BufferSingleton.test.ts +2 -1
- package/src/{DatadogProvider → sdk/DatadogProvider}/Buffer/bufferNativeCall.ts +0 -0
- package/src/{DatadogProvider → sdk/DatadogProvider}/DatadogProvider.tsx +5 -5
- package/src/{DatadogProvider → sdk/DatadogProvider}/__tests__/__utils__/renderWithProvider.tsx +2 -2
- package/src/{DatadogProvider → sdk/DatadogProvider}/__tests__/initialization.test.tsx +13 -10
- package/src/{DatadogProvider → sdk/DatadogProvider}/__tests__/initializationModes.test.tsx +10 -6
- package/src/sdk/EventMappers/EventMapper.ts +94 -0
- package/src/sdk/EventMappers/__tests__/EventMapper.test.ts +50 -0
- package/src/sdk/EventMappers/utils/__tests__/deepClone.test.ts +79 -0
- package/src/sdk/EventMappers/utils/deepClone.ts +86 -0
- package/src/sdk/UserInfoSingleton/UserInfoSingleton.ts +31 -0
- package/src/sdk/UserInfoSingleton/__tests__/UserInfoSingleton.test.ts +29 -0
- package/src/sdk/UserInfoSingleton/types.ts +12 -0
- package/src/types.tsx +0 -210
- package/src/version.ts +1 -1
- package/lib/commonjs/DatadogProvider/Buffer/BoundedBuffer.js.map +0 -1
- package/lib/commonjs/DatadogProvider/DatadogProvider.js.map +0 -1
- package/lib/commonjs/rum/instrumentation/DdEventsInterceptor.js.map +0 -1
- package/lib/commonjs/rum/instrumentation/DdRumUserInteractionTracking.js.map +0 -1
- package/lib/module/DatadogProvider/Buffer/BoundedBuffer.js.map +0 -1
- package/lib/module/DatadogProvider/DatadogProvider.js.map +0 -1
- package/lib/module/rum/instrumentation/DdEventsInterceptor.js.map +0 -1
- package/lib/module/rum/instrumentation/DdRumUserInteractionTracking.js.map +0 -1
- package/src/__tests__/DdRumWrapper.test.tsx +0 -74
- package/src/__tests__/foundation.test.ts +0 -88
package/lib/commonjs/types.js
CHANGED
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
Object.defineProperty(exports, "__esModule", {
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
|
-
exports.
|
|
6
|
+
exports.DdSdkConfiguration = void 0;
|
|
7
7
|
|
|
8
8
|
/*
|
|
9
9
|
* Unless explicitly stated otherwise all files in this repository are licensed under the Apache License Version 2.0.
|
|
@@ -38,29 +38,4 @@ class DdSdkConfiguration {
|
|
|
38
38
|
|
|
39
39
|
|
|
40
40
|
exports.DdSdkConfiguration = DdSdkConfiguration;
|
|
41
|
-
|
|
42
|
-
/**
|
|
43
|
-
* Describe the type of a RUM Action.
|
|
44
|
-
*/
|
|
45
|
-
let RumActionType;
|
|
46
|
-
exports.RumActionType = RumActionType;
|
|
47
|
-
|
|
48
|
-
(function (RumActionType) {
|
|
49
|
-
RumActionType["TAP"] = "TAP";
|
|
50
|
-
RumActionType["SCROLL"] = "SCROLL";
|
|
51
|
-
RumActionType["SWIPE"] = "SWIPE";
|
|
52
|
-
RumActionType["BACK"] = "BACK";
|
|
53
|
-
RumActionType["CUSTOM"] = "CUSTOM";
|
|
54
|
-
})(RumActionType || (exports.RumActionType = RumActionType = {}));
|
|
55
|
-
|
|
56
|
-
let ErrorSource;
|
|
57
|
-
exports.ErrorSource = ErrorSource;
|
|
58
|
-
|
|
59
|
-
(function (ErrorSource) {
|
|
60
|
-
ErrorSource["NETWORK"] = "NETWORK";
|
|
61
|
-
ErrorSource["SOURCE"] = "SOURCE";
|
|
62
|
-
ErrorSource["CONSOLE"] = "CONSOLE";
|
|
63
|
-
ErrorSource["WEBVIEW"] = "WEBVIEW";
|
|
64
|
-
ErrorSource["CUSTOM"] = "CUSTOM";
|
|
65
|
-
})(ErrorSource || (exports.ErrorSource = ErrorSource = {}));
|
|
66
41
|
//# sourceMappingURL=types.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["types.tsx"],"names":["DdSdkConfiguration","constructor","clientToken","env","applicationId","nativeCrashReportEnabled","nativeLongTaskThresholdMs","longTaskThresholdMs","sampleRate","site","trackingConsent","additionalConfig","telemetrySampleRate","vitalsUpdateFrequency","configurationForTelemetry","RumActionType","ErrorSource"],"mappings":";;;;;;;AAAA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACO,MAAMA,kBAAN,CAAyB;AAC5BC,EAAAA,WAAW,CACEC,WADF,EAEEC,GAFF,EAGEC,aAHF,EAIEC,wBAJF,EAKEC,yBALF,EAMEC,mBANF,EAOEC,UAPF,EAQEC,IARF,EASEC,eATF,EAUEC,gBAVF,EAWEC,mBAXF,EAYEC,qBAZF,EAaEC,yBAbF,EAmBT;AAAA,SAlBWZ,WAkBX,GAlBWA,WAkBX;AAAA,SAjBWC,GAiBX,GAjBWA,GAiBX;AAAA,SAhBWC,aAgBX,GAhBWA,aAgBX;AAAA,SAfWC,wBAeX,GAfWA,wBAeX;AAAA,SAdWC,yBAcX,GAdWA,yBAcX;AAAA,SAbWC,mBAaX,GAbWA,mBAaX;AAAA,SAZWC,UAYX,GAZWA,UAYX;AAAA,SAXWC,IAWX,GAXWA,IAWX;AAAA,SAVWC,eAUX,GAVWA,eAUX;AAAA,SATWC,gBASX,GATWA,gBASX;AAAA,SARWC,mBAQX,GARWA,mBAQX;AAAA,SAPWC,qBAOX,GAPWA,qBAOX;AAAA,SANWC,yBAMX,GANWA,yBAMX;AAAE;;AApBwB;AAuBhC;AACA;AACA;;;;;AAqOA;AACA;AACA;IACYC,a;;;WAAAA,a;AAAAA,EAAAA,a;AAAAA,EAAAA,a;AAAAA,EAAAA,a;AAAAA,EAAAA,a;AAAAA,EAAAA,a;GAAAA,a,6BAAAA,a;;IA0BAC,W;;;WAAAA,W;AAAAA,EAAAA,W;AAAAA,EAAAA,W;AAAAA,EAAAA,W;AAAAA,EAAAA,W;AAAAA,EAAAA,W;GAAAA,W,2BAAAA,W","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\n/**\n * A configuration object to initialize Datadog's features.\n */\nexport class DdSdkConfiguration {\n constructor(\n readonly clientToken: string,\n readonly env: string,\n readonly applicationId: string,\n readonly nativeCrashReportEnabled: boolean,\n readonly nativeLongTaskThresholdMs: number,\n readonly longTaskThresholdMs: number,\n readonly sampleRate: number,\n readonly site: string,\n readonly trackingConsent: string,\n readonly additionalConfig: object,\n readonly telemetrySampleRate: number,\n readonly vitalsUpdateFrequency: string,\n readonly configurationForTelemetry: {\n initializationType: string;\n trackErrors: boolean;\n trackInteractions: boolean;\n trackNetworkRequests: boolean;\n }\n ) {}\n}\n\n/**\n * The entry point to initialize Datadog's features.\n */\nexport type DdSdkType = {\n /**\n * Initializes Datadog's features.\n * @param configuration: The configuration to use.\n */\n initialize(configuration: DdSdkConfiguration): Promise<void>;\n\n /**\n * Sets the global context (set of attributes) attached with all future Logs, Spans and RUM events.\n * @param attributes: The global context attributes.\n */\n setAttributes(attributes: object): Promise<void>;\n\n /**\n * Set the user information.\n * @param user: The user object (use builtin attributes: 'id', 'email', 'name', and/or any custom attribute).\n */\n setUser(user: object): Promise<void>;\n\n /**\n * Set the tracking consent regarding the data collection.\n * @param trackingConsent: Consent, which can take one of the following values: 'pending', 'granted', 'not_granted'.\n */\n setTrackingConsent(trackingConsent: string): Promise<void>;\n};\n\n/**\n * The entry point to use Datadog's Logs feature.\n */\nexport type DdLogsType = {\n /**\n * Send a log with level debug.\n * @param message: The message to send.\n * @param context: The additional context to send.\n */\n debug(message: string, context?: object): Promise<void>;\n\n /**\n * Send a log with level info.\n * @param message: The message to send.\n * @param context: The additional context to send.\n */\n info(message: string, context?: object): Promise<void>;\n\n /**\n * Send a log with level warn.\n * @param message: The message to send.\n * @param context: The additional context to send.\n */\n warn(message: string, context?: object): Promise<void>;\n\n /**\n * Send a log with level error.\n * @param message: The message to send.\n * @param context: The additional context to send.\n */\n error(message: string, context?: object): Promise<void>;\n};\n\n/**\n * The entry point to use Datadog's Trace feature.\n */\nexport type DdTraceType = {\n /**\n * Start a span, and returns a unique identifier for the span.\n * @param operation: The operation name of the span.\n * @param context: The additional context to send.\n * @param timestampMs: The timestamp when the operation started (in milliseconds). If not provided, current timestamp will be used.\n */\n startSpan(\n operation: string,\n context?: object,\n timestampMs?: number\n ): Promise<string>;\n\n /**\n * Finish a started span.\n * @param spanId: The unique identifier of the span.\n * @param context: The additional context to send.\n * @param timestampMs: The timestamp when the operation stopped (in milliseconds). If not provided, current timestamp will be used.\n */\n finishSpan(\n spanId: string,\n context?: object,\n timestampMs?: number\n ): Promise<void>;\n};\n\n/**\n * The entry point to use Datadog's RUM feature.\n */\nexport type DdRumType = {\n /**\n * Start tracking a RUM View.\n * @param key: The view unique key identifier.\n * @param name: The view name.\n * @param context: The additional context to send.\n * @param timestampMs: The timestamp when the view started (in milliseconds). If not provided, current timestamp will be used.\n */\n startView(\n key: string,\n name: string,\n context?: object,\n timestampMs?: number\n ): Promise<void>;\n\n /**\n * Stop tracking a RUM View.\n * @param key: The view unique key identifier.\n * @param context: The additional context to send.\n * @param timestampMs: The timestamp when the view stopped (in milliseconds). If not provided, current timestamp will be used.\n */\n stopView(\n key: string,\n context?: object,\n timestampMs?: number\n ): Promise<void>;\n\n /**\n * Start tracking a RUM Action.\n * @param type: The action type (tap, scroll, swipe, back, custom).\n * @param name: The action name.\n * @param context: The additional context to send.\n * @param timestampMs: The timestamp when the action started (in milliseconds). If not provided, current timestamp will be used.\n */\n startAction(\n type: RumActionType,\n name: string,\n context?: object,\n timestampMs?: number\n ): Promise<void>;\n\n /**\n * Stop tracking the ongoing RUM Action.\n * @param type: The action type (tap, scroll, swipe, back, custom).\n * @param name: The action name.\n * @param context: The additional context to send.\n * @param timestampMs: The timestamp when the action stopped (in milliseconds). If not provided, current timestamp will be used.\n */\n stopAction(\n type: RumActionType,\n name: string,\n context?: object,\n timestampMs?: number\n ): Promise<void>;\n\n /**\n * Stop tracking the ongoing RUM Action.\n *\n * Warning: using this function signature can lead to inconsistent behaviors on iOS and Android when multiple actions are started in parallel.\n *\n * @deprecated add the `type` and `name` of the action as first two arguments.\n * @param context: The additional context to send.\n * @param timestampMs: The timestamp when the action stopped (in milliseconds). If not provided, current timestamp will be used.\n */\n stopAction(context?: object, timestampMs?: number): Promise<void>;\n\n /**\n * Add a RUM Action.\n * @param type: The action type (tap, scroll, swipe, back, custom).\n * @param name: The action name.\n * @param context: The additional context to send.\n * @param timestampMs: The timestamp when the action occurred (in milliseconds). If not provided, current timestamp will be used.\n */\n addAction(\n type: RumActionType,\n name: string,\n context?: object,\n timestampMs?: number\n ): Promise<void>;\n\n /**\n * Start tracking a RUM Resource.\n * @param key: The resource unique key identifier.\n * @param method: The resource method (GET, POST, …).\n * @param url: The resource url.\n * @param context: The additional context to send.\n * @param timestampMs: The timestamp when the resource started (in milliseconds). If not provided, current timestamp will be used.\n */\n startResource(\n key: string,\n method: string,\n url: string,\n context?: object,\n timestampMs?: number\n ): Promise<void>;\n\n /**\n * Stop tracking a RUM Resource.\n * @param key: The resource unique key identifier.\n * @param statusCode: The resource status code.\n * @param kind: The resource's kind (xhr, document, image, css, font, …).\n * @param size: The resource size in bytes. If size is unknown, use -1.\n * @param context: The additional context to send.\n * @param timestampMs: The timestamp when the resource stopped (in milliseconds). If not provided, current timestamp will be used.\n */\n stopResource(\n key: string,\n statusCode: number,\n kind: ResourceKind,\n size?: number,\n context?: object,\n timestampMs?: number\n ): Promise<void>;\n\n /**\n * Add a RUM Error.\n * @param message: The error message.\n * @param source: The error source (network, source, console, webview, custom).\n * @param stacktrace: The error stacktrace.\n * @param context: The additional context to send.\n * @param timestampMs: The timestamp when the error occurred (in milliseconds). If not provided, current timestamp will be used.\n */\n addError(\n message: string,\n source: ErrorSource,\n stacktrace: string,\n context?: object,\n timestampMs?: number\n ): Promise<void>;\n\n /**\n * Adds a specific timing in the active View. The timing duration will be computed as the difference between the time the View was started and the time this function was called.\n * @param name: The name of the new custom timing attribute. Timings can be nested up to 8 levels deep. Names using more than 8 levels will be sanitized by SDK.\n */\n addTiming(name: string): Promise<void>;\n};\n\n/**\n * Describe the type of a RUM Action.\n */\nexport enum RumActionType {\n /** User tapped on a widget. */\n TAP = 'TAP',\n /** User scrolled a view. */\n SCROLL = 'SCROLL',\n /** User swiped on a view. */\n SWIPE = 'SWIPE',\n /** User pressed hardware back button (Android only). */\n BACK = 'BACK',\n /** A custom action. */\n CUSTOM = 'CUSTOM'\n}\n\nexport type ResourceKind =\n | 'image'\n | 'xhr'\n | 'beacon'\n | 'css'\n | 'document'\n | 'fetch'\n | 'font'\n | 'js'\n | 'media'\n | 'other'\n | 'native';\n\nexport enum ErrorSource {\n NETWORK = 'NETWORK',\n SOURCE = 'SOURCE',\n CONSOLE = 'CONSOLE',\n WEBVIEW = 'WEBVIEW',\n CUSTOM = 'CUSTOM'\n}\n"]}
|
|
1
|
+
{"version":3,"sources":["types.tsx"],"names":["DdSdkConfiguration","constructor","clientToken","env","applicationId","nativeCrashReportEnabled","nativeLongTaskThresholdMs","longTaskThresholdMs","sampleRate","site","trackingConsent","additionalConfig","telemetrySampleRate","vitalsUpdateFrequency","configurationForTelemetry"],"mappings":";;;;;;;AAAA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACO,MAAMA,kBAAN,CAAyB;AAC5BC,EAAAA,WAAW,CACEC,WADF,EAEEC,GAFF,EAGEC,aAHF,EAIEC,wBAJF,EAKEC,yBALF,EAMEC,mBANF,EAOEC,UAPF,EAQEC,IARF,EASEC,eATF,EAUEC,gBAVF,EAWEC,mBAXF,EAYEC,qBAZF,EAaEC,yBAbF,EAmBT;AAAA,SAlBWZ,WAkBX,GAlBWA,WAkBX;AAAA,SAjBWC,GAiBX,GAjBWA,GAiBX;AAAA,SAhBWC,aAgBX,GAhBWA,aAgBX;AAAA,SAfWC,wBAeX,GAfWA,wBAeX;AAAA,SAdWC,yBAcX,GAdWA,yBAcX;AAAA,SAbWC,mBAaX,GAbWA,mBAaX;AAAA,SAZWC,UAYX,GAZWA,UAYX;AAAA,SAXWC,IAWX,GAXWA,IAWX;AAAA,SAVWC,eAUX,GAVWA,eAUX;AAAA,SATWC,gBASX,GATWA,gBASX;AAAA,SARWC,mBAQX,GARWA,mBAQX;AAAA,SAPWC,qBAOX,GAPWA,qBAOX;AAAA,SANWC,yBAMX,GANWA,yBAMX;AAAE;;AApBwB;AAuBhC;AACA;AACA","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\n/**\n * A configuration object to initialize Datadog's features.\n */\nexport class DdSdkConfiguration {\n constructor(\n readonly clientToken: string,\n readonly env: string,\n readonly applicationId: string,\n readonly nativeCrashReportEnabled: boolean,\n readonly nativeLongTaskThresholdMs: number,\n readonly longTaskThresholdMs: number,\n readonly sampleRate: number,\n readonly site: string,\n readonly trackingConsent: string,\n readonly additionalConfig: object,\n readonly telemetrySampleRate: number,\n readonly vitalsUpdateFrequency: string,\n readonly configurationForTelemetry: {\n initializationType: string;\n trackErrors: boolean;\n trackInteractions: boolean;\n trackNetworkRequests: boolean;\n }\n ) {}\n}\n\n/**\n * The entry point to initialize Datadog's features.\n */\nexport type DdSdkType = {\n /**\n * Initializes Datadog's features.\n * @param configuration: The configuration to use.\n */\n initialize(configuration: DdSdkConfiguration): Promise<void>;\n\n /**\n * Sets the global context (set of attributes) attached with all future Logs, Spans and RUM events.\n * @param attributes: The global context attributes.\n */\n setAttributes(attributes: object): Promise<void>;\n\n /**\n * Set the user information.\n * @param user: The user object (use builtin attributes: 'id', 'email', 'name', and/or any custom attribute).\n */\n setUser(user: object): Promise<void>;\n\n /**\n * Set the tracking consent regarding the data collection.\n * @param trackingConsent: Consent, which can take one of the following values: 'pending', 'granted', 'not_granted'.\n */\n setTrackingConsent(trackingConsent: string): Promise<void>;\n};\n\n/**\n * The entry point to use Datadog's Trace feature.\n */\nexport type DdTraceType = {\n /**\n * Start a span, and returns a unique identifier for the span.\n * @param operation: The operation name of the span.\n * @param context: The additional context to send.\n * @param timestampMs: The timestamp when the operation started (in milliseconds). If not provided, current timestamp will be used.\n */\n startSpan(\n operation: string,\n context?: object,\n timestampMs?: number\n ): Promise<string>;\n\n /**\n * Finish a started span.\n * @param spanId: The unique identifier of the span.\n * @param context: The additional context to send.\n * @param timestampMs: The timestamp when the operation stopped (in milliseconds). If not provided, current timestamp will be used.\n */\n finishSpan(\n spanId: string,\n context?: object,\n timestampMs?: number\n ): Promise<void>;\n};\n"]}
|
package/lib/commonjs/version.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["version.ts"],"names":["version"],"mappings":";;;;;;AAAA;AACO,MAAMA,OAAO,GAAG,OAAhB","sourcesContent":["// generated by genversion\nexport const version = '1.
|
|
1
|
+
{"version":3,"sources":["version.ts"],"names":["version"],"mappings":";;;;;;AAAA;AACO,MAAMA,OAAO,GAAG,OAAhB","sourcesContent":["// generated by genversion\nexport const version = '1.3.1';\n"]}
|
|
@@ -6,16 +6,20 @@ function _defineProperty(obj, key, value) { if (key in obj) { Object.definePrope
|
|
|
6
6
|
* Copyright 2016-Present Datadog, Inc.
|
|
7
7
|
*/
|
|
8
8
|
import { InteractionManager } from 'react-native';
|
|
9
|
-
import { BufferSingleton } from './DatadogProvider/Buffer/BufferSingleton';
|
|
10
9
|
import { DdSdkReactNativeConfiguration, buildConfigurationFromPartialConfiguration, addDefaultValuesToAutoInstrumentationConfiguration, InitializationMode } from './DdSdkReactNativeConfiguration';
|
|
11
10
|
import { InternalLog } from './InternalLog';
|
|
12
11
|
import { ProxyType } from './ProxyConfiguration';
|
|
13
12
|
import { SdkVerbosity } from './SdkVerbosity';
|
|
14
13
|
import { DdSdk } from './foundation';
|
|
14
|
+
import { DdLogs } from './logs/DdLogs';
|
|
15
15
|
import { adaptLongTaskThreshold } from './longTasksUtils';
|
|
16
|
+
import { DdRum } from './rum/DdRum';
|
|
16
17
|
import { DdRumErrorTracking } from './rum/instrumentation/DdRumErrorTracking';
|
|
17
|
-
import { DdRumUserInteractionTracking } from './rum/instrumentation/DdRumUserInteractionTracking';
|
|
18
|
+
import { DdRumUserInteractionTracking } from './rum/instrumentation/interactionTracking/DdRumUserInteractionTracking';
|
|
18
19
|
import { DdRumResourceTracking } from './rum/instrumentation/resourceTracking/DdRumResourceTracking';
|
|
20
|
+
import { AttributesSingleton } from './sdk/AttributesSingleton/AttributesSingleton';
|
|
21
|
+
import { BufferSingleton } from './sdk/DatadogProvider/Buffer/BufferSingleton';
|
|
22
|
+
import { UserInfoSingleton } from './sdk/UserInfoSingleton/UserInfoSingleton';
|
|
19
23
|
import { DdSdkConfiguration } from './types';
|
|
20
24
|
import { version as sdkVersion } from './version';
|
|
21
25
|
/**
|
|
@@ -79,14 +83,16 @@ export class DdSdkReactNative {
|
|
|
79
83
|
|
|
80
84
|
|
|
81
85
|
/**
|
|
82
|
-
*
|
|
86
|
+
* Adds a set of attributes to the global context attached with all future Logs, Spans and RUM events.
|
|
87
|
+
* To remove an attribute, set it to `undefined` in a call to `setAttributes`.
|
|
83
88
|
* @param attributes: The global context attributes.
|
|
84
89
|
* @returns a Promise.
|
|
85
90
|
*/
|
|
86
91
|
// eslint-disable-next-line @typescript-eslint/ban-types
|
|
87
|
-
static setAttributes(attributes) {
|
|
92
|
+
static async setAttributes(attributes) {
|
|
88
93
|
InternalLog.log(`Setting attributes ${JSON.stringify(attributes)}`, SdkVerbosity.DEBUG);
|
|
89
|
-
|
|
94
|
+
await DdSdk.setAttributes(attributes);
|
|
95
|
+
AttributesSingleton.getInstance().setAttributes(attributes);
|
|
90
96
|
}
|
|
91
97
|
/**
|
|
92
98
|
* Set the user information.
|
|
@@ -96,9 +102,10 @@ export class DdSdkReactNative {
|
|
|
96
102
|
// eslint-disable-next-line @typescript-eslint/ban-types
|
|
97
103
|
|
|
98
104
|
|
|
99
|
-
static setUser(user) {
|
|
105
|
+
static async setUser(user) {
|
|
100
106
|
InternalLog.log(`Setting user ${JSON.stringify(user)}`, SdkVerbosity.DEBUG);
|
|
101
|
-
|
|
107
|
+
await DdSdk.setUser(user);
|
|
108
|
+
UserInfoSingleton.getInstance().setUserInfo(user);
|
|
102
109
|
}
|
|
103
110
|
/**
|
|
104
111
|
* Set the tracking consent regarding the data collection.
|
|
@@ -133,6 +140,22 @@ export class DdSdkReactNative {
|
|
|
133
140
|
DdRumErrorTracking.startTracking();
|
|
134
141
|
}
|
|
135
142
|
|
|
143
|
+
if (configuration.logEventMapper) {
|
|
144
|
+
DdLogs.registerLogEventMapper(configuration.logEventMapper);
|
|
145
|
+
}
|
|
146
|
+
|
|
147
|
+
if (configuration.errorEventMapper) {
|
|
148
|
+
DdRum.registerErrorEventMapper(configuration.errorEventMapper);
|
|
149
|
+
}
|
|
150
|
+
|
|
151
|
+
if (configuration.resourceEventMapper) {
|
|
152
|
+
DdRum.registerResourceEventMapper(configuration.resourceEventMapper);
|
|
153
|
+
}
|
|
154
|
+
|
|
155
|
+
if (configuration.actionEventMapper) {
|
|
156
|
+
DdRum.registerActionEventMapper(configuration.actionEventMapper);
|
|
157
|
+
}
|
|
158
|
+
|
|
136
159
|
DdSdkReactNative.wasAutoInstrumented = true;
|
|
137
160
|
}
|
|
138
161
|
|
|
@@ -148,6 +171,8 @@ _defineProperty(DdSdkReactNative, "DD_SDK_VERBOSITY_KEY", '_dd.sdk_verbosity');
|
|
|
148
171
|
|
|
149
172
|
_defineProperty(DdSdkReactNative, "DD_NATIVE_VIEW_TRACKING_KEY", '_dd.native_view_tracking');
|
|
150
173
|
|
|
174
|
+
_defineProperty(DdSdkReactNative, "DD_NATIVE_INTERACTION_TRACKING_KEY", '_dd.native_interaction_tracking');
|
|
175
|
+
|
|
151
176
|
_defineProperty(DdSdkReactNative, "DD_VERSION", '_dd.version');
|
|
152
177
|
|
|
153
178
|
_defineProperty(DdSdkReactNative, "DD_VERSION_SUFFIX", '_dd.version_suffix');
|
|
@@ -207,6 +232,7 @@ _defineProperty(DdSdkReactNative, "buildConfiguration", configuration => {
|
|
|
207
232
|
configuration.additionalConfig[DdSdkReactNative.DD_SOURCE_KEY] = 'react-native';
|
|
208
233
|
configuration.additionalConfig[DdSdkReactNative.DD_SDK_VERSION] = sdkVersion;
|
|
209
234
|
configuration.additionalConfig[DdSdkReactNative.DD_NATIVE_VIEW_TRACKING_KEY] = configuration.nativeViewTracking;
|
|
235
|
+
configuration.additionalConfig[DdSdkReactNative.DD_NATIVE_INTERACTION_TRACKING_KEY] = configuration.nativeInteractionTracking;
|
|
210
236
|
|
|
211
237
|
if (configuration.verbosity) {
|
|
212
238
|
configuration.additionalConfig[DdSdkReactNative.DD_SDK_VERBOSITY_KEY] = configuration.verbosity;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["DdSdkReactNative.tsx"],"names":["InteractionManager","BufferSingleton","DdSdkReactNativeConfiguration","buildConfigurationFromPartialConfiguration","addDefaultValuesToAutoInstrumentationConfiguration","InitializationMode","InternalLog","ProxyType","SdkVerbosity","DdSdk","adaptLongTaskThreshold","DdRumErrorTracking","DdRumUserInteractionTracking","DdRumResourceTracking","DdSdkConfiguration","version","sdkVersion","DdSdkReactNative","initialize","configuration","initializeNativeSDK","initializationModeForTelemetry","enableFeatures","_initializeFromDatadogProvider","initializationMode","SYNC","ASYNC","runAfterInteractions","_enableFeaturesFromDatadogProvider","features","setAttributes","attributes","log","JSON","stringify","DEBUG","setUser","user","setTrackingConsent","consent","wasAutoInstrumented","WARN","trackInteractions","startTracking","trackResources","tracingSamplingRate","resourceTracingSamplingRate","firstPartyHosts","trackErrors","params","wasInitialized","__DEV__","telemetryDebug","Promise","resolve","verbosity","buildConfiguration","clientToken","env","applicationId","nativeCrashReportEnabled","nativeLongTaskThresholdMs","longTaskThresholdMs","sampleRate","undefined","sessionSamplingRate","site","trackingConsent","additionalConfig","telemetrySampleRate","vitalsUpdateFrequency","initializationType","trackNetworkRequests","INFO","onInitialization","DD_SOURCE_KEY","DD_SDK_VERSION","DD_NATIVE_VIEW_TRACKING_KEY","nativeViewTracking","DD_SDK_VERBOSITY_KEY","proxyConfig","DD_PROXY_TYPE_KEY","type","DD_PROXY_ADDRESS_KEY","address","DD_PROXY_PORT_KEY","port","username","password","SOCKS","console","warn","DD_PROXY_USERNAME_KEY","DD_PROXY_PASSWORD_KEY","serviceName","DD_SERVICE_NAME","DD_VERSION","versionSuffix","DD_VERSION_SUFFIX"],"mappings":";;AAAA;AACA;AACA;AACA;AACA;AAEA,SAASA,kBAAT,QAAmC,cAAnC;AAEA,SAASC,eAAT,QAAgC,0CAAhC;AACA,SACIC,6BADJ,EAEIC,0CAFJ,EAGIC,kDAHJ,EAIIC,kBAJJ,QAKO,iCALP;AAaA,SAASC,WAAT,QAA4B,eAA5B;AACA,SAASC,SAAT,QAA0B,sBAA1B;AACA,SAASC,YAAT,QAA6B,gBAA7B;AAEA,SAASC,KAAT,QAAsB,cAAtB;AACA,SAASC,sBAAT,QAAuC,kBAAvC;AACA,SAASC,kBAAT,QAAmC,0CAAnC;AACA,SAASC,4BAAT,QAA6C,oDAA7C;AACA,SAASC,qBAAT,QAAsC,8DAAtC;AACA,SAASC,kBAAT,QAAmC,SAAnC;AACA,SAASC,OAAO,IAAIC,UAApB,QAAsC,WAAtC;AAEA;AACA;AACA;;AACA,OAAO,MAAMC,gBAAN,CAAuB;AAU1B;;AAWA;AACJ;AACA;AACA;AACA;AAC2B,eAAVC,UAAU,CACnBC,aADmB,EAEN;AACb,UAAMF,gBAAgB,CAACG,mBAAjB,CAAqCD,aAArC,EAAoD;AACtDE,MAAAA,8BAA8B,EAAE;AADsB,KAApD,CAAN;AAGAJ,IAAAA,gBAAgB,CAACK,cAAjB,CAAgCH,aAAhC;AACH;;AAsDD;AACJ;AACA;AAC+C,eAA9BI,8BAA8B,CACvCJ,aADuC,EAE1B;AACbF,IAAAA,gBAAgB,CAACK,cAAjB,CAAgCH,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,IAAG/E,aAAa,CAAC8E,aAAc,EAFpC;AAGH;;AAED9E,EAAAA,aAAa,CAACiD,gBAAd,CAA+B,uBAA/B,IACIjD,aAAa,CAAC4B,eADlB;AAEH,C","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 { InteractionManager } from 'react-native';\n\nimport { BufferSingleton } from './DatadogProvider/Buffer/BufferSingleton';\nimport {\n DdSdkReactNativeConfiguration,\n buildConfigurationFromPartialConfiguration,\n addDefaultValuesToAutoInstrumentationConfiguration,\n InitializationMode\n} from './DdSdkReactNativeConfiguration';\nimport type {\n AutoInstrumentationParameters,\n DatadogProviderConfiguration,\n PartialInitializationConfiguration,\n AutoInstrumentationConfiguration,\n InitializationModeForTelemetry\n} from './DdSdkReactNativeConfiguration';\nimport { InternalLog } from './InternalLog';\nimport { ProxyType } from './ProxyConfiguration';\nimport { SdkVerbosity } from './SdkVerbosity';\nimport type { TrackingConsent } from './TrackingConsent';\nimport { DdSdk } from './foundation';\nimport { adaptLongTaskThreshold } from './longTasksUtils';\nimport { DdRumErrorTracking } from './rum/instrumentation/DdRumErrorTracking';\nimport { DdRumUserInteractionTracking } from './rum/instrumentation/DdRumUserInteractionTracking';\nimport { DdRumResourceTracking } from './rum/instrumentation/resourceTracking/DdRumResourceTracking';\nimport { DdSdkConfiguration } from './types';\nimport { version as sdkVersion } from './version';\n\n/**\n * This class initializes the Datadog SDK, and sets up communication with the server.\n */\nexport class DdSdkReactNative {\n private static readonly DD_SOURCE_KEY = '_dd.source';\n private static readonly DD_SDK_VERSION = '_dd.sdk_version';\n private static readonly DD_SERVICE_NAME = '_dd.service_name';\n private static readonly DD_SDK_VERBOSITY_KEY = '_dd.sdk_verbosity';\n private static readonly DD_NATIVE_VIEW_TRACKING_KEY =\n '_dd.native_view_tracking';\n private static readonly DD_VERSION = '_dd.version';\n private static readonly DD_VERSION_SUFFIX = '_dd.version_suffix';\n\n // Proxy\n private static readonly DD_PROXY_TYPE_KEY = '_dd.proxy.type';\n private static readonly DD_PROXY_ADDRESS_KEY = '_dd.proxy.address';\n private static readonly DD_PROXY_PORT_KEY = '_dd.proxy.port';\n private static readonly DD_PROXY_USERNAME_KEY = '_dd.proxy.username';\n private static readonly DD_PROXY_PASSWORD_KEY = '_dd.proxy.password';\n\n private static wasInitialized = false;\n private static wasAutoInstrumented = false;\n private static features?: AutoInstrumentationConfiguration;\n\n /**\n * Initializes the Datadog SDK.\n * @param configuration the configuration for the SDK library\n * @returns a Promise.\n */\n static async initialize(\n configuration: DdSdkReactNativeConfiguration\n ): Promise<void> {\n await DdSdkReactNative.initializeNativeSDK(configuration, {\n initializationModeForTelemetry: 'LEGACY'\n });\n DdSdkReactNative.enableFeatures(configuration);\n }\n\n private static initializeNativeSDK = async (\n configuration: DdSdkReactNativeConfiguration,\n params: {\n initializationModeForTelemetry: InitializationModeForTelemetry;\n }\n ): Promise<void> => {\n if (DdSdkReactNative.wasInitialized) {\n InternalLog.log(\n \"Can't initialize Datadog, SDK was already initialized\",\n SdkVerbosity.WARN\n );\n if (!__DEV__) {\n DdSdk.telemetryDebug(\n 'RN SDK was already initialized in javascript'\n );\n }\n return new Promise(resolve => resolve());\n }\n\n InternalLog.verbosity = configuration.verbosity;\n\n DdSdkReactNative.buildConfiguration(configuration);\n\n await DdSdk.initialize(\n new DdSdkConfiguration(\n configuration.clientToken,\n configuration.env,\n configuration.applicationId,\n configuration.nativeCrashReportEnabled,\n adaptLongTaskThreshold(configuration.nativeLongTaskThresholdMs),\n adaptLongTaskThreshold(configuration.longTaskThresholdMs),\n configuration.sampleRate === undefined\n ? configuration.sessionSamplingRate\n : configuration.sampleRate,\n configuration.site,\n configuration.trackingConsent,\n configuration.additionalConfig,\n configuration.telemetrySampleRate,\n configuration.vitalsUpdateFrequency,\n {\n initializationType: params.initializationModeForTelemetry,\n trackErrors: configuration.trackErrors,\n trackInteractions: configuration.trackInteractions,\n trackNetworkRequests: configuration.trackResources\n }\n )\n );\n InternalLog.log('Datadog SDK was initialized', SdkVerbosity.INFO);\n DdSdkReactNative.wasInitialized = true;\n BufferSingleton.onInitialization();\n };\n\n /**\n * FOR INTERNAL USE ONLY.\n */\n static async _initializeFromDatadogProvider(\n configuration: DatadogProviderConfiguration\n ): Promise<void> {\n DdSdkReactNative.enableFeatures(configuration);\n if (configuration.initializationMode === InitializationMode.SYNC) {\n return DdSdkReactNative.initializeNativeSDK(configuration, {\n initializationModeForTelemetry: 'SYNC'\n });\n }\n if (configuration.initializationMode === InitializationMode.ASYNC) {\n return InteractionManager.runAfterInteractions(() => {\n return DdSdkReactNative.initializeNativeSDK(configuration, {\n initializationModeForTelemetry: 'ASYNC'\n });\n });\n }\n // TODO: Remove when DdSdkReactNativeConfiguration is deprecated\n if (configuration instanceof DdSdkReactNativeConfiguration) {\n return DdSdkReactNative.initializeNativeSDK(configuration, {\n initializationModeForTelemetry: 'SYNC'\n });\n }\n }\n\n /**\n * FOR INTERNAL USE ONLY.\n */\n static async _enableFeaturesFromDatadogProvider(\n features: AutoInstrumentationConfiguration\n ): Promise<void> {\n DdSdkReactNative.features = features;\n DdSdkReactNative.enableFeatures(\n addDefaultValuesToAutoInstrumentationConfiguration(features)\n );\n }\n\n /**\n * FOR INTERNAL USE ONLY.\n */\n static _initializeFromDatadogProviderWithConfigurationAsync = async (\n configuration: PartialInitializationConfiguration\n ): Promise<void> => {\n if (!DdSdkReactNative.features) {\n InternalLog.log(\n \"Can't initialize Datadog, make sure the DatadogProvider component is mounted before calling this function\",\n SdkVerbosity.WARN\n );\n return new Promise(resolve => resolve());\n }\n\n return DdSdkReactNative.initializeNativeSDK(\n buildConfigurationFromPartialConfiguration(\n DdSdkReactNative.features,\n configuration\n ),\n { initializationModeForTelemetry: 'PARTIAL' }\n );\n };\n\n /**\n * Sets the global context (set of attributes) attached with all future Logs, Spans and RUM events.\n * @param attributes: The global context attributes.\n * @returns a Promise.\n */\n // eslint-disable-next-line @typescript-eslint/ban-types\n static setAttributes(attributes: object): Promise<void> {\n InternalLog.log(\n `Setting attributes ${JSON.stringify(attributes)}`,\n SdkVerbosity.DEBUG\n );\n return DdSdk.setAttributes(attributes);\n }\n\n /**\n * Set the user information.\n * @param user: The user object (use builtin attributes: 'id', 'email', 'name', and/or any custom attribute).\n * @returns a Promise.\n */\n // eslint-disable-next-line @typescript-eslint/ban-types\n static setUser(user: object): Promise<void> {\n InternalLog.log(\n `Setting user ${JSON.stringify(user)}`,\n SdkVerbosity.DEBUG\n );\n return DdSdk.setUser(user);\n }\n\n /**\n * Set the tracking consent regarding the data collection.\n * @param trackingConsent: One of TrackingConsent values.\n * @returns a Promise.\n */\n static setTrackingConsent(consent: TrackingConsent): Promise<void> {\n InternalLog.log(`Setting consent ${consent}`, SdkVerbosity.DEBUG);\n return DdSdk.setTrackingConsent(consent);\n }\n\n private static buildConfiguration = (\n configuration: DdSdkReactNativeConfiguration\n ) => {\n configuration.additionalConfig[DdSdkReactNative.DD_SOURCE_KEY] =\n 'react-native';\n configuration.additionalConfig[\n DdSdkReactNative.DD_SDK_VERSION\n ] = sdkVersion;\n configuration.additionalConfig[\n DdSdkReactNative.DD_NATIVE_VIEW_TRACKING_KEY\n ] = configuration.nativeViewTracking;\n if (configuration.verbosity) {\n configuration.additionalConfig[\n DdSdkReactNative.DD_SDK_VERBOSITY_KEY\n ] = configuration.verbosity;\n }\n\n if (configuration.proxyConfig) {\n const additionalConfig = configuration.additionalConfig;\n const proxyConfig = configuration.proxyConfig;\n\n additionalConfig[DdSdkReactNative.DD_PROXY_TYPE_KEY] =\n proxyConfig.type;\n additionalConfig[DdSdkReactNative.DD_PROXY_ADDRESS_KEY] =\n proxyConfig.address;\n additionalConfig[DdSdkReactNative.DD_PROXY_PORT_KEY] =\n proxyConfig.port;\n if (proxyConfig.username && proxyConfig.password) {\n if (proxyConfig.type === ProxyType.SOCKS) {\n console.warn(\n \"SOCKS proxy configuration doesn't support Basic authentication.\"\n );\n } else {\n additionalConfig[DdSdkReactNative.DD_PROXY_USERNAME_KEY] =\n proxyConfig.username;\n additionalConfig[DdSdkReactNative.DD_PROXY_PASSWORD_KEY] =\n proxyConfig.password;\n }\n }\n }\n\n if (configuration.serviceName) {\n configuration.additionalConfig[DdSdkReactNative.DD_SERVICE_NAME] =\n configuration.serviceName;\n }\n\n if (configuration.version) {\n configuration.additionalConfig[DdSdkReactNative.DD_VERSION] = `${\n configuration.version\n }${\n configuration.versionSuffix\n ? `-${configuration.versionSuffix}`\n : ''\n }`;\n }\n\n // If both version and version suffix are provided, we merge them into the version field.\n // To avoid adding it in again the native part, we only set it if the version isn't set.\n if (configuration.versionSuffix && !configuration.version) {\n configuration.additionalConfig[\n DdSdkReactNative.DD_VERSION_SUFFIX\n ] = `-${configuration.versionSuffix}`;\n }\n\n configuration.additionalConfig['_dd.first_party_hosts'] =\n configuration.firstPartyHosts;\n };\n\n private static enableFeatures(\n configuration: AutoInstrumentationParameters\n ) {\n if (DdSdkReactNative.wasAutoInstrumented) {\n InternalLog.log(\n \"Can't auto instrument Datadog, SDK was already instrumented\",\n SdkVerbosity.WARN\n );\n return;\n }\n if (configuration.trackInteractions) {\n DdRumUserInteractionTracking.startTracking();\n }\n\n if (configuration.trackResources) {\n DdRumResourceTracking.startTracking({\n tracingSamplingRate: configuration.resourceTracingSamplingRate,\n firstPartyHosts: configuration.firstPartyHosts\n });\n }\n\n if (configuration.trackErrors) {\n DdRumErrorTracking.startTracking();\n }\n DdSdkReactNative.wasAutoInstrumented = true;\n }\n}\n"]}
|
|
1
|
+
{"version":3,"sources":["DdSdkReactNative.tsx"],"names":["InteractionManager","DdSdkReactNativeConfiguration","buildConfigurationFromPartialConfiguration","addDefaultValuesToAutoInstrumentationConfiguration","InitializationMode","InternalLog","ProxyType","SdkVerbosity","DdSdk","DdLogs","adaptLongTaskThreshold","DdRum","DdRumErrorTracking","DdRumUserInteractionTracking","DdRumResourceTracking","AttributesSingleton","BufferSingleton","UserInfoSingleton","DdSdkConfiguration","version","sdkVersion","DdSdkReactNative","initialize","configuration","initializeNativeSDK","initializationModeForTelemetry","enableFeatures","_initializeFromDatadogProvider","initializationMode","SYNC","ASYNC","runAfterInteractions","_enableFeaturesFromDatadogProvider","features","setAttributes","attributes","log","JSON","stringify","DEBUG","getInstance","setUser","user","setUserInfo","setTrackingConsent","consent","wasAutoInstrumented","WARN","trackInteractions","startTracking","trackResources","tracingSamplingRate","resourceTracingSamplingRate","firstPartyHosts","trackErrors","logEventMapper","registerLogEventMapper","errorEventMapper","registerErrorEventMapper","resourceEventMapper","registerResourceEventMapper","actionEventMapper","registerActionEventMapper","params","wasInitialized","__DEV__","telemetryDebug","Promise","resolve","verbosity","buildConfiguration","clientToken","env","applicationId","nativeCrashReportEnabled","nativeLongTaskThresholdMs","longTaskThresholdMs","sampleRate","undefined","sessionSamplingRate","site","trackingConsent","additionalConfig","telemetrySampleRate","vitalsUpdateFrequency","initializationType","trackNetworkRequests","INFO","onInitialization","DD_SOURCE_KEY","DD_SDK_VERSION","DD_NATIVE_VIEW_TRACKING_KEY","nativeViewTracking","DD_NATIVE_INTERACTION_TRACKING_KEY","nativeInteractionTracking","DD_SDK_VERBOSITY_KEY","proxyConfig","DD_PROXY_TYPE_KEY","type","DD_PROXY_ADDRESS_KEY","address","DD_PROXY_PORT_KEY","port","username","password","SOCKS","console","warn","DD_PROXY_USERNAME_KEY","DD_PROXY_PASSWORD_KEY","serviceName","DD_SERVICE_NAME","DD_VERSION","versionSuffix","DD_VERSION_SUFFIX"],"mappings":";;AAAA;AACA;AACA;AACA;AACA;AAEA,SAASA,kBAAT,QAAmC,cAAnC;AAEA,SACIC,6BADJ,EAEIC,0CAFJ,EAGIC,kDAHJ,EAIIC,kBAJJ,QAKO,iCALP;AAaA,SAASC,WAAT,QAA4B,eAA5B;AACA,SAASC,SAAT,QAA0B,sBAA1B;AACA,SAASC,YAAT,QAA6B,gBAA7B;AAEA,SAASC,KAAT,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A+D,GAC3DzF,aAAa,CAACJ,OACjB,GACGI,aAAa,CAAC0F,aAAd,GACO,IAAG1F,aAAa,CAAC0F,aAAc,EADtC,GAEM,EACT,EAND;AAOH,GAxDA,CA0DD;AACA;;;AACA,MAAI1F,aAAa,CAAC0F,aAAd,IAA+B,CAAC1F,aAAa,CAACJ,OAAlD,EAA2D;AACvDI,IAAAA,aAAa,CAAC2D,gBAAd,CACI7D,gBAAgB,CAAC6F,iBADrB,IAEK,IAAG3F,aAAa,CAAC0F,aAAc,EAFpC;AAGH;;AAED1F,EAAAA,aAAa,CAAC2D,gBAAd,CAA+B,uBAA/B,IACI3D,aAAa,CAAC8B,eADlB;AAEH,C","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 { InteractionManager } from 'react-native';\n\nimport {\n DdSdkReactNativeConfiguration,\n buildConfigurationFromPartialConfiguration,\n addDefaultValuesToAutoInstrumentationConfiguration,\n InitializationMode\n} from './DdSdkReactNativeConfiguration';\nimport type {\n AutoInstrumentationParameters,\n DatadogProviderConfiguration,\n PartialInitializationConfiguration,\n AutoInstrumentationConfiguration,\n InitializationModeForTelemetry\n} from './DdSdkReactNativeConfiguration';\nimport { InternalLog } from './InternalLog';\nimport { ProxyType } from './ProxyConfiguration';\nimport { SdkVerbosity } from './SdkVerbosity';\nimport type { TrackingConsent } from './TrackingConsent';\nimport { DdSdk } from './foundation';\nimport { DdLogs } from './logs/DdLogs';\nimport { adaptLongTaskThreshold } from './longTasksUtils';\nimport { DdRum } from './rum/DdRum';\nimport { DdRumErrorTracking } from './rum/instrumentation/DdRumErrorTracking';\nimport { DdRumUserInteractionTracking } from './rum/instrumentation/interactionTracking/DdRumUserInteractionTracking';\nimport { DdRumResourceTracking } from './rum/instrumentation/resourceTracking/DdRumResourceTracking';\nimport { AttributesSingleton } from './sdk/AttributesSingleton/AttributesSingleton';\nimport type { Attributes } from './sdk/AttributesSingleton/types';\nimport { BufferSingleton } from './sdk/DatadogProvider/Buffer/BufferSingleton';\nimport { UserInfoSingleton } from './sdk/UserInfoSingleton/UserInfoSingleton';\nimport type { UserInfo } from './sdk/UserInfoSingleton/types';\nimport { DdSdkConfiguration } from './types';\nimport { version as sdkVersion } from './version';\n\n/**\n * This class initializes the Datadog SDK, and sets up communication with the server.\n */\nexport class DdSdkReactNative {\n private static readonly DD_SOURCE_KEY = '_dd.source';\n private static readonly DD_SDK_VERSION = '_dd.sdk_version';\n private static readonly DD_SERVICE_NAME = '_dd.service_name';\n private static readonly DD_SDK_VERBOSITY_KEY = '_dd.sdk_verbosity';\n private static readonly DD_NATIVE_VIEW_TRACKING_KEY =\n '_dd.native_view_tracking';\n private static readonly DD_NATIVE_INTERACTION_TRACKING_KEY =\n '_dd.native_interaction_tracking';\n private static readonly DD_VERSION = '_dd.version';\n private static readonly DD_VERSION_SUFFIX = '_dd.version_suffix';\n\n // Proxy\n private static readonly DD_PROXY_TYPE_KEY = '_dd.proxy.type';\n private static readonly DD_PROXY_ADDRESS_KEY = '_dd.proxy.address';\n private static readonly DD_PROXY_PORT_KEY = '_dd.proxy.port';\n private static readonly DD_PROXY_USERNAME_KEY = '_dd.proxy.username';\n private static readonly DD_PROXY_PASSWORD_KEY = '_dd.proxy.password';\n\n private static wasInitialized = false;\n private static wasAutoInstrumented = false;\n private static features?: AutoInstrumentationConfiguration;\n\n /**\n * Initializes the Datadog SDK.\n * @param configuration the configuration for the SDK library\n * @returns a Promise.\n */\n static async initialize(\n configuration: DdSdkReactNativeConfiguration\n ): Promise<void> {\n await DdSdkReactNative.initializeNativeSDK(configuration, {\n initializationModeForTelemetry: 'LEGACY'\n });\n DdSdkReactNative.enableFeatures(configuration);\n }\n\n private static initializeNativeSDK = async (\n configuration: DdSdkReactNativeConfiguration,\n params: {\n initializationModeForTelemetry: InitializationModeForTelemetry;\n }\n ): Promise<void> => {\n if (DdSdkReactNative.wasInitialized) {\n InternalLog.log(\n \"Can't initialize Datadog, SDK was already initialized\",\n SdkVerbosity.WARN\n );\n if (!__DEV__) {\n DdSdk.telemetryDebug(\n 'RN SDK was already initialized in javascript'\n );\n }\n return new Promise(resolve => resolve());\n }\n\n InternalLog.verbosity = configuration.verbosity;\n\n DdSdkReactNative.buildConfiguration(configuration);\n\n await DdSdk.initialize(\n new DdSdkConfiguration(\n configuration.clientToken,\n configuration.env,\n configuration.applicationId,\n configuration.nativeCrashReportEnabled,\n adaptLongTaskThreshold(configuration.nativeLongTaskThresholdMs),\n adaptLongTaskThreshold(configuration.longTaskThresholdMs),\n configuration.sampleRate === undefined\n ? configuration.sessionSamplingRate\n : configuration.sampleRate,\n configuration.site,\n configuration.trackingConsent,\n configuration.additionalConfig,\n configuration.telemetrySampleRate,\n configuration.vitalsUpdateFrequency,\n {\n initializationType: params.initializationModeForTelemetry,\n trackErrors: configuration.trackErrors,\n trackInteractions: configuration.trackInteractions,\n trackNetworkRequests: configuration.trackResources\n }\n )\n );\n InternalLog.log('Datadog SDK was initialized', SdkVerbosity.INFO);\n DdSdkReactNative.wasInitialized = true;\n BufferSingleton.onInitialization();\n };\n\n /**\n * FOR INTERNAL USE ONLY.\n */\n static async _initializeFromDatadogProvider(\n configuration: DatadogProviderConfiguration\n ): Promise<void> {\n DdSdkReactNative.enableFeatures(configuration);\n if (configuration.initializationMode === InitializationMode.SYNC) {\n return DdSdkReactNative.initializeNativeSDK(configuration, {\n initializationModeForTelemetry: 'SYNC'\n });\n }\n if (configuration.initializationMode === InitializationMode.ASYNC) {\n return InteractionManager.runAfterInteractions(() => {\n return DdSdkReactNative.initializeNativeSDK(configuration, {\n initializationModeForTelemetry: 'ASYNC'\n });\n });\n }\n // TODO: Remove when DdSdkReactNativeConfiguration is deprecated\n if (configuration instanceof DdSdkReactNativeConfiguration) {\n return DdSdkReactNative.initializeNativeSDK(configuration, {\n initializationModeForTelemetry: 'SYNC'\n });\n }\n }\n\n /**\n * FOR INTERNAL USE ONLY.\n */\n static async _enableFeaturesFromDatadogProvider(\n features: AutoInstrumentationConfiguration\n ): Promise<void> {\n DdSdkReactNative.features = features;\n DdSdkReactNative.enableFeatures(\n addDefaultValuesToAutoInstrumentationConfiguration(features)\n );\n }\n\n /**\n * FOR INTERNAL USE ONLY.\n */\n static _initializeFromDatadogProviderWithConfigurationAsync = async (\n configuration: PartialInitializationConfiguration\n ): Promise<void> => {\n if (!DdSdkReactNative.features) {\n InternalLog.log(\n \"Can't initialize Datadog, make sure the DatadogProvider component is mounted before calling this function\",\n SdkVerbosity.WARN\n );\n return new Promise(resolve => resolve());\n }\n\n return DdSdkReactNative.initializeNativeSDK(\n buildConfigurationFromPartialConfiguration(\n DdSdkReactNative.features,\n configuration\n ),\n { initializationModeForTelemetry: 'PARTIAL' }\n );\n };\n\n /**\n * Adds a set of attributes to the global context attached with all future Logs, Spans and RUM events.\n * To remove an attribute, set it to `undefined` in a call to `setAttributes`.\n * @param attributes: The global context attributes.\n * @returns a Promise.\n */\n // eslint-disable-next-line @typescript-eslint/ban-types\n static async setAttributes(attributes: Attributes): Promise<void> {\n InternalLog.log(\n `Setting attributes ${JSON.stringify(attributes)}`,\n SdkVerbosity.DEBUG\n );\n await DdSdk.setAttributes(attributes);\n AttributesSingleton.getInstance().setAttributes(attributes);\n }\n\n /**\n * Set the user information.\n * @param user: The user object (use builtin attributes: 'id', 'email', 'name', and/or any custom attribute).\n * @returns a Promise.\n */\n // eslint-disable-next-line @typescript-eslint/ban-types\n static async setUser(user: UserInfo): Promise<void> {\n InternalLog.log(\n `Setting user ${JSON.stringify(user)}`,\n SdkVerbosity.DEBUG\n );\n await DdSdk.setUser(user);\n UserInfoSingleton.getInstance().setUserInfo(user);\n }\n\n /**\n * Set the tracking consent regarding the data collection.\n * @param trackingConsent: One of TrackingConsent values.\n * @returns a Promise.\n */\n static setTrackingConsent(consent: TrackingConsent): Promise<void> {\n InternalLog.log(`Setting consent ${consent}`, SdkVerbosity.DEBUG);\n return DdSdk.setTrackingConsent(consent);\n }\n\n private static buildConfiguration = (\n configuration: DdSdkReactNativeConfiguration\n ) => {\n configuration.additionalConfig[DdSdkReactNative.DD_SOURCE_KEY] =\n 'react-native';\n configuration.additionalConfig[\n DdSdkReactNative.DD_SDK_VERSION\n ] = sdkVersion;\n configuration.additionalConfig[\n DdSdkReactNative.DD_NATIVE_VIEW_TRACKING_KEY\n ] = configuration.nativeViewTracking;\n configuration.additionalConfig[\n DdSdkReactNative.DD_NATIVE_INTERACTION_TRACKING_KEY\n ] = configuration.nativeInteractionTracking;\n\n if (configuration.verbosity) {\n configuration.additionalConfig[\n DdSdkReactNative.DD_SDK_VERBOSITY_KEY\n ] = configuration.verbosity;\n }\n\n if (configuration.proxyConfig) {\n const additionalConfig = configuration.additionalConfig;\n const proxyConfig = configuration.proxyConfig;\n\n additionalConfig[DdSdkReactNative.DD_PROXY_TYPE_KEY] =\n proxyConfig.type;\n additionalConfig[DdSdkReactNative.DD_PROXY_ADDRESS_KEY] =\n proxyConfig.address;\n additionalConfig[DdSdkReactNative.DD_PROXY_PORT_KEY] =\n proxyConfig.port;\n if (proxyConfig.username && proxyConfig.password) {\n if (proxyConfig.type === ProxyType.SOCKS) {\n console.warn(\n \"SOCKS proxy configuration doesn't support Basic authentication.\"\n );\n } else {\n additionalConfig[DdSdkReactNative.DD_PROXY_USERNAME_KEY] =\n proxyConfig.username;\n additionalConfig[DdSdkReactNative.DD_PROXY_PASSWORD_KEY] =\n proxyConfig.password;\n }\n }\n }\n\n if (configuration.serviceName) {\n configuration.additionalConfig[DdSdkReactNative.DD_SERVICE_NAME] =\n configuration.serviceName;\n }\n\n if (configuration.version) {\n configuration.additionalConfig[DdSdkReactNative.DD_VERSION] = `${\n configuration.version\n }${\n configuration.versionSuffix\n ? `-${configuration.versionSuffix}`\n : ''\n }`;\n }\n\n // If both version and version suffix are provided, we merge them into the version field.\n // To avoid adding it in again the native part, we only set it if the version isn't set.\n if (configuration.versionSuffix && !configuration.version) {\n configuration.additionalConfig[\n DdSdkReactNative.DD_VERSION_SUFFIX\n ] = `-${configuration.versionSuffix}`;\n }\n\n configuration.additionalConfig['_dd.first_party_hosts'] =\n configuration.firstPartyHosts;\n };\n\n private static enableFeatures(\n configuration: AutoInstrumentationParameters\n ) {\n if (DdSdkReactNative.wasAutoInstrumented) {\n InternalLog.log(\n \"Can't auto instrument Datadog, SDK was already instrumented\",\n SdkVerbosity.WARN\n );\n return;\n }\n if (configuration.trackInteractions) {\n DdRumUserInteractionTracking.startTracking();\n }\n\n if (configuration.trackResources) {\n DdRumResourceTracking.startTracking({\n tracingSamplingRate: configuration.resourceTracingSamplingRate,\n firstPartyHosts: configuration.firstPartyHosts\n });\n }\n\n if (configuration.trackErrors) {\n DdRumErrorTracking.startTracking();\n }\n\n if (configuration.logEventMapper) {\n DdLogs.registerLogEventMapper(configuration.logEventMapper);\n }\n\n if (configuration.errorEventMapper) {\n DdRum.registerErrorEventMapper(configuration.errorEventMapper);\n }\n\n if (configuration.resourceEventMapper) {\n DdRum.registerResourceEventMapper(\n configuration.resourceEventMapper\n );\n }\n\n if (configuration.actionEventMapper) {\n DdRum.registerActionEventMapper(configuration.actionEventMapper);\n }\n\n DdSdkReactNative.wasAutoInstrumented = true;\n }\n}\n"]}
|
|
@@ -23,11 +23,16 @@ const DEFAULTS = {
|
|
|
23
23
|
longTaskThresholdMs: 0,
|
|
24
24
|
nativeLongTaskThresholdMs: 200,
|
|
25
25
|
nativeViewTracking: false,
|
|
26
|
+
nativeInteractionTracking: false,
|
|
26
27
|
getFirstPartyHosts: () => [],
|
|
27
28
|
getAdditionalConfig: () => ({}),
|
|
28
29
|
trackingConsent: TrackingConsent.GRANTED,
|
|
29
30
|
telemetrySampleRate: 20.0,
|
|
30
|
-
vitalsUpdateFrequency: VitalsUpdateFrequency.AVERAGE
|
|
31
|
+
vitalsUpdateFrequency: VitalsUpdateFrequency.AVERAGE,
|
|
32
|
+
logEventMapper: null,
|
|
33
|
+
errorEventMapper: null,
|
|
34
|
+
resourceEventMapper: null,
|
|
35
|
+
actionEventMapper: null
|
|
31
36
|
};
|
|
32
37
|
/**
|
|
33
38
|
* The SDK configuration class.
|
|
@@ -61,6 +66,11 @@ export class DdSdkReactNativeConfiguration {
|
|
|
61
66
|
* Set to `true` if you use a custom navigation system relying on native views.
|
|
62
67
|
*/
|
|
63
68
|
|
|
69
|
+
/**
|
|
70
|
+
* Enables native interaction tracking.
|
|
71
|
+
* Set to `true` if you want to track interactions on native screens.
|
|
72
|
+
*/
|
|
73
|
+
|
|
64
74
|
/**
|
|
65
75
|
* List of your backends hosts to enable tracing with.
|
|
66
76
|
* Regular expressions are NOT supported.
|
|
@@ -144,6 +154,8 @@ export class DdSdkReactNativeConfiguration {
|
|
|
144
154
|
|
|
145
155
|
_defineProperty(this, "nativeViewTracking", DEFAULTS.nativeViewTracking);
|
|
146
156
|
|
|
157
|
+
_defineProperty(this, "nativeInteractionTracking", DEFAULTS.nativeInteractionTracking);
|
|
158
|
+
|
|
147
159
|
_defineProperty(this, "proxyConfig", undefined);
|
|
148
160
|
|
|
149
161
|
_defineProperty(this, "serviceName", undefined);
|
|
@@ -162,6 +174,14 @@ export class DdSdkReactNativeConfiguration {
|
|
|
162
174
|
|
|
163
175
|
_defineProperty(this, "vitalsUpdateFrequency", DEFAULTS.vitalsUpdateFrequency);
|
|
164
176
|
|
|
177
|
+
_defineProperty(this, "logEventMapper", DEFAULTS.logEventMapper);
|
|
178
|
+
|
|
179
|
+
_defineProperty(this, "errorEventMapper", DEFAULTS.errorEventMapper);
|
|
180
|
+
|
|
181
|
+
_defineProperty(this, "resourceEventMapper", DEFAULTS.resourceEventMapper);
|
|
182
|
+
|
|
183
|
+
_defineProperty(this, "actionEventMapper", DEFAULTS.actionEventMapper);
|
|
184
|
+
|
|
165
185
|
_defineProperty(this, "additionalConfig", DEFAULTS.getAdditionalConfig());
|
|
166
186
|
}
|
|
167
187
|
|
|
@@ -178,7 +198,11 @@ export class DdSdkReactNativeConfiguration {
|
|
|
178
198
|
export const addDefaultValuesToAutoInstrumentationConfiguration = features => {
|
|
179
199
|
return { ...features,
|
|
180
200
|
firstPartyHosts: features.firstPartyHosts || DEFAULTS.getFirstPartyHosts(),
|
|
181
|
-
resourceTracingSamplingRate: features.resourceTracingSamplingRate
|
|
201
|
+
resourceTracingSamplingRate: features.resourceTracingSamplingRate === undefined ? DEFAULTS.resourceTracingSamplingRate : features.resourceTracingSamplingRate,
|
|
202
|
+
logEventMapper: features.logEventMapper === undefined ? DEFAULTS.logEventMapper : features.logEventMapper,
|
|
203
|
+
errorEventMapper: features.errorEventMapper === undefined ? DEFAULTS.errorEventMapper : features.errorEventMapper,
|
|
204
|
+
resourceEventMapper: features.resourceEventMapper === undefined ? DEFAULTS.resourceEventMapper : features.resourceEventMapper,
|
|
205
|
+
actionEventMapper: features.actionEventMapper === undefined ? DEFAULTS.actionEventMapper : features.actionEventMapper
|
|
182
206
|
};
|
|
183
207
|
};
|
|
184
208
|
|
|
@@ -210,6 +234,22 @@ export const buildConfigurationFromPartialConfiguration = (features, configurati
|
|
|
210
234
|
name: 'firstPartyHosts',
|
|
211
235
|
value: features.firstPartyHosts
|
|
212
236
|
}, SdkConfiguration);
|
|
237
|
+
setConfigurationAttribute({
|
|
238
|
+
name: 'logEventMapper',
|
|
239
|
+
value: features.logEventMapper
|
|
240
|
+
}, SdkConfiguration);
|
|
241
|
+
setConfigurationAttribute({
|
|
242
|
+
name: 'errorEventMapper',
|
|
243
|
+
value: features.errorEventMapper
|
|
244
|
+
}, SdkConfiguration);
|
|
245
|
+
setConfigurationAttribute({
|
|
246
|
+
name: 'resourceEventMapper',
|
|
247
|
+
value: features.resourceEventMapper
|
|
248
|
+
}, SdkConfiguration);
|
|
249
|
+
setConfigurationAttribute({
|
|
250
|
+
name: 'actionEventMapper',
|
|
251
|
+
value: features.actionEventMapper
|
|
252
|
+
}, SdkConfiguration);
|
|
213
253
|
return SdkConfiguration;
|
|
214
254
|
};
|
|
215
255
|
export class DatadogProviderConfiguration extends DdSdkReactNativeConfiguration {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["DdSdkReactNativeConfiguration.tsx"],"names":["TrackingConsent","VitalsUpdateFrequency","DEFAULTS","nativeCrashReportEnabled","sessionSamplingRate","resourceTracingSamplingRate","site","longTaskThresholdMs","nativeLongTaskThresholdMs","nativeViewTracking","getFirstPartyHosts","getAdditionalConfig","trackingConsent","GRANTED","telemetrySampleRate","vitalsUpdateFrequency","AVERAGE","DdSdkReactNativeConfiguration","constructor","clientToken","env","applicationId","trackInteractions","trackResources","trackErrors","undefined","addDefaultValuesToAutoInstrumentationConfiguration","features","firstPartyHosts","setConfigurationAttribute","attribute","configuration","value","name","buildConfigurationFromPartialConfiguration","remainingConfiguration","SdkConfiguration","Object","keys","forEach","DatadogProviderConfiguration","InitializationMode","SYNC"],"mappings":";;AAAA;AACA;AACA;AACA;AACA;AAIA,SAASA,eAAT,QAAgC,mBAAhC;AAEA,WAAYC,qBAAZ;;WAAYA,qB;AAAAA,EAAAA,qB;AAAAA,EAAAA,qB;AAAAA,EAAAA,qB;AAAAA,EAAAA,qB;GAAAA,qB,KAAAA,qB;;AAOZ,MAAMC,QAAQ,GAAG;AACbC,EAAAA,wBAAwB,EAAE,KADb;AAEbC,EAAAA,mBAAmB,EAAE,KAFR;AAGbC,EAAAA,2BAA2B,EAAE,IAHhB;AAIbC,EAAAA,IAAI,EAAE,KAJO;AAKbC,EAAAA,mBAAmB,EAAE,CALR;AAMbC,EAAAA,yBAAyB,EAAE,GANd;AAObC,EAAAA,kBAAkB,EAAE,KAPP;AAQbC,EAAAA,kBAAkB,EAAE,MAAM,EARb;AASbC,EAAAA,mBAAmB,EAAE,OAAO,EAAP,CATR;AAUbC,EAAAA,eAAe,EAAEZ,eAAe,CAACa,OAVpB;AAWbC,EAAAA,mBAAmB,EAAE,IAXR;AAYbC,EAAAA,qBAAqB,EAAEd,qBAAqB,CAACe;AAZhC,CAAjB;AAeA;A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K,EAAEG,sBAAsB,CAACF,IAAD,CAA/B;AAAuCA,MAAAA;AAAvC,KADqB,EAErBG,gBAFqB,CAAzB;AAIH,GAPD;AASAP,EAAAA,yBAAyB,CACrB;AACII,IAAAA,IAAI,EAAE,6BADV;AAEID,IAAAA,KAAK,EAAEL,QAAQ,CAACtB;AAFpB,GADqB,EAKrB+B,gBALqB,CAAzB;AAOAP,EAAAA,yBAAyB,CACrB;AAAEI,IAAAA,IAAI,EAAE,iBAAR;AAA2BD,IAAAA,KAAK,EAAEL,QAAQ,CAACC;AAA3C,GADqB,EAErBQ,gBAFqB,CAAzB;AAKA,SAAOA,gBAAP;AACH,CA1CM;AA4CP,OAAO,MAAMI,4BAAN,SAA2CvB,6BAA3C,CAAyE;AAAA;AAAA;;AAAA,gDAC5BwB,kBAAkB,CAACC,IADS;AAAA;;AAAA;AAIhF,WAAYD,kBAAZ;;WAAYA,kB;AAAAA,EAAAA,kB;AAAAA,EAAAA,kB;GAAAA,kB,KAAAA,kB","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 { ProxyConfiguration } from './ProxyConfiguration';\nimport type { SdkVerbosity } from './SdkVerbosity';\nimport { TrackingConsent } from './TrackingConsent';\n\nexport enum VitalsUpdateFrequency {\n FREQUENT = 'FREQUENT',\n AVERAGE = 'AVERAGE',\n RARE = 'RARE',\n NEVER = 'NEVER'\n}\n\nconst DEFAULTS = {\n nativeCrashReportEnabled: false,\n sessionSamplingRate: 100.0,\n resourceTracingSamplingRate: 20.0,\n site: 'US1',\n longTaskThresholdMs: 0,\n nativeLongTaskThresholdMs: 200,\n nativeViewTracking: false,\n getFirstPartyHosts: () => [],\n getAdditionalConfig: () => ({}),\n trackingConsent: TrackingConsent.GRANTED,\n telemetrySampleRate: 20.0,\n vitalsUpdateFrequency: VitalsUpdateFrequency.AVERAGE\n};\n\n/**\n * The SDK configuration class.\n * It will be used to configure the SDK functionality at initialization.\n */\nexport class DdSdkReactNativeConfiguration {\n /**\n * Enables crash reporting for native plaforms (iOS, Android). Default `false`.\n */\n public nativeCrashReportEnabled: boolean =\n DEFAULTS.nativeCrashReportEnabled;\n /**\n * @deprecated `sampleRate` has been replaced by `sessionSamplingRate` to avoid confusion with `resourceTracingSamplingRate` and will be removed in a future release.\n */\n public sampleRate?: number;\n /**\n * Percentage of sampled RUM sessions. Range `0`-`100`.\n */\n public sessionSamplingRate: number = DEFAULTS.sessionSamplingRate;\n /**\n * Percentage of tracing integrations for network calls between your app and your backend. Range `0`-`100`.\n */\n public resourceTracingSamplingRate: number =\n DEFAULTS.resourceTracingSamplingRate;\n public site: string = DEFAULTS.site;\n /**\n * Verbosity for internal SDK logging.\n * Set to `SdkVerbosity.DEBUG` to debug your SDK implementation.\n */\n public verbosity: SdkVerbosity | undefined = undefined;\n /**\n * Enables native views tracking.\n * Set to `true` if you use a custom navigation system relying on native views.\n */\n public nativeViewTracking: boolean = DEFAULTS.nativeViewTracking;\n public proxyConfig?: ProxyConfiguration = undefined;\n public serviceName?: string = undefined;\n /**\n * List of your backends hosts to enable tracing with.\n * Regular expressions are NOT supported.\n *\n * Matches domains and subdomains, e.g. `['example.com']` matches `example.com` and `api.example.com`.\n */\n public firstPartyHosts: string[] = DEFAULTS.getFirstPartyHosts();\n /**\n * Overrides the reported version of the app.\n * Accepted characters are alphanumerics and `_`, `-`, `:`, `.`, `/`.\n * Other special characters are converted to underscores.\n *\n * See https://docs.datadoghq.com/getting_started/tagging/#define-tags for more information on the format.\n *\n * Make sure you set it correctly, as it will have to match the one specified during the upload of your source maps and other mapping files.\n */\n public version?: string;\n /**\n * Add a suffix to the reported version of the app.\n * Accepted characters are alphanumerics and `_`, `-`, `:`, `.`, `/`.\n * Other special characters are converted to underscores.\n *\n * See https://docs.datadoghq.com/getting_started/tagging/#define-tags for more information on the format.\n *\n * A dash (`-`) will be automatically added between the version and the suffix\n */\n public versionSuffix?: string;\n\n /**\n * The sampling rate for Internal Telemetry (info related to the work of the\n * SDK internals).\n *\n * The sampling rate must be a value between 0 and 100. A value of 0 means no\n * telemetry will be sent, 100 means all telemetry will be sent. When\n * `telemetrySampleRate` is not set, the default value from the iOS and\n * Android SDK is used, which is 20.\n */\n public telemetrySampleRate: number = DEFAULTS.telemetrySampleRate;\n\n /**\n * The threshold for native long tasks reporting in milliseconds.\n *\n * - Setting it to `0` or `false` disables native long task reporting.\n * - Values below `100` will be raised to `100`.\n * - Values above `5000` will be lowered to `5000`.\n *\n * Default value is `200`.\n */\n public nativeLongTaskThresholdMs: number | false =\n DEFAULTS.nativeLongTaskThresholdMs;\n\n /**\n * The threshold for javascript long tasks reporting in milliseconds.\n *\n * - Setting it to `0` or `false` disables javascript long task reporting.\n * - Values below `100` will be raised to `100`.\n * - Values above `5000` will be lowered to `5000`.\n *\n * Default value is `0`\n */\n public longTaskThresholdMs: number | false = DEFAULTS.longTaskThresholdMs;\n\n /**\n * Sets the preferred frequency for collecting mobile vitals.\n */\n public vitalsUpdateFrequency: VitalsUpdateFrequency =\n DEFAULTS.vitalsUpdateFrequency;\n\n public additionalConfig: {\n [k: string]: any;\n } = DEFAULTS.getAdditionalConfig();\n\n constructor(\n readonly clientToken: string,\n readonly env: string,\n readonly applicationId: string,\n readonly trackInteractions: boolean = false,\n readonly trackResources: boolean = false,\n readonly trackErrors: boolean = false,\n readonly trackingConsent: TrackingConsent = DEFAULTS.trackingConsent\n ) {}\n}\n\n/**\n * Auto Instrumentation configuration passed to DatadogProvider.\n * Does not include default values.\n */\nexport type AutoInstrumentationConfiguration = {\n readonly trackInteractions: boolean;\n readonly trackResources: boolean;\n readonly firstPartyHosts?: string[];\n readonly resourceTracingSamplingRate?: number;\n readonly trackErrors: boolean;\n};\n\n/**\n * Parameters needed to start auto instrumentation. Includes default values.\n */\nexport type AutoInstrumentationParameters = {\n readonly trackInteractions: boolean;\n readonly trackResources: boolean;\n readonly firstPartyHosts: string[];\n readonly resourceTracingSamplingRate: number;\n readonly trackErrors: boolean;\n};\n\n/**\n * We could use `Proxy` instead of this function, but `Proxy` is not available on\n * the older android jsc that can still be used.\n */\nexport const addDefaultValuesToAutoInstrumentationConfiguration = (\n features: AutoInstrumentationConfiguration\n): AutoInstrumentationParameters => {\n return {\n ...features,\n firstPartyHosts:\n features.firstPartyHosts || DEFAULTS.getFirstPartyHosts(),\n resourceTracingSamplingRate:\n features.resourceTracingSamplingRate ||\n DEFAULTS.resourceTracingSamplingRate\n };\n};\n\nexport type PartialInitializationConfiguration = {\n readonly clientToken: string;\n readonly env: string;\n readonly applicationId: string;\n readonly sessionSamplingRate?: number;\n readonly site?: string;\n readonly verbosity?: SdkVerbosity | undefined;\n readonly nativeViewTracking?: boolean;\n readonly proxyConfig?: ProxyConfiguration;\n readonly serviceName?: string;\n readonly version?: string;\n versionSuffix?: string;\n readonly additionalConfig?: { [k: string]: any };\n readonly trackingConsent?: TrackingConsent;\n readonly longTaskThresholdMs?: number | false;\n readonly nativeLongTaskThresholdMs?: number | false;\n readonly nativeCrashReportEnabled?: boolean;\n readonly telemetrySampleRate?: number;\n readonly vitalsUpdateFrequency?: VitalsUpdateFrequency;\n};\n\nconst setConfigurationAttribute = <\n AttributeName extends keyof DdSdkReactNativeConfiguration\n>(\n attribute: {\n value?: DdSdkReactNativeConfiguration[AttributeName];\n name: AttributeName;\n },\n configuration: DdSdkReactNativeConfiguration\n) => {\n if (attribute.value !== undefined) {\n configuration[attribute.name] = attribute.value;\n }\n};\n\nexport const buildConfigurationFromPartialConfiguration = (\n features: AutoInstrumentationConfiguration,\n configuration: PartialInitializationConfiguration\n): DdSdkReactNativeConfiguration => {\n const {\n clientToken,\n env,\n applicationId,\n ...remainingConfiguration\n } = configuration;\n const SdkConfiguration = new DdSdkReactNativeConfiguration(\n clientToken,\n env,\n applicationId,\n features.trackInteractions,\n features.trackResources,\n features.trackErrors,\n configuration.trackingConsent\n );\n\n (Object.keys(\n remainingConfiguration\n ) as (keyof typeof remainingConfiguration)[]).forEach(name => {\n setConfigurationAttribute(\n { value: remainingConfiguration[name], name },\n SdkConfiguration\n );\n });\n\n setConfigurationAttribute(\n {\n name: 'resourceTracingSamplingRate',\n value: features.resourceTracingSamplingRate\n },\n SdkConfiguration\n );\n setConfigurationAttribute(\n { name: 'firstPartyHosts', value: features.firstPartyHosts },\n SdkConfiguration\n );\n\n return SdkConfiguration;\n};\n\nexport class DatadogProviderConfiguration extends DdSdkReactNativeConfiguration {\n public initializationMode: InitializationMode = InitializationMode.SYNC;\n}\n\nexport enum InitializationMode {\n SYNC = 'SYNC',\n ASYNC = 'ASYNC'\n}\n\nexport type InitializationModeForTelemetry =\n | 'LEGACY'\n | 'SYNC'\n | 'ASYNC'\n | 'PARTIAL';\n"]}
|
|
1
|
+
{"version":3,"sources":["DdSdkReactNativeConfiguration.tsx"],"names":["TrackingConsent","VitalsUpdateFrequency","DEFAULTS","nativeCrashReportEnabled","sessionSamplingRate","resourceTracingSamplingRate","site","longTaskThresholdMs","nativeLongTaskThresholdMs","nativeViewTracking","nativeInteractionTracking","getFirstPartyHosts","getAdditionalConfig","trackingConsent","GRANTED","telemetrySampleRate","vitalsUpdateFrequency","AVERAGE","logEventMapper","errorEventMapper","resourceEventMapper","actionEventMapper","DdSdkReactNativeConfiguration","constructor","clientToken","env","applicationId","trackInteractions","trackResources","trackErrors","undefined","addDefaultValuesToAutoInstrumentationConfiguration","features","firstPartyHosts","setConfigurationAttribute","attribute","configuration","value","name","buildConfigurationFromPartialConfiguration","remainingConfiguration","SdkConfiguration","Object","keys","forEach","DatadogProviderConfiguration","InitializationMode","SYNC"],"mappings":";;AAAA;AACA;AACA;AACA;AACA;AAIA,SAASA,eAAT,QAAgC,mBAAhC;AAMA,WAAYC,qBAAZ;;WAAYA,qB;AAAAA,EAAAA,qB;AAAAA,EAAAA,qB;AAAAA,EAAAA,qB;AAAAA,EAAAA,qB;GAAAA,qB,KAAAA,qB;;AAOZ,MAAMC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kBAAkB,CAACC,IADS;AAAA;;AAAA;AAIhF,WAAYD,kBAAZ;;WAAYA,kB;AAAAA,EAAAA,kB;AAAAA,EAAAA,kB;GAAAA,kB,KAAAA,kB","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 { ProxyConfiguration } from './ProxyConfiguration';\nimport type { SdkVerbosity } from './SdkVerbosity';\nimport { TrackingConsent } from './TrackingConsent';\nimport type { LogEventMapper } from './logs/types';\nimport type { ActionEventMapper } from './rum/eventMappers/actionEventMapper';\nimport type { ErrorEventMapper } from './rum/eventMappers/errorEventMapper';\nimport type { ResourceEventMapper } from './rum/eventMappers/resourceEventMapper';\n\nexport enum VitalsUpdateFrequency {\n FREQUENT = 'FREQUENT',\n AVERAGE = 'AVERAGE',\n RARE = 'RARE',\n NEVER = 'NEVER'\n}\n\nconst DEFAULTS = {\n nativeCrashReportEnabled: false,\n sessionSamplingRate: 100.0,\n resourceTracingSamplingRate: 20.0,\n site: 'US1',\n longTaskThresholdMs: 0,\n nativeLongTaskThresholdMs: 200,\n nativeViewTracking: false,\n nativeInteractionTracking: false,\n getFirstPartyHosts: () => [],\n getAdditionalConfig: () => ({}),\n trackingConsent: TrackingConsent.GRANTED,\n telemetrySampleRate: 20.0,\n vitalsUpdateFrequency: VitalsUpdateFrequency.AVERAGE,\n logEventMapper: null,\n errorEventMapper: null,\n resourceEventMapper: null,\n actionEventMapper: null\n};\n\n/**\n * The SDK configuration class.\n * It will be used to configure the SDK functionality at initialization.\n */\nexport class DdSdkReactNativeConfiguration {\n /**\n * Enables crash reporting for native plaforms (iOS, Android). Default `false`.\n */\n public nativeCrashReportEnabled: boolean =\n DEFAULTS.nativeCrashReportEnabled;\n /**\n * @deprecated `sampleRate` has been replaced by `sessionSamplingRate` to avoid confusion with `resourceTracingSamplingRate` and will be removed in a future release.\n */\n public sampleRate?: number;\n /**\n * Percentage of sampled RUM sessions. Range `0`-`100`.\n */\n public sessionSamplingRate: number = DEFAULTS.sessionSamplingRate;\n /**\n * Percentage of tracing integrations for network calls between your app and your backend. Range `0`-`100`.\n */\n public resourceTracingSamplingRate: number =\n DEFAULTS.resourceTracingSamplingRate;\n public site: string = DEFAULTS.site;\n /**\n * Verbosity for internal SDK logging.\n * Set to `SdkVerbosity.DEBUG` to debug your SDK implementation.\n */\n public verbosity: SdkVerbosity | undefined = undefined;\n /**\n * Enables native views tracking.\n * Set to `true` if you use a custom navigation system relying on native views.\n */\n public nativeViewTracking: boolean = DEFAULTS.nativeViewTracking;\n /**\n * Enables native interaction tracking.\n * Set to `true` if you want to track interactions on native screens.\n */\n public nativeInteractionTracking: boolean =\n DEFAULTS.nativeInteractionTracking;\n public proxyConfig?: ProxyConfiguration = undefined;\n public serviceName?: string = undefined;\n /**\n * List of your backends hosts to enable tracing with.\n * Regular expressions are NOT supported.\n *\n * Matches domains and subdomains, e.g. `['example.com']` matches `example.com` and `api.example.com`.\n */\n public firstPartyHosts: string[] = DEFAULTS.getFirstPartyHosts();\n /**\n * Overrides the reported version of the app.\n * Accepted characters are alphanumerics and `_`, `-`, `:`, `.`, `/`.\n * Other special characters are converted to underscores.\n *\n * See https://docs.datadoghq.com/getting_started/tagging/#define-tags for more information on the format.\n *\n * Make sure you set it correctly, as it will have to match the one specified during the upload of your source maps and other mapping files.\n */\n public version?: string;\n /**\n * Add a suffix to the reported version of the app.\n * Accepted characters are alphanumerics and `_`, `-`, `:`, `.`, `/`.\n * Other special characters are converted to underscores.\n *\n * See https://docs.datadoghq.com/getting_started/tagging/#define-tags for more information on the format.\n *\n * A dash (`-`) will be automatically added between the version and the suffix\n */\n public versionSuffix?: string;\n\n /**\n * The sampling rate for Internal Telemetry (info related to the work of the\n * SDK internals).\n *\n * The sampling rate must be a value between 0 and 100. A value of 0 means no\n * telemetry will be sent, 100 means all telemetry will be sent. When\n * `telemetrySampleRate` is not set, the default value from the iOS and\n * Android SDK is used, which is 20.\n */\n public telemetrySampleRate: number = DEFAULTS.telemetrySampleRate;\n\n /**\n * The threshold for native long tasks reporting in milliseconds.\n *\n * - Setting it to `0` or `false` disables native long task reporting.\n * - Values below `100` will be raised to `100`.\n * - Values above `5000` will be lowered to `5000`.\n *\n * Default value is `200`.\n */\n public nativeLongTaskThresholdMs: number | false =\n DEFAULTS.nativeLongTaskThresholdMs;\n\n /**\n * The threshold for javascript long tasks reporting in milliseconds.\n *\n * - Setting it to `0` or `false` disables javascript long task reporting.\n * - Values below `100` will be raised to `100`.\n * - Values above `5000` will be lowered to `5000`.\n *\n * Default value is `0`\n */\n public longTaskThresholdMs: number | false = DEFAULTS.longTaskThresholdMs;\n\n /**\n * Sets the preferred frequency for collecting mobile vitals.\n */\n public vitalsUpdateFrequency: VitalsUpdateFrequency =\n DEFAULTS.vitalsUpdateFrequency;\n\n public logEventMapper: LogEventMapper | null = DEFAULTS.logEventMapper;\n\n public errorEventMapper: ErrorEventMapper | null =\n DEFAULTS.errorEventMapper;\n\n public resourceEventMapper: ResourceEventMapper | null =\n DEFAULTS.resourceEventMapper;\n\n public actionEventMapper: ActionEventMapper | null =\n DEFAULTS.actionEventMapper;\n\n public additionalConfig: {\n [k: string]: any;\n } = DEFAULTS.getAdditionalConfig();\n\n constructor(\n readonly clientToken: string,\n readonly env: string,\n readonly applicationId: string,\n readonly trackInteractions: boolean = false,\n readonly trackResources: boolean = false,\n readonly trackErrors: boolean = false,\n readonly trackingConsent: TrackingConsent = DEFAULTS.trackingConsent\n ) {}\n}\n\n/**\n * Auto Instrumentation configuration passed to DatadogProvider.\n * Does not include default values.\n */\nexport type AutoInstrumentationConfiguration = {\n readonly trackInteractions: boolean;\n readonly trackResources: boolean;\n readonly firstPartyHosts?: string[];\n readonly resourceTracingSamplingRate?: number;\n readonly trackErrors: boolean;\n readonly logEventMapper?: LogEventMapper | null;\n readonly errorEventMapper?: ErrorEventMapper | null;\n readonly resourceEventMapper?: ResourceEventMapper | null;\n readonly actionEventMapper?: ActionEventMapper | null;\n};\n\n/**\n * Parameters needed to start auto instrumentation. Includes default values.\n */\nexport type AutoInstrumentationParameters = {\n readonly trackInteractions: boolean;\n readonly trackResources: boolean;\n readonly firstPartyHosts: string[];\n readonly resourceTracingSamplingRate: number;\n readonly trackErrors: boolean;\n readonly logEventMapper: LogEventMapper | null;\n readonly errorEventMapper: ErrorEventMapper | null;\n readonly resourceEventMapper: ResourceEventMapper | null;\n readonly actionEventMapper: ActionEventMapper | null;\n};\n\n/**\n * We could use `Proxy` instead of this function, but `Proxy` is not available on\n * the older android jsc that can still be used.\n */\nexport const addDefaultValuesToAutoInstrumentationConfiguration = (\n features: AutoInstrumentationConfiguration\n): AutoInstrumentationParameters => {\n return {\n ...features,\n firstPartyHosts:\n features.firstPartyHosts || DEFAULTS.getFirstPartyHosts(),\n resourceTracingSamplingRate:\n features.resourceTracingSamplingRate === undefined\n ? DEFAULTS.resourceTracingSamplingRate\n : features.resourceTracingSamplingRate,\n logEventMapper:\n features.logEventMapper === undefined\n ? DEFAULTS.logEventMapper\n : features.logEventMapper,\n errorEventMapper:\n features.errorEventMapper === undefined\n ? DEFAULTS.errorEventMapper\n : features.errorEventMapper,\n resourceEventMapper:\n features.resourceEventMapper === undefined\n ? DEFAULTS.resourceEventMapper\n : features.resourceEventMapper,\n actionEventMapper:\n features.actionEventMapper === undefined\n ? DEFAULTS.actionEventMapper\n : features.actionEventMapper\n };\n};\n\nexport type PartialInitializationConfiguration = {\n readonly clientToken: string;\n readonly env: string;\n readonly applicationId: string;\n readonly sessionSamplingRate?: number;\n readonly site?: string;\n readonly verbosity?: SdkVerbosity | undefined;\n readonly nativeViewTracking?: boolean;\n readonly nativeInteractionTracking?: boolean;\n readonly proxyConfig?: ProxyConfiguration;\n readonly serviceName?: string;\n readonly version?: string;\n versionSuffix?: string;\n readonly additionalConfig?: { [k: string]: any };\n readonly trackingConsent?: TrackingConsent;\n readonly longTaskThresholdMs?: number | false;\n readonly nativeLongTaskThresholdMs?: number | false;\n readonly nativeCrashReportEnabled?: boolean;\n readonly telemetrySampleRate?: number;\n readonly vitalsUpdateFrequency?: VitalsUpdateFrequency;\n};\n\nconst setConfigurationAttribute = <\n AttributeName extends keyof DdSdkReactNativeConfiguration\n>(\n attribute: {\n value?: DdSdkReactNativeConfiguration[AttributeName];\n name: AttributeName;\n },\n configuration: DdSdkReactNativeConfiguration\n) => {\n if (attribute.value !== undefined) {\n configuration[attribute.name] = attribute.value;\n }\n};\n\nexport const buildConfigurationFromPartialConfiguration = (\n features: AutoInstrumentationConfiguration,\n configuration: PartialInitializationConfiguration\n): DdSdkReactNativeConfiguration => {\n const {\n clientToken,\n env,\n applicationId,\n ...remainingConfiguration\n } = configuration;\n const SdkConfiguration = new DdSdkReactNativeConfiguration(\n clientToken,\n env,\n applicationId,\n features.trackInteractions,\n features.trackResources,\n features.trackErrors,\n configuration.trackingConsent\n );\n\n (Object.keys(\n remainingConfiguration\n ) as (keyof typeof remainingConfiguration)[]).forEach(name => {\n setConfigurationAttribute(\n { value: remainingConfiguration[name], name },\n SdkConfiguration\n );\n });\n\n setConfigurationAttribute(\n {\n name: 'resourceTracingSamplingRate',\n value: features.resourceTracingSamplingRate\n },\n SdkConfiguration\n );\n setConfigurationAttribute(\n { name: 'firstPartyHosts', value: features.firstPartyHosts },\n SdkConfiguration\n );\n setConfigurationAttribute(\n {\n name: 'logEventMapper',\n value: features.logEventMapper\n },\n SdkConfiguration\n );\n setConfigurationAttribute(\n {\n name: 'errorEventMapper',\n value: features.errorEventMapper\n },\n SdkConfiguration\n );\n setConfigurationAttribute(\n {\n name: 'resourceEventMapper',\n value: features.resourceEventMapper\n },\n SdkConfiguration\n );\n setConfigurationAttribute(\n {\n name: 'actionEventMapper',\n value: features.actionEventMapper\n },\n SdkConfiguration\n );\n\n return SdkConfiguration;\n};\n\nexport class DatadogProviderConfiguration extends DdSdkReactNativeConfiguration {\n public initializationMode: InitializationMode = InitializationMode.SYNC;\n}\n\nexport enum InitializationMode {\n SYNC = 'SYNC',\n ASYNC = 'ASYNC'\n}\n\nexport type InitializationModeForTelemetry =\n | 'LEGACY'\n | 'SYNC'\n | 'ASYNC'\n | 'PARTIAL';\n"]}
|
package/lib/module/foundation.js
CHANGED
|
@@ -10,36 +10,9 @@ import { DdSdkConfiguration } from './types';
|
|
|
10
10
|
import { InternalLog } from "./InternalLog";
|
|
11
11
|
import { SdkVerbosity } from "./SdkVerbosity";
|
|
12
12
|
import { TimeProvider } from "./TimeProvider";
|
|
13
|
-
import { bufferNativeCallReturningId, bufferNativeCallWithId
|
|
13
|
+
import { bufferNativeCallReturningId, bufferNativeCallWithId } from './sdk/DatadogProvider/Buffer/bufferNativeCall';
|
|
14
14
|
const timeProvider = new TimeProvider();
|
|
15
15
|
|
|
16
|
-
class DdLogsWrapper {
|
|
17
|
-
constructor() {
|
|
18
|
-
_defineProperty(this, "nativeLogs", NativeModules.DdLogs);
|
|
19
|
-
}
|
|
20
|
-
|
|
21
|
-
debug(message, context = {}) {
|
|
22
|
-
InternalLog.log("Tracking debug log “" + message + "”", SdkVerbosity.DEBUG);
|
|
23
|
-
return this.nativeLogs.debug(message, context);
|
|
24
|
-
}
|
|
25
|
-
|
|
26
|
-
info(message, context = {}) {
|
|
27
|
-
InternalLog.log("Tracking info log “" + message + "”", SdkVerbosity.DEBUG);
|
|
28
|
-
return this.nativeLogs.info(message, context);
|
|
29
|
-
}
|
|
30
|
-
|
|
31
|
-
warn(message, context = {}) {
|
|
32
|
-
InternalLog.log("Tracking warn log “" + message + "”", SdkVerbosity.DEBUG);
|
|
33
|
-
return this.nativeLogs.warn(message, context);
|
|
34
|
-
}
|
|
35
|
-
|
|
36
|
-
error(message, context = {}) {
|
|
37
|
-
InternalLog.log("Tracking error log “" + message + "”", SdkVerbosity.DEBUG);
|
|
38
|
-
return this.nativeLogs.error(message, context);
|
|
39
|
-
}
|
|
40
|
-
|
|
41
|
-
}
|
|
42
|
-
|
|
43
16
|
class DdTraceWrapper {
|
|
44
17
|
constructor() {
|
|
45
18
|
_defineProperty(this, "nativeTrace", NativeModules.DdTrace);
|
|
@@ -58,102 +31,7 @@ class DdTraceWrapper {
|
|
|
58
31
|
|
|
59
32
|
}
|
|
60
33
|
|
|
61
|
-
const isNewStopActionAPI = args => {
|
|
62
|
-
return typeof args[0] === 'string';
|
|
63
|
-
};
|
|
64
|
-
|
|
65
|
-
const isOldStopActionAPI = args => {
|
|
66
|
-
return typeof args[0] === 'object' || typeof args[0] === 'undefined';
|
|
67
|
-
};
|
|
68
|
-
|
|
69
|
-
class DdRumWrapper {
|
|
70
|
-
constructor() {
|
|
71
|
-
_defineProperty(this, "nativeRum", NativeModules.DdRum);
|
|
72
|
-
|
|
73
|
-
_defineProperty(this, "lastActionData", void 0);
|
|
74
|
-
|
|
75
|
-
_defineProperty(this, "getStopActionNativeCall", args => {
|
|
76
|
-
if (isNewStopActionAPI(args)) {
|
|
77
|
-
return bufferVoidNativeCall(() => this.nativeRum.stopAction(args[0], args[1], args[2] || {}, args[3] || timeProvider.now()));
|
|
78
|
-
}
|
|
79
|
-
|
|
80
|
-
if (isOldStopActionAPI(args)) {
|
|
81
|
-
if (this.lastActionData) {
|
|
82
|
-
DdSdk.telemetryDebug('DDdRum.stopAction called with the old signature');
|
|
83
|
-
const {
|
|
84
|
-
type,
|
|
85
|
-
name
|
|
86
|
-
} = this.lastActionData;
|
|
87
|
-
return bufferVoidNativeCall(() => this.nativeRum.stopAction(type, name, args[0] || {}, args[1] || timeProvider.now()));
|
|
88
|
-
}
|
|
89
|
-
|
|
90
|
-
InternalLog.log("DdRum.startAction needs to be called before DdRum.stopAction", SdkVerbosity.WARN);
|
|
91
|
-
} else {
|
|
92
|
-
InternalLog.log("DdRum.stopAction was called with wrong arguments", SdkVerbosity.WARN);
|
|
93
|
-
}
|
|
94
|
-
|
|
95
|
-
return new Promise(resolve => resolve());
|
|
96
|
-
});
|
|
97
|
-
}
|
|
98
|
-
|
|
99
|
-
startView(key, name, context = {}, timestampMs = timeProvider.now()) {
|
|
100
|
-
InternalLog.log("Starting RUM View “" + name + "” #" + key, SdkVerbosity.DEBUG);
|
|
101
|
-
return bufferVoidNativeCall(() => this.nativeRum.startView(key, name, context, timestampMs));
|
|
102
|
-
}
|
|
103
|
-
|
|
104
|
-
stopView(key, context = {}, timestampMs = timeProvider.now()) {
|
|
105
|
-
InternalLog.log("Stopping RUM View #" + key, SdkVerbosity.DEBUG);
|
|
106
|
-
return bufferVoidNativeCall(() => this.nativeRum.stopView(key, context, timestampMs));
|
|
107
|
-
}
|
|
108
|
-
|
|
109
|
-
startAction(type, name, context = {}, timestampMs = timeProvider.now()) {
|
|
110
|
-
InternalLog.log("Starting RUM Action “" + name + "” (" + type + ")", SdkVerbosity.DEBUG);
|
|
111
|
-
this.lastActionData = {
|
|
112
|
-
type,
|
|
113
|
-
name
|
|
114
|
-
};
|
|
115
|
-
return bufferVoidNativeCall(() => this.nativeRum.startAction(type, name, context, timestampMs));
|
|
116
|
-
}
|
|
117
|
-
|
|
118
|
-
stopAction(...args) {
|
|
119
|
-
InternalLog.log("Stopping current RUM Action", SdkVerbosity.DEBUG);
|
|
120
|
-
let returnPromise = this.getStopActionNativeCall(args);
|
|
121
|
-
this.lastActionData = undefined;
|
|
122
|
-
return returnPromise;
|
|
123
|
-
}
|
|
124
|
-
|
|
125
|
-
addAction(type, name, context = {}, timestampMs = timeProvider.now()) {
|
|
126
|
-
InternalLog.log("Adding RUM Action “" + name + "” (" + type + ")", SdkVerbosity.DEBUG);
|
|
127
|
-
return bufferVoidNativeCall(() => this.nativeRum.addAction(type, name, context, timestampMs));
|
|
128
|
-
}
|
|
129
|
-
|
|
130
|
-
startResource(key, method, url, context = {}, timestampMs = timeProvider.now()) {
|
|
131
|
-
InternalLog.log("Starting RUM Resource #" + key + " " + method + ": " + url, SdkVerbosity.DEBUG);
|
|
132
|
-
return bufferVoidNativeCall(() => this.nativeRum.startResource(key, method, url, context, timestampMs));
|
|
133
|
-
}
|
|
134
|
-
|
|
135
|
-
stopResource(key, statusCode, kind, size = -1, context = {}, timestampMs = timeProvider.now()) {
|
|
136
|
-
InternalLog.log("Stopping RUM Resource #" + key + " status:" + statusCode, SdkVerbosity.DEBUG);
|
|
137
|
-
return bufferVoidNativeCall(() => this.nativeRum.stopResource(key, statusCode, kind, size, context, timestampMs));
|
|
138
|
-
}
|
|
139
|
-
|
|
140
|
-
addError(message, source, stacktrace, context = {}, timestampMs = timeProvider.now()) {
|
|
141
|
-
InternalLog.log("Adding RUM Error “" + message + "”", SdkVerbosity.DEBUG);
|
|
142
|
-
let updatedContext = context;
|
|
143
|
-
updatedContext["_dd.error.source_type"] = "react-native";
|
|
144
|
-
return bufferVoidNativeCall(() => this.nativeRum.addError(message, source, stacktrace, updatedContext, timestampMs));
|
|
145
|
-
}
|
|
146
|
-
|
|
147
|
-
addTiming(name) {
|
|
148
|
-
InternalLog.log("Adding timing “" + name + "” to RUM View", SdkVerbosity.DEBUG);
|
|
149
|
-
return bufferVoidNativeCall(() => this.nativeRum.addTiming(name));
|
|
150
|
-
}
|
|
151
|
-
|
|
152
|
-
}
|
|
153
|
-
|
|
154
34
|
const DdSdk = NativeModules.DdSdk;
|
|
155
|
-
const DdLogs = new DdLogsWrapper();
|
|
156
35
|
const DdTrace = new DdTraceWrapper();
|
|
157
|
-
|
|
158
|
-
export { DdSdkConfiguration, DdSdk, DdLogs, DdTrace, DdRum };
|
|
36
|
+
export { DdSdkConfiguration, DdSdk, DdTrace };
|
|
159
37
|
//# sourceMappingURL=foundation.js.map
|