@truewatchtech/react-native-mobile 0.4.1 → 0.4.3-alpha.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/FTMobileReactNativeSDK.podspec +7 -5
- package/README.md +34 -0
- package/android/build.gradle +9 -2
- package/android/src/main/java/com/ft/sdk/reactnative/FTMobileImpl.java +45 -14
- package/android/src/main/java/com/ft/sdk/reactnative/FTRUMImpl.java +85 -2
- package/android/src/main/java/com/ft/sdk/reactnative/FTTraceImpl.java +5 -1
- package/android/src/main/java/com/ft/sdk/reactnative/JsLongTaskMonitor.java +281 -0
- package/android/src/main/java/com/ft/sdk/reactnative/utils/ReactNativeUtils.java +5 -12
- package/android/src/newarch/java/com/ft/sdk/reactnative/FTMobileModule.java +9 -5
- package/android/src/newarch/java/com/ft/sdk/reactnative/FTRUMModule.java +26 -1
- package/android/src/newarch/java/com/ft/sdk/reactnative/FTTraceModule.java +14 -0
- package/android/src/oldarch/java/com/ft/sdk/reactnative/FTMobileModule.java +2 -2
- package/android/src/oldarch/java/com/ft/sdk/reactnative/FTRUMModule.java +29 -1
- package/android/src/oldarch/java/com/ft/sdk/reactnative/FTTraceModule.java +12 -0
- package/android/src/rnpost70/java/com/ft/sdk/reactnative/ReactJsThreadExecutor.java +21 -0
- package/android/src/rnpre70/java/com/ft/sdk/reactnative/ReactJsThreadExecutor.java +37 -0
- package/android/src/test/java/com/ft/sdk/reactnative/FTRUMModuleTest.java +117 -0
- package/android/src/test/java/com/ft/sdk/reactnative/JsLongTaskMonitorTest.java +446 -0
- package/android/src/test/java/com/ft/sdk/reactnative/utils/ReactNativeUtilsTest.java +33 -0
- package/ios/FTJSLongTaskMonitor.h +51 -0
- package/ios/FTJSLongTaskMonitor.m +250 -0
- package/ios/FTMobileReactNative.mm +23 -16
- package/ios/FTReactNativeLog.mm +3 -4
- package/ios/FTReactNativeRUM.mm +103 -28
- package/ios/FTReactNativeResource.h +4 -0
- package/ios/FTReactNativeResource.m +58 -0
- package/ios/FTReactNativeTrace.mm +56 -13
- package/ios/FTReactNativeUtils.m +10 -15
- package/ios/FTReactNativeWebSocket.h +10 -0
- package/ios/FTReactNativeWebSocket.mm +201 -0
- package/ios/FTWebSocketMetadataStore.h +25 -0
- package/ios/FTWebSocketMetadataStore.m +622 -0
- package/ios/FTWebSocketResourceData.h +16 -0
- package/ios/FTWebSocketResourceData.m +75 -0
- package/lib/commonjs/ft_mobile_agent.js +36 -3
- package/lib/commonjs/ft_mobile_agent.js.map +1 -1
- package/lib/commonjs/ft_rum.js +46 -2
- package/lib/commonjs/ft_rum.js.map +1 -1
- package/lib/commonjs/ft_tracing.js +12 -3
- package/lib/commonjs/ft_tracing.js.map +1 -1
- package/lib/commonjs/index.js +14 -0
- package/lib/commonjs/index.js.map +1 -1
- package/lib/commonjs/rum/FTBabelInteractionTracking.js +72 -0
- package/lib/commonjs/rum/FTBabelInteractionTracking.js.map +1 -0
- package/lib/commonjs/rum/FTBabelUtils.js +87 -0
- package/lib/commonjs/rum/FTBabelUtils.js.map +1 -0
- package/lib/commonjs/rum/FTRumActionTracking.js +10 -39
- package/lib/commonjs/rum/FTRumActionTracking.js.map +1 -1
- package/lib/commonjs/rum/FTRumActionTrackingContext.js +50 -0
- package/lib/commonjs/rum/FTRumActionTrackingContext.js.map +1 -0
- package/lib/commonjs/rum/FTRumWebSocketNative.js +73 -0
- package/lib/commonjs/rum/FTRumWebSocketNative.js.map +1 -0
- package/lib/commonjs/rum/FTRumWebSocketTiming.js +55 -0
- package/lib/commonjs/rum/FTRumWebSocketTiming.js.map +1 -0
- package/lib/commonjs/rum/FTRumWebSocketTracking.js +510 -0
- package/lib/commonjs/rum/FTRumWebSocketTracking.js.map +1 -0
- package/lib/commonjs/rum/longTasksUtils.js +25 -0
- package/lib/commonjs/rum/longTasksUtils.js.map +1 -0
- package/lib/commonjs/specs/NativeFTMobileReactNative.js.map +1 -1
- package/lib/commonjs/specs/NativeFTReactNativeRUM.js.map +1 -1
- package/lib/commonjs/specs/NativeFTReactNativeTrace.js.map +1 -1
- package/lib/commonjs/specs/NativeFTReactNativeWebSocket.js +11 -0
- package/lib/commonjs/specs/NativeFTReactNativeWebSocket.js.map +1 -0
- package/lib/commonjs/version.js +1 -1
- package/lib/commonjs/version.js.map +1 -1
- package/lib/module/ft_mobile_agent.js +36 -3
- package/lib/module/ft_mobile_agent.js.map +1 -1
- package/lib/module/ft_rum.js +46 -2
- package/lib/module/ft_rum.js.map +1 -1
- package/lib/module/ft_tracing.js +12 -1
- package/lib/module/ft_tracing.js.map +1 -1
- package/lib/module/index.js +3 -1
- package/lib/module/index.js.map +1 -1
- package/lib/module/rum/FTBabelInteractionTracking.js +66 -0
- package/lib/module/rum/FTBabelInteractionTracking.js.map +1 -0
- package/lib/module/rum/FTBabelUtils.js +80 -0
- package/lib/module/rum/FTBabelUtils.js.map +1 -0
- package/lib/module/rum/FTRumActionTracking.js +10 -39
- package/lib/module/rum/FTRumActionTracking.js.map +1 -1
- package/lib/module/rum/FTRumActionTrackingContext.js +43 -0
- package/lib/module/rum/FTRumActionTrackingContext.js.map +1 -0
- package/lib/module/rum/FTRumWebSocketNative.js +62 -0
- package/lib/module/rum/FTRumWebSocketNative.js.map +1 -0
- package/lib/module/rum/FTRumWebSocketTiming.js +49 -0
- package/lib/module/rum/FTRumWebSocketTiming.js.map +1 -0
- package/lib/module/rum/FTRumWebSocketTracking.js +503 -0
- package/lib/module/rum/FTRumWebSocketTracking.js.map +1 -0
- package/lib/module/rum/longTasksUtils.js +18 -0
- package/lib/module/rum/longTasksUtils.js.map +1 -0
- package/lib/module/specs/NativeFTMobileReactNative.js.map +1 -1
- package/lib/module/specs/NativeFTReactNativeRUM.js.map +1 -1
- package/lib/module/specs/NativeFTReactNativeTrace.js.map +1 -1
- package/lib/module/specs/NativeFTReactNativeWebSocket.js +8 -0
- package/lib/module/specs/NativeFTReactNativeWebSocket.js.map +1 -0
- package/lib/module/version.js +1 -1
- package/lib/module/version.js.map +1 -1
- package/lib/typescript/ft_mobile_agent.d.ts +7 -0
- package/lib/typescript/ft_rum.d.ts +9 -0
- package/lib/typescript/index.d.ts +3 -1
- package/lib/typescript/rum/FTBabelInteractionTracking.d.ts +30 -0
- package/lib/typescript/rum/FTBabelUtils.d.ts +1 -0
- package/lib/typescript/rum/FTRumActionTracking.d.ts +0 -2
- package/lib/typescript/rum/FTRumActionTrackingContext.d.ts +11 -0
- package/lib/typescript/rum/FTRumWebSocketNative.d.ts +23 -0
- package/lib/typescript/rum/FTRumWebSocketTiming.d.ts +2 -0
- package/lib/typescript/rum/FTRumWebSocketTracking.d.ts +56 -0
- package/lib/typescript/rum/longTasksUtils.d.ts +8 -0
- package/lib/typescript/specs/NativeFTMobileReactNative.d.ts +14 -0
- package/lib/typescript/specs/NativeFTReactNativeRUM.d.ts +4 -0
- package/lib/typescript/specs/NativeFTReactNativeTrace.d.ts +12 -0
- package/lib/typescript/specs/NativeFTReactNativeWebSocket.d.ts +13 -0
- package/lib/typescript/version.d.ts +1 -1
- package/package.json +7 -6
- package/src/ft_mobile_agent.tsx +49 -6
- package/src/ft_rum.tsx +61 -2
- package/src/ft_tracing.tsx +15 -1
- package/src/index.tsx +4 -0
- package/src/rum/FTBabelInteractionTracking.ts +124 -0
- package/src/rum/FTBabelUtils.tsx +99 -0
- package/src/rum/FTRumActionTracking.tsx +14 -43
- package/src/rum/FTRumActionTrackingContext.ts +68 -0
- package/src/rum/FTRumWebSocketNative.ts +106 -0
- package/src/rum/FTRumWebSocketTiming.ts +50 -0
- package/src/rum/FTRumWebSocketTracking.ts +727 -0
- package/src/rum/longTasksUtils.ts +17 -0
- package/src/specs/NativeFTMobileReactNative.ts +17 -0
- package/src/specs/NativeFTReactNativeRUM.ts +4 -0
- package/src/specs/NativeFTReactNativeTrace.ts +12 -0
- package/src/specs/NativeFTReactNativeWebSocket.ts +33 -0
- package/src/version.ts +1 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["TurboModuleRegistry","get"],"sources":["NativeFTReactNativeRUM.ts"],"sourcesContent":["/* eslint-disable @typescript-eslint/ban-types */\nimport type { TurboModule } from 'react-native';\nimport { TurboModuleRegistry } from 'react-native';\n\nexport interface Spec extends TurboModule {\n /**\n * Set RUM tracking conditions and enable RUM collection.\n * @param config rum configuration parameters.\n * @returns a Promise.\n */\n setConfig(config: Object): Promise<void>;\n /**\n * Start RUM Action.\n * RUM will bind Resource, Error, LongTask events that may be triggered by this Action.\n * Avoid adding multiple times within 0.1s, only one Action will be associated with the same View at the same time, and new Actions will be discarded if the previous one has not ended.\n * Adding Action with `addAction` method does not affect each other.\n * @param actionName action name\n * @param actionType action type\n * @param property event context (optional)\n * @returns a Promise.\n */\n startAction(\n actionName: string,\n actionType: string,\n property?: Object\n ): Promise<void>;\n /**\n * Add Action event. This type of data cannot be associated with Error, Resource, LongTask data, and has no discard logic.\n * @param actionName action name\n * @param actionType action type\n * @param property event context (optional)\n * @returns a Promise.\n */\n addAction(\n actionName: string,\n actionType: string,\n property?: Object\n ): Promise<void>;\n /**\n * view load duration.\n * @param viewName view name\n * @param loadTime view load duration\n * @returns a Promise.\n */\n onCreateView(viewName: string, loadTime: number): Promise<void>;\n /**\n * view start.\n * @param viewName page name\n * @param property event context (optional)\n * @returns a Promise.\n */\n startView(viewName: string, property?: Object): Promise<void>;\n /**\n * view end.\n * @param property event context (optional)\n * @returns a Promise.\n */\n stopView(property?: Object): Promise<void>;\n /**\n * Exception capture and log collection.\n * @param stack stack log\n * @param message error message\n * @param property event context (optional)\n * @returns a Promise.\n */\n addError(stack: string, message: string, property?: Object): Promise<void>;\n /**\n * Exception capture and log collection.\n * @param type error type\n * @param stack stack log\n * @param message error message\n * @param property event context (optional)\n * @returns a Promise.\n */\n addErrorWithType(\n type: string,\n stack: string,\n message: string,\n property?: Object\n ): Promise<void>;\n /**\n * Start resource request.\n * @param key unique id\n * @param property event context (optional)\n * @returns a Promise.\n */\n startResource(key: string, property?: Object): Promise<void>;\n /**\n * End resource request.\n * @param key unique id\n * @param property event context (optional)\n * @returns a Promise.\n */\n stopResource(key: string, property?: Object): Promise<void>;\n /**\n * Send resource data metrics.\n * @param key unique id\n * @param resource resource data\n * @param metrics resource performance data\n * @returns a Promise.\n */\n addResource(key: string, resource: Object, metrics?: Object): Promise<void>;\n}\nexport default TurboModuleRegistry.get<Spec>('FTReactNativeRUM');\n"],"mappings":"AAAA;;AAEA,SAASA,mBAAmB,QAAQ,cAAc;
|
|
1
|
+
{"version":3,"names":["TurboModuleRegistry","get"],"sources":["NativeFTReactNativeRUM.ts"],"sourcesContent":["/* eslint-disable @typescript-eslint/ban-types */\nimport type { TurboModule } from 'react-native';\nimport { TurboModuleRegistry } from 'react-native';\n\nexport interface Spec extends TurboModule {\n /**\n * Set RUM tracking conditions and enable RUM collection.\n * @param config rum configuration parameters.\n * @returns a Promise.\n */\n setConfig(config: Object): Promise<void>;\n /** Internal synchronous snapshot used only by native JS long task reporting. */\n setLongTaskContext(context: Object): boolean;\n /** Stops the internal JavaScript long task monitor before SDK shutdown. */\n stopLongTaskTracking(): Promise<void>;\n /**\n * Start RUM Action.\n * RUM will bind Resource, Error, LongTask events that may be triggered by this Action.\n * Avoid adding multiple times within 0.1s, only one Action will be associated with the same View at the same time, and new Actions will be discarded if the previous one has not ended.\n * Adding Action with `addAction` method does not affect each other.\n * @param actionName action name\n * @param actionType action type\n * @param property event context (optional)\n * @returns a Promise.\n */\n startAction(\n actionName: string,\n actionType: string,\n property?: Object\n ): Promise<void>;\n /**\n * Add Action event. This type of data cannot be associated with Error, Resource, LongTask data, and has no discard logic.\n * @param actionName action name\n * @param actionType action type\n * @param property event context (optional)\n * @returns a Promise.\n */\n addAction(\n actionName: string,\n actionType: string,\n property?: Object\n ): Promise<void>;\n /**\n * view load duration.\n * @param viewName view name\n * @param loadTime view load duration\n * @returns a Promise.\n */\n onCreateView(viewName: string, loadTime: number): Promise<void>;\n /**\n * view start.\n * @param viewName page name\n * @param property event context (optional)\n * @returns a Promise.\n */\n startView(viewName: string, property?: Object): Promise<void>;\n /**\n * view end.\n * @param property event context (optional)\n * @returns a Promise.\n */\n stopView(property?: Object): Promise<void>;\n /**\n * Exception capture and log collection.\n * @param stack stack log\n * @param message error message\n * @param property event context (optional)\n * @returns a Promise.\n */\n addError(stack: string, message: string, property?: Object): Promise<void>;\n /**\n * Exception capture and log collection.\n * @param type error type\n * @param stack stack log\n * @param message error message\n * @param property event context (optional)\n * @returns a Promise.\n */\n addErrorWithType(\n type: string,\n stack: string,\n message: string,\n property?: Object\n ): Promise<void>;\n /**\n * Start resource request.\n * @param key unique id\n * @param property event context (optional)\n * @returns a Promise.\n */\n startResource(key: string, property?: Object): Promise<void>;\n /**\n * End resource request.\n * @param key unique id\n * @param property event context (optional)\n * @returns a Promise.\n */\n stopResource(key: string, property?: Object): Promise<void>;\n /**\n * Send resource data metrics.\n * @param key unique id\n * @param resource resource data\n * @param metrics resource performance data\n * @returns a Promise.\n */\n addResource(key: string, resource: Object, metrics?: Object): Promise<void>;\n}\nexport default TurboModuleRegistry.get<Spec>('FTReactNativeRUM');\n"],"mappings":"AAAA;;AAEA,SAASA,mBAAmB,QAAQ,cAAc;AAyGlD,eAAeA,mBAAmB,CAACC,GAAG,CAAO,kBAAkB,CAAC","ignoreList":[]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["TurboModuleRegistry","get"],"sources":["NativeFTReactNativeTrace.ts"],"sourcesContent":["/* eslint-disable @typescript-eslint/ban-types */\nimport type { TurboModule } from 'react-native';\nimport { TurboModuleRegistry } from 'react-native';\n\nexport interface Spec extends TurboModule {\n /**\n * Configure trace to enable distributed tracing.\n * @param config trace configuration parameters.\n * @returns a Promise.\n */\n setConfig(config: Object): Promise<void>;\n /**\n * Get trace HTTP request header data.\n * @param url request URL\n * @returns trace request header parameters\n * @deprecated use getTraceHeaderFields() replace.\n */\n getTraceHeader(key: string, url: string): Promise<Object>;\n /**\n * Get trace HTTP request header data.\n * @param url request URL\n * @returns trace request header parameters\n */\n getTraceHeaderFields(url: string, key?: string): Promise<Object>;\n}\nexport default TurboModuleRegistry.get<Spec>('FTReactNativeTrace');\n"],"mappings":"AAAA;;AAEA,SAASA,mBAAmB,QAAQ,cAAc;
|
|
1
|
+
{"version":3,"names":["TurboModuleRegistry","get"],"sources":["NativeFTReactNativeTrace.ts"],"sourcesContent":["/* eslint-disable @typescript-eslint/ban-types */\nimport type { TurboModule } from 'react-native';\nimport { TurboModuleRegistry } from 'react-native';\n\nexport interface Spec extends TurboModule {\n /**\n * Configure trace to enable distributed tracing.\n * @param config trace configuration parameters.\n * @returns a Promise.\n */\n setConfig(config: Object): Promise<void>;\n /**\n * Get trace HTTP request header data.\n * @param url request URL\n * @returns trace request header parameters\n * @deprecated use getTraceHeaderFields() replace.\n */\n getTraceHeader(key: string, url: string): Promise<Object>;\n /**\n * Get trace HTTP request header data.\n * @param url request URL\n * @returns trace request header parameters\n */\n getTraceHeaderFields(url: string, key?: string): Promise<Object>;\n /**\n * Get trace HTTP request headers synchronously for APIs whose construction\n * cannot wait for a Promise, such as React Native WebSocket.\n * @internal\n */\n getTraceHeaderFieldsSync(url: string, key: string): Object | null;\n /**\n * Discard iOS Trace correlation when WebSocket observation is abandoned\n * before Resource reporting starts. Android uses native collection.\n * @internal\n */\n cancelWebSocketTrace(key: string): Promise<void>;\n}\nexport default TurboModuleRegistry.get<Spec>('FTReactNativeTrace');\n"],"mappings":"AAAA;;AAEA,SAASA,mBAAmB,QAAQ,cAAc;AAmClD,eAAeA,mBAAmB,CAACC,GAAG,CAAO,oBAAoB,CAAC","ignoreList":[]}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
/* eslint-disable @typescript-eslint/ban-types */
|
|
2
|
+
|
|
3
|
+
import { TurboModuleRegistry } from 'react-native';
|
|
4
|
+
|
|
5
|
+
/** Internal iOS handshake reporting bridge; absent on Android and older binaries. */
|
|
6
|
+
|
|
7
|
+
export default TurboModuleRegistry.get('FTReactNativeWebSocket');
|
|
8
|
+
//# sourceMappingURL=NativeFTReactNativeWebSocket.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["TurboModuleRegistry","get"],"sources":["NativeFTReactNativeWebSocket.ts"],"sourcesContent":["/* eslint-disable @typescript-eslint/ban-types */\nimport type { TurboModule } from 'react-native';\nimport { TurboModuleRegistry } from 'react-native';\n\n/** Internal iOS handshake reporting bridge; absent on Android and older binaries. */\nexport interface Spec extends TurboModule {\n startCapture(session: string): Promise<void>;\n stopCapture(session: string): Promise<void>;\n clear(): Promise<void>;\n startResource(\n key: string,\n socketID: number,\n url: string,\n session: string,\n sequence: number,\n property: Object\n ): Promise<void>;\n stopResource(\n key: string,\n event: string,\n session: string,\n property: Object\n ): Promise<void>;\n addResource(\n key: string,\n content: Object,\n metrics: Object,\n session: string\n ): Promise<void>;\n releaseResource(key: string, session: string): Promise<void>;\n}\n\nexport default TurboModuleRegistry.get<Spec>('FTReactNativeWebSocket');\n"],"mappings":"AAAA;;AAEA,SAASA,mBAAmB,QAAQ,cAAc;;AAElD;;AA4BA,eAAeA,mBAAmB,CAACC,GAAG,CAAO,wBAAwB,CAAC","ignoreList":[]}
|
package/lib/module/version.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["version"],"sources":["version.ts"],"sourcesContent":["// generated by genversion\nexport const version = '0.4.
|
|
1
|
+
{"version":3,"names":["version"],"sources":["version.ts"],"sourcesContent":["// generated by genversion\nexport const version = '0.4.3-alpha.2';\n"],"mappings":"AAAA;AACA,OAAO,MAAMA,OAAO,GAAG,eAAe","ignoreList":[]}
|
|
@@ -7,6 +7,7 @@ import { EmitterSubscription } from 'react-native';
|
|
|
7
7
|
declare class BridgeContextManager {
|
|
8
8
|
private static instance;
|
|
9
9
|
private properties;
|
|
10
|
+
private longTaskContextEnabled;
|
|
10
11
|
private constructor();
|
|
11
12
|
/**
|
|
12
13
|
* Initialize SDK information properties
|
|
@@ -23,6 +24,8 @@ declare class BridgeContextManager {
|
|
|
23
24
|
* @param properties Object containing key-value pairs
|
|
24
25
|
*/
|
|
25
26
|
appendBridgeContext(properties: Record<string, any>): void;
|
|
27
|
+
configureLongTaskContext(enabled: boolean): void;
|
|
28
|
+
private syncLongTaskContext;
|
|
26
29
|
/**
|
|
27
30
|
* Merge bridge context properties with local properties
|
|
28
31
|
* Bridge context properties take precedence over local properties
|
|
@@ -137,6 +140,8 @@ export type FTRemoteConfigResult = {
|
|
|
137
140
|
* @param syncSleepTime interval time between each request during data synchronization, unit milliseconds, 0 < syncSleepTime < 100
|
|
138
141
|
* @param enableDataIntegerCompatible whether to enable data integer compatibility during data synchronization, enabled by default
|
|
139
142
|
* @param compressIntakeRequests whether to compress synchronized data
|
|
143
|
+
* @param enableDataFilter whether to enable SDK-side local data filters, enabled by default
|
|
144
|
+
* @param dataFilters local blocklist filter rules. Supported categories include `logging` and `rum`. Any data that matches a rule will be discarded.
|
|
140
145
|
* @param globalContext custom global parameters
|
|
141
146
|
* @param groupIdentifiers iOS side sets the AppGroups Identifier array corresponding to the collected Widget Extension
|
|
142
147
|
* @param enableLimitWithDbSize set whether to enable using db to limit data size, after enabling, `FTLogConfig.logCacheLimitCount` and `FTRUMConfig.rumCacheLimitCount` will no longer take effect
|
|
@@ -165,6 +170,8 @@ export interface FTMobileConfig {
|
|
|
165
170
|
syncSleepTime?: number;
|
|
166
171
|
enableDataIntegerCompatible?: boolean;
|
|
167
172
|
compressIntakeRequests?: boolean;
|
|
173
|
+
enableDataFilter?: boolean;
|
|
174
|
+
dataFilters?: Record<string, Array<string>>;
|
|
168
175
|
globalContext?: object;
|
|
169
176
|
groupIdentifiers?: Array<string>;
|
|
170
177
|
enableLimitWithDbSize?: boolean;
|
|
@@ -59,9 +59,15 @@ export declare enum IOSCrashMonitoringType {
|
|
|
59
59
|
* @param enableTrackNativeAppANR whether to collect Native ANR
|
|
60
60
|
* @param enableTrackNativeFreeze whether to collect Native Freeze
|
|
61
61
|
* @param nativeFreezeDurationMs set the threshold for collecting Native Freeze, value range [100,), unit ms. iOS default 250ms, Android default 1000ms
|
|
62
|
+
* @param enableLongTask whether to collect React Native JavaScript LongTasks, default false
|
|
63
|
+
* @param longTaskThresholdMs set the threshold for collecting React Native JavaScript LongTasks, unit ms. Defaults to 100 and is clamped to [100, 5000]
|
|
62
64
|
* @param enableNativeUserAction whether to start Native Action tracking, Button click events, recommended to disable for pure react-native apps
|
|
63
65
|
* @param enableNativeUserView whether to start Native View auto tracking, recommended to disable for pure react-native apps
|
|
64
66
|
* @param enableNativeUserResource whether to automatically collect react-native Resource
|
|
67
|
+
* @param enableIOSWebSocketResource whether to collect iOS WebSocket opening handshakes as RUM Resources. Defaults to false.
|
|
68
|
+
* Independent of enableNativeUserResource. Android native WebSocket collection is unaffected.
|
|
69
|
+
* iOS WebSocket Trace header injection requires both this option and enableNativeAutoTrace.
|
|
70
|
+
* When disabled, new iOS WebSocket connections are not instrumented or automatically injected with Trace headers by this SDK.
|
|
65
71
|
* @param enableResourceHostIP whether to collect network request Host IP (only for native http, iOS 13 and above)
|
|
66
72
|
* @param errorMonitorType error monitoring supplement type
|
|
67
73
|
* @param deviceMonitorType page monitoring supplement type
|
|
@@ -84,9 +90,12 @@ export interface FTRUMConfig {
|
|
|
84
90
|
enableTrackNativeAppANR?: boolean;
|
|
85
91
|
enableTrackNativeFreeze?: boolean;
|
|
86
92
|
nativeFreezeDurationMs?: number;
|
|
93
|
+
enableLongTask?: boolean;
|
|
94
|
+
longTaskThresholdMs?: number;
|
|
87
95
|
enableNativeUserAction?: boolean;
|
|
88
96
|
enableNativeUserView?: boolean;
|
|
89
97
|
enableNativeUserResource?: boolean;
|
|
98
|
+
enableIOSWebSocketResource?: boolean;
|
|
90
99
|
enableResourceHostIP?: boolean;
|
|
91
100
|
errorMonitorType?: ErrorMonitorType;
|
|
92
101
|
deviceMonitorType?: DeviceMetricsMonitorType;
|
|
@@ -4,4 +4,6 @@ import { FTRUMConfig, FTRUMResource, FTReactNativeRUM, ErrorMonitorType, DeviceM
|
|
|
4
4
|
import { FTTraceConfig, FTReactNativeTrace, TraceType } from './ft_tracing';
|
|
5
5
|
import { FTRumActionTracking } from './rum/FTRumActionTracking';
|
|
6
6
|
import { FTRumErrorTracking } from './rum/FTRumErrorTracking';
|
|
7
|
-
|
|
7
|
+
import { FTBabelInteractionTracking } from './rum/FTBabelInteractionTracking';
|
|
8
|
+
import { __ftExtractText } from './rum/FTBabelUtils';
|
|
9
|
+
export { FTMobileReactNative, FTMobileConfig, EnvType, FTDBCacheDiscard, FTRemoteConfigResult, FTRemoteConfigOverrideRule, FTRemoteConfigOverrideMatch, FTRemoteConfigOverrideValues, FTLogConfig, FTReactNativeLog, FTLogStatus, FTLogCacheDiscard, FTRUMConfig, FTReactNativeRUM, FTRUMResource, ErrorMonitorType, DeviceMetricsMonitorType, DetectFrequency, FTRUMResourceMetrics, FTRUMCacheDiscard, IOSCrashMonitoringType, FTTraceConfig, FTReactNativeTrace, TraceType, FTRumActionTracking, FTRumErrorTracking, FTBabelInteractionTracking, __ftExtractText, };
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
declare global {
|
|
2
|
+
var __FT_RN_BABEL_PLUGIN_ENABLED__: boolean | undefined;
|
|
3
|
+
}
|
|
4
|
+
export type FTBabelActionTarget = {
|
|
5
|
+
'options': {
|
|
6
|
+
useContent: boolean;
|
|
7
|
+
useNamePrefix: boolean;
|
|
8
|
+
};
|
|
9
|
+
'handlerArgs'?: unknown[];
|
|
10
|
+
'componentName': string;
|
|
11
|
+
'getContent'?: () => string[];
|
|
12
|
+
'ft-action-name'?: string[];
|
|
13
|
+
'customActionName'?: string[];
|
|
14
|
+
'accessibilityLabel'?: string[];
|
|
15
|
+
};
|
|
16
|
+
type ActionReporter = (actionName: string, actionType: string, property?: object) => Promise<void>;
|
|
17
|
+
type BabelTrackingConfig = {
|
|
18
|
+
trackInteractions: boolean;
|
|
19
|
+
actionReporter?: ActionReporter;
|
|
20
|
+
};
|
|
21
|
+
declare class BabelInteractionTracking {
|
|
22
|
+
private trackInteractions;
|
|
23
|
+
private actionReporter;
|
|
24
|
+
getInstance(): BabelInteractionTracking;
|
|
25
|
+
configure(config: BabelTrackingConfig): void;
|
|
26
|
+
getTargetName(target: FTBabelActionTarget): string;
|
|
27
|
+
wrapRumAction(handler: ((...args: any[]) => any) | null | undefined, actionType: string, target: FTBabelActionTarget): (...args: any[]) => any;
|
|
28
|
+
}
|
|
29
|
+
export declare const FTBabelInteractionTracking: BabelInteractionTracking;
|
|
30
|
+
export {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare function __ftExtractText(node: any, prefer?: any[]): string[];
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
export type FTRumActionTrackingContext = {
|
|
2
|
+
enabled: boolean;
|
|
3
|
+
property?: object;
|
|
4
|
+
};
|
|
5
|
+
type FiberNode = {
|
|
6
|
+
memoizedProps?: Record<string, unknown>;
|
|
7
|
+
return?: FiberNode | null;
|
|
8
|
+
};
|
|
9
|
+
export declare function resolveActionTrackingContextFromTarget(targetNode: FiberNode | null): FTRumActionTrackingContext;
|
|
10
|
+
export declare function resolveActionTrackingContext(handlerArgs: unknown[]): FTRumActionTrackingContext;
|
|
11
|
+
export {};
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
export interface NativeWebSocketResource {
|
|
2
|
+
url: string;
|
|
3
|
+
httpMethod: string;
|
|
4
|
+
requestHeader: Record<string, unknown>;
|
|
5
|
+
webSocketEvent: string;
|
|
6
|
+
errorMessage?: string;
|
|
7
|
+
}
|
|
8
|
+
export declare class NativeWebSocketSession {
|
|
9
|
+
private readonly session;
|
|
10
|
+
private stopped;
|
|
11
|
+
private sequence;
|
|
12
|
+
constructor(session: string);
|
|
13
|
+
startResource(key: string, socketID: number | undefined, url: string): Promise<void>;
|
|
14
|
+
stopResource(key: string, event: string): Promise<void>;
|
|
15
|
+
addResource(key: string, content: NativeWebSocketResource, metrics: {
|
|
16
|
+
duration?: number;
|
|
17
|
+
}): Promise<void>;
|
|
18
|
+
release(key: string): void;
|
|
19
|
+
stop(): void;
|
|
20
|
+
}
|
|
21
|
+
export declare function startNativeWebSocketSession(createKey: () => string): NativeWebSocketSession | undefined;
|
|
22
|
+
export declare function clearNativeWebSocketSessions(): void;
|
|
23
|
+
export declare function webSocketNativeID(socket: unknown): number | undefined;
|
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
type WebSocketHandshakeState = 'success' | 'rejected' | 'failed';
|
|
2
|
+
interface FTRUMWebSocketResource {
|
|
3
|
+
url: string;
|
|
4
|
+
httpMethod: string;
|
|
5
|
+
requestHeader: Record<string, unknown>;
|
|
6
|
+
resourceStatus: number;
|
|
7
|
+
responseHeader?: Record<string, string>;
|
|
8
|
+
resourceType: 'websocket';
|
|
9
|
+
webSocketHandshake: true;
|
|
10
|
+
webSocketHandshakeState: WebSocketHandshakeState;
|
|
11
|
+
errorMessage?: string;
|
|
12
|
+
}
|
|
13
|
+
interface FTRumWebSocketResourceReporter {
|
|
14
|
+
startResource(key: string): Promise<void>;
|
|
15
|
+
stopResource(key: string): Promise<void>;
|
|
16
|
+
addResource(key: string, resource: FTRUMWebSocketResource, metrics?: {
|
|
17
|
+
duration?: number;
|
|
18
|
+
resource_http_protocol?: string;
|
|
19
|
+
}): Promise<void>;
|
|
20
|
+
}
|
|
21
|
+
export declare class FTRumWebSocketTracking {
|
|
22
|
+
private static enabled;
|
|
23
|
+
private static installed;
|
|
24
|
+
private static originalWebSocket;
|
|
25
|
+
private static instrumentedWebSocket;
|
|
26
|
+
private static resourceReporter;
|
|
27
|
+
private static nativeAutoTraceEnabled;
|
|
28
|
+
private static warnedFailures;
|
|
29
|
+
private static lifecycleVersion;
|
|
30
|
+
private static nativeSession;
|
|
31
|
+
private static pendingHandshakes;
|
|
32
|
+
/** Identifies configuration and reporting work started before SDK shutdown. */
|
|
33
|
+
static getLifecycleVersion(): number;
|
|
34
|
+
static shutDown(): void;
|
|
35
|
+
static setNativeAutoTraceEnabled(enabled: boolean): void;
|
|
36
|
+
private static stopNativeSession;
|
|
37
|
+
static startTracking(resourceReporter: FTRumWebSocketResourceReporter): void;
|
|
38
|
+
static stopTracking(): void;
|
|
39
|
+
private static createWebSocket;
|
|
40
|
+
private static createResourceKey;
|
|
41
|
+
private static cancelTrace;
|
|
42
|
+
private static getTraceHeaders;
|
|
43
|
+
private static mergeTraceHeaders;
|
|
44
|
+
private static toOptions;
|
|
45
|
+
private static toHeaderRecord;
|
|
46
|
+
private static eventString;
|
|
47
|
+
private static handshakeErrorFromEvent;
|
|
48
|
+
private static failureMessageFromClose;
|
|
49
|
+
private static statusFromError;
|
|
50
|
+
private static toHandshakeError;
|
|
51
|
+
private static startResource;
|
|
52
|
+
private static completeResource;
|
|
53
|
+
private static completeNativeResource;
|
|
54
|
+
private static warnOnce;
|
|
55
|
+
}
|
|
56
|
+
export {};
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
export declare const MIN_LONG_TASK_THRESHOLD_MS = 100;
|
|
2
|
+
export declare const MAX_LONG_TASK_THRESHOLD_MS = 5000;
|
|
3
|
+
export declare const DEFAULT_LONG_TASK_THRESHOLD_MS = 100;
|
|
4
|
+
/**
|
|
5
|
+
* Converts the public JavaScript long task option to the numeric value expected
|
|
6
|
+
* by the native bridge. Enablement is controlled separately.
|
|
7
|
+
*/
|
|
8
|
+
export declare function normalizeLongTaskThreshold(threshold?: number): number;
|
|
@@ -70,6 +70,20 @@ export interface Spec extends TurboModule {
|
|
|
70
70
|
* Clear all data that has not yet been uploaded to the server.
|
|
71
71
|
*/
|
|
72
72
|
clearAllData(): Promise<void>;
|
|
73
|
+
/**
|
|
74
|
+
* Update remote configuration using the configured minimum update interval.
|
|
75
|
+
*/
|
|
76
|
+
updateRemoteConfig(): Promise<Object>;
|
|
77
|
+
/**
|
|
78
|
+
* Update remote configuration using a custom minimum update interval and
|
|
79
|
+
* optional override rules.
|
|
80
|
+
*/
|
|
81
|
+
updateRemoteConfigWithMiniUpdateInterval(interval: number, rules?: Array<Object>): Promise<Object>;
|
|
82
|
+
/**
|
|
83
|
+
* Required by NativeEventEmitter for remote configuration callbacks.
|
|
84
|
+
*/
|
|
85
|
+
addListener(eventName: string): void;
|
|
86
|
+
removeListeners(count: number): void;
|
|
73
87
|
}
|
|
74
88
|
declare const _default: Spec | null;
|
|
75
89
|
export default _default;
|
|
@@ -6,6 +6,10 @@ export interface Spec extends TurboModule {
|
|
|
6
6
|
* @returns a Promise.
|
|
7
7
|
*/
|
|
8
8
|
setConfig(config: Object): Promise<void>;
|
|
9
|
+
/** Internal synchronous snapshot used only by native JS long task reporting. */
|
|
10
|
+
setLongTaskContext(context: Object): boolean;
|
|
11
|
+
/** Stops the internal JavaScript long task monitor before SDK shutdown. */
|
|
12
|
+
stopLongTaskTracking(): Promise<void>;
|
|
9
13
|
/**
|
|
10
14
|
* Start RUM Action.
|
|
11
15
|
* RUM will bind Resource, Error, LongTask events that may be triggered by this Action.
|
|
@@ -19,6 +19,18 @@ export interface Spec extends TurboModule {
|
|
|
19
19
|
* @returns trace request header parameters
|
|
20
20
|
*/
|
|
21
21
|
getTraceHeaderFields(url: string, key?: string): Promise<Object>;
|
|
22
|
+
/**
|
|
23
|
+
* Get trace HTTP request headers synchronously for APIs whose construction
|
|
24
|
+
* cannot wait for a Promise, such as React Native WebSocket.
|
|
25
|
+
* @internal
|
|
26
|
+
*/
|
|
27
|
+
getTraceHeaderFieldsSync(url: string, key: string): Object | null;
|
|
28
|
+
/**
|
|
29
|
+
* Discard iOS Trace correlation when WebSocket observation is abandoned
|
|
30
|
+
* before Resource reporting starts. Android uses native collection.
|
|
31
|
+
* @internal
|
|
32
|
+
*/
|
|
33
|
+
cancelWebSocketTrace(key: string): Promise<void>;
|
|
22
34
|
}
|
|
23
35
|
declare const _default: Spec | null;
|
|
24
36
|
export default _default;
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import type { TurboModule } from 'react-native';
|
|
2
|
+
/** Internal iOS handshake reporting bridge; absent on Android and older binaries. */
|
|
3
|
+
export interface Spec extends TurboModule {
|
|
4
|
+
startCapture(session: string): Promise<void>;
|
|
5
|
+
stopCapture(session: string): Promise<void>;
|
|
6
|
+
clear(): Promise<void>;
|
|
7
|
+
startResource(key: string, socketID: number, url: string, session: string, sequence: number, property: Object): Promise<void>;
|
|
8
|
+
stopResource(key: string, event: string, session: string, property: Object): Promise<void>;
|
|
9
|
+
addResource(key: string, content: Object, metrics: Object, session: string): Promise<void>;
|
|
10
|
+
releaseResource(key: string, session: string): Promise<void>;
|
|
11
|
+
}
|
|
12
|
+
declare const _default: Spec | null;
|
|
13
|
+
export default _default;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
export declare const version = "0.4.
|
|
1
|
+
export declare const version = "0.4.3-alpha.2";
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@truewatchtech/react-native-mobile",
|
|
3
|
-
"version": "0.4.
|
|
4
|
-
"description": "Base on
|
|
3
|
+
"version": "0.4.3-alpha.2",
|
|
4
|
+
"description": "Base on TrueWatch Android iOS React Native SDK",
|
|
5
5
|
"main": "lib/commonjs/index",
|
|
6
6
|
"module": "lib/module/index",
|
|
7
7
|
"types": "lib/typescript/index.d.ts",
|
|
@@ -45,14 +45,14 @@
|
|
|
45
45
|
],
|
|
46
46
|
"repository": {
|
|
47
47
|
"type": "git",
|
|
48
|
-
"url": "git+https://github.com/
|
|
48
|
+
"url": "git+https://github.com/TrueWatchTech/datakit-react-native.git"
|
|
49
49
|
},
|
|
50
50
|
"author": "Brandon <brandonfaustine@gmail.com> (https://github.com/Br4ndonZhang)",
|
|
51
51
|
"license": "Apache-2.0",
|
|
52
52
|
"bugs": {
|
|
53
|
-
"url": "https://github.com/
|
|
53
|
+
"url": "https://github.com/TrueWatchTech/datakit-react-native.git/issues"
|
|
54
54
|
},
|
|
55
|
-
"homepage": "https://github.com/
|
|
55
|
+
"homepage": "https://github.com/TrueWatchTech/datakit-react-native.git#readme",
|
|
56
56
|
"publishConfig": {
|
|
57
57
|
"registry": "https://registry.npmjs.org/"
|
|
58
58
|
},
|
|
@@ -96,5 +96,6 @@
|
|
|
96
96
|
},
|
|
97
97
|
"directories": {
|
|
98
98
|
"lib": "lib"
|
|
99
|
-
}
|
|
99
|
+
},
|
|
100
|
+
"gitHead": "b7f95ab574f7e8c0e13c91d14eea9cba0fad7531"
|
|
100
101
|
}
|
package/src/ft_mobile_agent.tsx
CHANGED
|
@@ -3,7 +3,10 @@ import {
|
|
|
3
3
|
NativeEventEmitter,
|
|
4
4
|
NativeModules,
|
|
5
5
|
} from 'react-native';
|
|
6
|
+
import type { Spec as NativeFTMobileReactNativeSpec } from './specs/NativeFTMobileReactNative';
|
|
7
|
+
import type { Spec as NativeFTReactNativeRUMSpec } from './specs/NativeFTReactNativeRUM';
|
|
6
8
|
import { version as sdkVersion } from './version';
|
|
9
|
+
import { FTRumWebSocketTracking } from './rum/FTRumWebSocketTracking';
|
|
7
10
|
|
|
8
11
|
/**
|
|
9
12
|
* Bridge context manager for managing shared properties across RUM and Logger modules
|
|
@@ -13,6 +16,7 @@ import { version as sdkVersion } from './version';
|
|
|
13
16
|
class BridgeContextManager {
|
|
14
17
|
private static instance: BridgeContextManager;
|
|
15
18
|
private properties: Map<string, any> = new Map();
|
|
19
|
+
private longTaskContextEnabled = false;
|
|
16
20
|
|
|
17
21
|
private constructor() {
|
|
18
22
|
// Initialize with SDK version information
|
|
@@ -55,11 +59,35 @@ class BridgeContextManager {
|
|
|
55
59
|
Object.entries(properties).forEach(([key, value]) => {
|
|
56
60
|
this.properties.set(key, value);
|
|
57
61
|
});
|
|
62
|
+
if (this.longTaskContextEnabled) {
|
|
63
|
+
this.syncLongTaskContext();
|
|
64
|
+
}
|
|
58
65
|
} catch (error) {
|
|
59
66
|
console.warn('Failed to append bridge context:', error);
|
|
60
67
|
}
|
|
61
68
|
}
|
|
62
69
|
|
|
70
|
+
public configureLongTaskContext(enabled: boolean): void {
|
|
71
|
+
this.longTaskContextEnabled = enabled;
|
|
72
|
+
if (enabled) {
|
|
73
|
+
this.syncLongTaskContext();
|
|
74
|
+
}
|
|
75
|
+
}
|
|
76
|
+
|
|
77
|
+
private syncLongTaskContext(): void {
|
|
78
|
+
try {
|
|
79
|
+
// Apply the snapshot before JS can block. An async native call may run after
|
|
80
|
+
// the frame that detects the long task and attach stale context to it.
|
|
81
|
+
const rum: NativeFTReactNativeRUMSpec =
|
|
82
|
+
// eslint-disable-next-line @typescript-eslint/no-var-requires
|
|
83
|
+
require('./specs/NativeFTReactNativeRUM').default;
|
|
84
|
+
rum.setLongTaskContext(this.mergeWithLocalPropertiesSync());
|
|
85
|
+
} catch (error) {
|
|
86
|
+
// Context synchronization must not make a destroyed/older bridge crash the host.
|
|
87
|
+
console.warn('Failed to sync JS long task bridge context:', error);
|
|
88
|
+
}
|
|
89
|
+
}
|
|
90
|
+
|
|
63
91
|
/**
|
|
64
92
|
* Merge bridge context properties with local properties
|
|
65
93
|
* Bridge context properties take precedence over local properties
|
|
@@ -209,6 +237,8 @@ export type FTRemoteConfigResult = {
|
|
|
209
237
|
* @param syncSleepTime interval time between each request during data synchronization, unit milliseconds, 0 < syncSleepTime < 100
|
|
210
238
|
* @param enableDataIntegerCompatible whether to enable data integer compatibility during data synchronization, enabled by default
|
|
211
239
|
* @param compressIntakeRequests whether to compress synchronized data
|
|
240
|
+
* @param enableDataFilter whether to enable SDK-side local data filters, enabled by default
|
|
241
|
+
* @param dataFilters local blocklist filter rules. Supported categories include `logging` and `rum`. Any data that matches a rule will be discarded.
|
|
212
242
|
* @param globalContext custom global parameters
|
|
213
243
|
* @param groupIdentifiers iOS side sets the AppGroups Identifier array corresponding to the collected Widget Extension
|
|
214
244
|
* @param enableLimitWithDbSize set whether to enable using db to limit data size, after enabling, `FTLogConfig.logCacheLimitCount` and `FTRUMConfig.rumCacheLimitCount` will no longer take effect
|
|
@@ -237,6 +267,8 @@ export interface FTMobileConfig {
|
|
|
237
267
|
syncSleepTime?: number;
|
|
238
268
|
enableDataIntegerCompatible?: boolean;
|
|
239
269
|
compressIntakeRequests?: boolean;
|
|
270
|
+
enableDataFilter?: boolean;
|
|
271
|
+
dataFilters?: Record<string, Array<string>>;
|
|
240
272
|
globalContext?: object;
|
|
241
273
|
groupIdentifiers?: Array<string>;
|
|
242
274
|
enableLimitWithDbSize?: boolean;
|
|
@@ -357,8 +389,10 @@ type FTMobileReactNativeType = {
|
|
|
357
389
|
|
|
358
390
|
class FTMobileReactNativeWrapper implements FTMobileReactNativeType {
|
|
359
391
|
/* eslint-disable @typescript-eslint/no-var-requires */
|
|
360
|
-
private sdk:
|
|
392
|
+
private sdk: NativeFTMobileReactNativeSpec =
|
|
361
393
|
require('./specs/NativeFTMobileReactNative').default;
|
|
394
|
+
private rum: NativeFTReactNativeRUMSpec =
|
|
395
|
+
require('./specs/NativeFTReactNativeRUM').default;
|
|
362
396
|
/* eslint-enable @typescript-eslint/no-var-requires */
|
|
363
397
|
|
|
364
398
|
private emitter: NativeEventEmitter | null = null;
|
|
@@ -415,24 +449,33 @@ class FTMobileReactNativeWrapper implements FTMobileReactNativeType {
|
|
|
415
449
|
flushSyncData(): Promise<void> {
|
|
416
450
|
return this.sdk.flushSyncData();
|
|
417
451
|
}
|
|
418
|
-
shutDown(): Promise<void> {
|
|
419
|
-
|
|
452
|
+
async shutDown(): Promise<void> {
|
|
453
|
+
bridgeContextManager.configureLongTaskContext(false);
|
|
454
|
+
try {
|
|
455
|
+
FTRumWebSocketTracking.shutDown();
|
|
456
|
+
await this.rum.stopLongTaskTracking();
|
|
457
|
+
} finally {
|
|
458
|
+
await this.sdk.shutDown();
|
|
459
|
+
}
|
|
420
460
|
}
|
|
421
461
|
clearAllData(): Promise<void> {
|
|
422
462
|
return this.sdk.clearAllData();
|
|
423
463
|
}
|
|
424
464
|
appendBridgeContext(properties: Record<string, any>): void {
|
|
425
|
-
//
|
|
465
|
+
// Store properties in JS and update the native long task snapshot when enabled.
|
|
426
466
|
bridgeContextManager.appendBridgeContext(properties);
|
|
427
467
|
}
|
|
428
468
|
updateRemoteConfig(): Promise<FTRemoteConfigResult> {
|
|
429
|
-
return this.sdk.updateRemoteConfig()
|
|
469
|
+
return this.sdk.updateRemoteConfig() as Promise<FTRemoteConfigResult>;
|
|
430
470
|
}
|
|
431
471
|
updateRemoteConfigWithMiniUpdateInterval(
|
|
432
472
|
interval: number,
|
|
433
473
|
rules?: Array<FTRemoteConfigOverrideRule>
|
|
434
474
|
): Promise<FTRemoteConfigResult> {
|
|
435
|
-
return this.sdk.updateRemoteConfigWithMiniUpdateInterval(
|
|
475
|
+
return this.sdk.updateRemoteConfigWithMiniUpdateInterval(
|
|
476
|
+
interval,
|
|
477
|
+
rules
|
|
478
|
+
) as Promise<FTRemoteConfigResult>;
|
|
436
479
|
}
|
|
437
480
|
addRemoteConfigListener(
|
|
438
481
|
listener: (result: FTRemoteConfigResult) => void
|
package/src/ft_rum.tsx
CHANGED
|
@@ -1,7 +1,11 @@
|
|
|
1
1
|
// import { NativeModules } from 'react-native';
|
|
2
|
+
import { Platform } from 'react-native';
|
|
2
3
|
import { FTRumErrorTracking } from './rum/FTRumErrorTracking';
|
|
3
4
|
import { FTRumActionTracking } from './rum/FTRumActionTracking';
|
|
5
|
+
import { FTBabelInteractionTracking } from './rum/FTBabelInteractionTracking';
|
|
6
|
+
import { FTRumWebSocketTracking } from './rum/FTRumWebSocketTracking';
|
|
4
7
|
import { bridgeContextManager } from './ft_mobile_agent';
|
|
8
|
+
import { normalizeLongTaskThreshold } from './rum/longTasksUtils';
|
|
5
9
|
|
|
6
10
|
/**
|
|
7
11
|
* Error monitoring type.
|
|
@@ -80,9 +84,15 @@ export enum IOSCrashMonitoringType {
|
|
|
80
84
|
* @param enableTrackNativeAppANR whether to collect Native ANR
|
|
81
85
|
* @param enableTrackNativeFreeze whether to collect Native Freeze
|
|
82
86
|
* @param nativeFreezeDurationMs set the threshold for collecting Native Freeze, value range [100,), unit ms. iOS default 250ms, Android default 1000ms
|
|
87
|
+
* @param enableLongTask whether to collect React Native JavaScript LongTasks, default false
|
|
88
|
+
* @param longTaskThresholdMs set the threshold for collecting React Native JavaScript LongTasks, unit ms. Defaults to 100 and is clamped to [100, 5000]
|
|
83
89
|
* @param enableNativeUserAction whether to start Native Action tracking, Button click events, recommended to disable for pure react-native apps
|
|
84
90
|
* @param enableNativeUserView whether to start Native View auto tracking, recommended to disable for pure react-native apps
|
|
85
91
|
* @param enableNativeUserResource whether to automatically collect react-native Resource
|
|
92
|
+
* @param enableIOSWebSocketResource whether to collect iOS WebSocket opening handshakes as RUM Resources. Defaults to false.
|
|
93
|
+
* Independent of enableNativeUserResource. Android native WebSocket collection is unaffected.
|
|
94
|
+
* iOS WebSocket Trace header injection requires both this option and enableNativeAutoTrace.
|
|
95
|
+
* When disabled, new iOS WebSocket connections are not instrumented or automatically injected with Trace headers by this SDK.
|
|
86
96
|
* @param enableResourceHostIP whether to collect network request Host IP (only for native http, iOS 13 and above)
|
|
87
97
|
* @param errorMonitorType error monitoring supplement type
|
|
88
98
|
* @param deviceMonitorType page monitoring supplement type
|
|
@@ -105,9 +115,12 @@ export interface FTRUMConfig {
|
|
|
105
115
|
enableTrackNativeAppANR?: boolean;
|
|
106
116
|
enableTrackNativeFreeze?: boolean;
|
|
107
117
|
nativeFreezeDurationMs?: number;
|
|
118
|
+
enableLongTask?: boolean;
|
|
119
|
+
longTaskThresholdMs?: number;
|
|
108
120
|
enableNativeUserAction?: boolean;
|
|
109
121
|
enableNativeUserView?: boolean;
|
|
110
122
|
enableNativeUserResource?: boolean;
|
|
123
|
+
enableIOSWebSocketResource?: boolean;
|
|
111
124
|
enableResourceHostIP?: boolean;
|
|
112
125
|
errorMonitorType?: ErrorMonitorType;
|
|
113
126
|
deviceMonitorType?: DeviceMetricsMonitorType;
|
|
@@ -259,20 +272,66 @@ type FTReactNativeRUMType = {
|
|
|
259
272
|
): Promise<void>;
|
|
260
273
|
};
|
|
261
274
|
|
|
275
|
+
function isBabelPluginEnabled(): boolean {
|
|
276
|
+
if (typeof globalThis !== 'undefined') {
|
|
277
|
+
return globalThis.__FT_RN_BABEL_PLUGIN_ENABLED__ === true;
|
|
278
|
+
}
|
|
279
|
+
if (typeof global !== 'undefined') {
|
|
280
|
+
return global.__FT_RN_BABEL_PLUGIN_ENABLED__ === true;
|
|
281
|
+
}
|
|
282
|
+
return false;
|
|
283
|
+
}
|
|
284
|
+
|
|
262
285
|
class FTReactNativeRUMWrapper implements FTReactNativeRUMType {
|
|
286
|
+
private webSocketConfigVersion = 0;
|
|
263
287
|
// eslint-disable-next-line @typescript-eslint/no-var-requires
|
|
264
288
|
private rum: FTReactNativeRUMType = require('./specs/NativeFTReactNativeRUM')
|
|
265
289
|
.default;
|
|
266
290
|
|
|
267
291
|
setConfig(config: FTRUMConfig): Promise<void> {
|
|
292
|
+
bridgeContextManager.configureLongTaskContext(
|
|
293
|
+
config.enableLongTask === true
|
|
294
|
+
);
|
|
295
|
+
const webSocketLifecycle = FTRumWebSocketTracking.getLifecycleVersion();
|
|
296
|
+
const webSocketConfigVersion = ++this.webSocketConfigVersion;
|
|
297
|
+
const trackWebSocket = config.enableIOSWebSocketResource === true;
|
|
268
298
|
console.log('FTRUMConfig');
|
|
269
299
|
if (config.enableAutoTrackError) {
|
|
270
300
|
FTRumErrorTracking.startTracking();
|
|
271
301
|
}
|
|
272
|
-
|
|
302
|
+
const babelPluginEnabled = isBabelPluginEnabled();
|
|
303
|
+
FTBabelInteractionTracking.configure({
|
|
304
|
+
trackInteractions:
|
|
305
|
+
babelPluginEnabled && Boolean(config.enableAutoTrackUserAction),
|
|
306
|
+
actionReporter: (actionName, actionType, property) =>
|
|
307
|
+
this.startAction(actionName, actionType, property),
|
|
308
|
+
});
|
|
309
|
+
if (config.enableAutoTrackUserAction && !babelPluginEnabled) {
|
|
273
310
|
FTRumActionTracking.startTracking();
|
|
311
|
+
} else {
|
|
312
|
+
FTRumActionTracking.stopTracking();
|
|
274
313
|
}
|
|
275
|
-
return this.rum
|
|
314
|
+
return this.rum
|
|
315
|
+
.setConfig({
|
|
316
|
+
...config,
|
|
317
|
+
enableLongTask: config.enableLongTask === true,
|
|
318
|
+
longTaskThresholdMs: normalizeLongTaskThreshold(
|
|
319
|
+
config.longTaskThresholdMs
|
|
320
|
+
),
|
|
321
|
+
})
|
|
322
|
+
.then(() => {
|
|
323
|
+
if (
|
|
324
|
+
webSocketLifecycle !== FTRumWebSocketTracking.getLifecycleVersion() ||
|
|
325
|
+
webSocketConfigVersion !== this.webSocketConfigVersion
|
|
326
|
+
) {
|
|
327
|
+
return;
|
|
328
|
+
}
|
|
329
|
+
if (Platform.OS === 'ios' && trackWebSocket) {
|
|
330
|
+
FTRumWebSocketTracking.startTracking(this);
|
|
331
|
+
} else {
|
|
332
|
+
FTRumWebSocketTracking.stopTracking();
|
|
333
|
+
}
|
|
334
|
+
});
|
|
276
335
|
}
|
|
277
336
|
startAction(
|
|
278
337
|
actionName: string,
|