@truewatchtech/react-native-mobile 0.3.15 → 0.4.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/FTMobileReactNativeSDK.podspec +32 -2
- package/android/build.gradle +10 -4
- package/android/src/main/java/com/ft/sdk/reactnative/FTMobileImpl.java +434 -5
- package/android/src/main/java/com/ft/sdk/reactnative/FTRUMImpl.java +12 -0
- package/android/src/main/java/com/ft/sdk/reactnative/FTTraceImpl.java +1 -1
- package/android/src/newarch/java/com/ft/sdk/reactnative/FTLogModule.java +7 -14
- package/android/src/newarch/java/com/ft/sdk/reactnative/FTMobileModule.java +46 -12
- package/android/src/newarch/java/com/ft/sdk/reactnative/FTRUMModule.java +12 -13
- package/android/src/newarch/java/com/ft/sdk/reactnative/FTTraceModule.java +6 -8
- package/android/src/oldarch/java/com/ft/sdk/reactnative/FTMobileModule.java +34 -2
- package/android/src/rnpost74/java/com/ft/sdk/reactnative/FTMobilePackage.java +14 -4
- package/android/src/rnpre74/java/com/ft/sdk/reactnative/FTMobilePackage.java +0 -2
- package/ios/FTMobileReactNative.h +9 -5
- package/ios/FTMobileReactNative.mm +619 -0
- package/ios/FTReactNativeLog.h +8 -3
- package/ios/FTReactNativeLog.mm +79 -0
- package/ios/FTReactNativeRUM.h +8 -4
- package/ios/{FTReactNativeRUM.m → FTReactNativeRUM.mm} +143 -84
- package/ios/FTReactNativeTrace.h +7 -3
- package/ios/FTReactNativeTrace.mm +74 -0
- package/ios/FtMobileAgent.xcodeproj/project.pbxproj +22 -0
- package/lib/commonjs/ft_logger.js +14 -13
- package/lib/commonjs/ft_logger.js.map +1 -1
- package/lib/commonjs/ft_mobile_agent.js +153 -6
- package/lib/commonjs/ft_mobile_agent.js.map +1 -1
- package/lib/commonjs/ft_rum.js +55 -21
- package/lib/commonjs/ft_rum.js.map +1 -1
- package/lib/commonjs/ft_tracing.js +29 -10
- package/lib/commonjs/ft_tracing.js.map +1 -1
- package/lib/commonjs/index.js +30 -0
- package/lib/commonjs/index.js.map +1 -1
- package/lib/commonjs/rum/FTRumActionTracking.js +10 -4
- package/lib/commonjs/rum/FTRumActionTracking.js.map +1 -1
- package/lib/commonjs/rum/FTRumErrorTracking.js +4 -4
- package/lib/commonjs/rum/FTRumErrorTracking.js.map +1 -1
- package/lib/commonjs/specs/NativeFTMobileReactNative.js +10 -0
- package/lib/commonjs/specs/NativeFTMobileReactNative.js.map +1 -0
- package/lib/commonjs/specs/NativeFTReactNativeLog.js +10 -0
- package/lib/commonjs/specs/NativeFTReactNativeLog.js.map +1 -0
- package/lib/commonjs/specs/NativeFTReactNativeRUM.js +10 -0
- package/lib/commonjs/specs/NativeFTReactNativeRUM.js.map +1 -0
- package/lib/commonjs/specs/NativeFTReactNativeTrace.js +10 -0
- package/lib/commonjs/specs/NativeFTReactNativeTrace.js.map +1 -0
- package/lib/commonjs/version.js +1 -1
- package/lib/commonjs/version.js.map +1 -1
- package/lib/module/ft_logger.js +14 -12
- package/lib/module/ft_logger.js.map +1 -1
- package/lib/module/ft_mobile_agent.js +159 -5
- package/lib/module/ft_mobile_agent.js.map +1 -1
- package/lib/module/ft_rum.js +54 -16
- package/lib/module/ft_rum.js.map +1 -1
- package/lib/module/ft_tracing.js +29 -9
- package/lib/module/ft_tracing.js.map +1 -1
- package/lib/module/index.js +3 -3
- package/lib/module/index.js.map +1 -1
- package/lib/module/rum/FTRumActionTracking.js +10 -4
- package/lib/module/rum/FTRumActionTracking.js.map +1 -1
- package/lib/module/rum/FTRumErrorTracking.js +4 -4
- package/lib/module/rum/FTRumErrorTracking.js.map +1 -1
- package/lib/module/specs/NativeFTMobileReactNative.js +5 -0
- package/lib/module/specs/NativeFTMobileReactNative.js.map +1 -0
- package/lib/module/specs/NativeFTReactNativeLog.js +5 -0
- package/lib/module/specs/NativeFTReactNativeLog.js.map +1 -0
- package/lib/module/specs/NativeFTReactNativeRUM.js +5 -0
- package/lib/module/specs/NativeFTReactNativeRUM.js.map +1 -0
- package/lib/module/specs/NativeFTReactNativeTrace.js +5 -0
- package/lib/module/specs/NativeFTReactNativeTrace.js.map +1 -0
- package/lib/module/version.js +1 -1
- package/lib/module/version.js.map +1 -1
- package/lib/typescript/ft_logger.d.ts +6 -6
- package/lib/typescript/ft_mobile_agent.d.ts +165 -14
- package/lib/typescript/ft_rum.d.ts +32 -8
- package/lib/typescript/ft_tracing.d.ts +6 -6
- package/lib/typescript/index.d.ts +3 -3
- package/lib/typescript/specs/NativeFTMobileReactNative.d.ts +75 -0
- package/lib/typescript/specs/NativeFTReactNativeLog.d.ts +23 -0
- package/lib/typescript/specs/NativeFTReactNativeRUM.d.ts +89 -0
- package/lib/typescript/specs/NativeFTReactNativeTrace.d.ts +24 -0
- package/lib/typescript/version.d.ts +1 -1
- package/package.json +29 -96
- package/scripts/replace-react-require.js +37 -38
- package/src/ft_logger.tsx +71 -40
- package/src/ft_mobile_agent.tsx +374 -92
- package/src/ft_rum.tsx +227 -123
- package/src/ft_tracing.tsx +58 -38
- package/src/index.tsx +58 -16
- package/src/rum/FTRumActionTracking.tsx +212 -204
- package/src/rum/FTRumErrorTracking.tsx +70 -71
- package/src/specs/NativeFTMobileReactNative.ts +83 -0
- package/src/specs/NativeFTReactNativeLog.ts +29 -0
- package/src/specs/NativeFTReactNativeRUM.ts +104 -0
- package/src/specs/NativeFTReactNativeTrace.ts +26 -0
- package/src/version.ts +1 -1
- package/LICENSE +0 -201
- package/android/.project +0 -17
- package/android/.settings/org.eclipse.buildship.core.prefs +0 -13
- package/android/gradlew +0 -185
- package/android/local.properties +0 -8
- package/android/src/main/java/com/ft/sdk/InnerClassProxy.java +0 -8
- package/ios/.idea/.name +0 -1
- package/ios/.idea/ios.iml +0 -2
- package/ios/.idea/modules.xml +0 -8
- package/ios/.idea/vcs.xml +0 -6
- package/ios/.idea/xcode.xml +0 -4
- package/ios/FTMobileReactNative.m +0 -183
- package/ios/FTReactNativeLog.m +0 -60
- package/ios/FTReactNativeTrace.m +0 -58
- package/ios/FtMobileAgent.xcodeproj/project.xcworkspace/contents.xcworkspacedata +0 -4
- package/ios/FtMobileAgent.xcodeproj/project.xcworkspace/xcuserdata/Brandon.xcuserdatad/UserInterfaceState.xcuserstate +0 -0
- package/ios/FtMobileAgent.xcodeproj/project.xcworkspace/xcuserdata/Brandon.xcuserdatad/xcschemes/xcschememanagement.plist +0 -5
- package/ios/FtMobileAgent.xcodeproj/xcuserdata/Brandon.xcuserdatad/xcschemes/FtMobileAgent.xcscheme +0 -56
- package/ios/FtMobileAgent.xcodeproj/xcuserdata/Brandon.xcuserdatad/xcschemes/xcschememanagement.plist +0 -14
- package/ios/RCTVersion.h +0 -8
package/src/ft_rum.tsx
CHANGED
|
@@ -1,33 +1,73 @@
|
|
|
1
|
-
import { NativeModules } from 'react-native';
|
|
2
|
-
import { FTRumErrorTracking} from './rum/FTRumErrorTracking';
|
|
3
|
-
import { FTRumActionTracking} from './rum/FTRumActionTracking';
|
|
1
|
+
// import { NativeModules } from 'react-native';
|
|
2
|
+
import { FTRumErrorTracking } from './rum/FTRumErrorTracking';
|
|
3
|
+
import { FTRumActionTracking } from './rum/FTRumActionTracking';
|
|
4
|
+
import { bridgeContextManager } from './ft_mobile_agent';
|
|
4
5
|
|
|
5
6
|
/**
|
|
6
7
|
* Error monitoring type.
|
|
7
8
|
*/
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
9
|
+
/* eslint-disable no-bitwise */
|
|
10
|
+
export enum ErrorMonitorType {
|
|
11
|
+
all = 0xffffffff,
|
|
12
|
+
battery = 1 << 1,
|
|
13
|
+
memory = 1 << 2,
|
|
14
|
+
cpu = 1 << 3,
|
|
15
|
+
}
|
|
16
|
+
/**
|
|
17
|
+
* Page monitoring supplement type
|
|
18
|
+
*/
|
|
19
|
+
export enum DeviceMetricsMonitorType {
|
|
20
|
+
all = 0xffffffff,
|
|
21
|
+
battery = 1 << 1,
|
|
22
|
+
memory = 1 << 2,
|
|
23
|
+
cpu = 1 << 3,
|
|
24
|
+
fps = 1 << 4,
|
|
25
|
+
}
|
|
26
|
+
/**
|
|
27
|
+
* Device information monitoring cycle.
|
|
28
|
+
*/
|
|
29
|
+
export enum DetectFrequency {
|
|
30
|
+
normal,
|
|
31
|
+
frequent,
|
|
32
|
+
rare,
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
export enum FTRUMCacheDiscard {
|
|
36
|
+
discard,
|
|
37
|
+
discardOldest,
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
export enum IOSCrashMonitoringType {
|
|
41
|
+
/** Monitor Mach kernel exceptions. */
|
|
42
|
+
machException = 0x01,
|
|
28
43
|
|
|
29
|
-
|
|
44
|
+
/** Monitor fatal signals. */
|
|
45
|
+
signal = 0x02,
|
|
30
46
|
|
|
47
|
+
/** Monitor uncaught C++ exceptions. */
|
|
48
|
+
cppException = 0x04,
|
|
49
|
+
|
|
50
|
+
/** Monitor uncaught Objective-C NSExceptions. */
|
|
51
|
+
nsException = 0x08,
|
|
52
|
+
|
|
53
|
+
/** Track and inject system information. */
|
|
54
|
+
system = 0x40,
|
|
55
|
+
|
|
56
|
+
/** Track and inject application state information. */
|
|
57
|
+
applicationState = 0x80,
|
|
58
|
+
|
|
59
|
+
/** All crash monitor types. */
|
|
60
|
+
all = machException |
|
|
61
|
+
signal |
|
|
62
|
+
cppException |
|
|
63
|
+
nsException |
|
|
64
|
+
applicationState |
|
|
65
|
+
system,
|
|
66
|
+
|
|
67
|
+
/** High compatibility crash monitor types (excludes Mach exceptions). */
|
|
68
|
+
highCompatibility = all & ~machException,
|
|
69
|
+
}
|
|
70
|
+
/* eslint-enable no-bitwise */
|
|
31
71
|
/**
|
|
32
72
|
* Set RUM tracking conditions.
|
|
33
73
|
* @param androidAppId appId, apply during monitoring
|
|
@@ -50,29 +90,35 @@ import { FTRumActionTracking} from './rum/FTRumActionTracking';
|
|
|
50
90
|
* @param globalContext custom global parameters
|
|
51
91
|
* @param rumCacheLimitCount RUM max cache size, default 100_000
|
|
52
92
|
* @param rumDiscardStrategy RUM data discard strategy
|
|
93
|
+
* @param enableTraceWebView Set whether to enable WebView data collection, default true
|
|
94
|
+
* @param allowWebViewHost Set specific hosts or domains allowed to collect WebView data, nil means collect all
|
|
95
|
+
* @param iosCrashMonitoringType iOS crash monitoring type , default is highCompatibility, which does not include Mach exceptions for better compatibility. you must enable system crash monitoring to get crash stack traces and crash information.
|
|
53
96
|
*/
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
97
|
+
export interface FTRUMConfig {
|
|
98
|
+
androidAppId: string;
|
|
99
|
+
iOSAppId: string;
|
|
100
|
+
sampleRate?: number;
|
|
101
|
+
sessionOnErrorSampleRate?: number;
|
|
102
|
+
enableAutoTrackUserAction?: boolean;
|
|
103
|
+
enableAutoTrackError?: boolean;
|
|
104
|
+
enableTrackNativeCrash?: boolean;
|
|
105
|
+
enableTrackNativeAppANR?: boolean;
|
|
106
|
+
enableTrackNativeFreeze?: boolean;
|
|
107
|
+
nativeFreezeDurationMs?: number;
|
|
108
|
+
enableNativeUserAction?: boolean;
|
|
109
|
+
enableNativeUserView?: boolean;
|
|
110
|
+
enableNativeUserResource?: boolean;
|
|
111
|
+
enableResourceHostIP?: boolean;
|
|
112
|
+
errorMonitorType?: ErrorMonitorType;
|
|
113
|
+
deviceMonitorType?: DeviceMetricsMonitorType;
|
|
114
|
+
detectFrequency?: DetectFrequency;
|
|
115
|
+
globalContext?: object;
|
|
116
|
+
rumCacheLimitCount?: number;
|
|
117
|
+
rumDiscardStrategy?: FTRUMCacheDiscard;
|
|
118
|
+
enableTraceWebView?: boolean;
|
|
119
|
+
allowWebViewHost?: Array<string>;
|
|
120
|
+
iosCrashMonitoringType?: IOSCrashMonitoringType;
|
|
121
|
+
}
|
|
76
122
|
/**
|
|
77
123
|
* RUM Resource data.
|
|
78
124
|
* @param url request URL
|
|
@@ -82,14 +128,14 @@ import { FTRumActionTracking} from './rum/FTRumActionTracking';
|
|
|
82
128
|
* @param responseBody response content
|
|
83
129
|
* @param resourceStatus response status code
|
|
84
130
|
*/
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
131
|
+
export interface FTRUMResource {
|
|
132
|
+
url: string;
|
|
133
|
+
httpMethod: string;
|
|
134
|
+
requestHeader: object;
|
|
135
|
+
responseHeader?: object;
|
|
136
|
+
responseBody?: string;
|
|
137
|
+
resourceStatus?: number;
|
|
138
|
+
}
|
|
93
139
|
/**
|
|
94
140
|
* RUM Resource performance metrics.
|
|
95
141
|
* @param duration resource load time
|
|
@@ -100,23 +146,22 @@ import { FTRumActionTracking} from './rum/FTRumActionTracking';
|
|
|
100
146
|
* @param resource_trans resource content transfer time
|
|
101
147
|
* @param resource_first_byte resource first byte time
|
|
102
148
|
*/
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
type FTReactNativeRUMType = {
|
|
149
|
+
export interface FTRUMResourceMetrics {
|
|
150
|
+
duration?: number;
|
|
151
|
+
resource_dns?: number;
|
|
152
|
+
resource_tcp?: number;
|
|
153
|
+
resource_ssl?: number;
|
|
154
|
+
resource_ttfb?: number;
|
|
155
|
+
resource_trans?: number;
|
|
156
|
+
resource_first_byte?: number;
|
|
157
|
+
}
|
|
158
|
+
type FTReactNativeRUMType = {
|
|
114
159
|
/**
|
|
115
160
|
* Set RUM tracking conditions and enable RUM collection.
|
|
116
161
|
* @param config rum configuration parameters.
|
|
117
162
|
* @returns a Promise.
|
|
118
163
|
*/
|
|
119
|
-
|
|
164
|
+
setConfig(config: FTRUMConfig): Promise<void>;
|
|
120
165
|
/**
|
|
121
166
|
* Start RUM Action.
|
|
122
167
|
* RUM will bind Resource, Error, LongTask events that may be triggered by this Action.
|
|
@@ -127,35 +172,43 @@ import { FTRumActionTracking} from './rum/FTRumActionTracking';
|
|
|
127
172
|
* @param property event context (optional)
|
|
128
173
|
* @returns a Promise.
|
|
129
174
|
*/
|
|
130
|
-
|
|
131
|
-
|
|
175
|
+
startAction(
|
|
176
|
+
actionName: string,
|
|
177
|
+
actionType: string,
|
|
178
|
+
property?: object
|
|
179
|
+
): Promise<void>;
|
|
180
|
+
/**
|
|
132
181
|
* Add Action event. This type of data cannot be associated with Error, Resource, LongTask data, and has no discard logic.
|
|
133
182
|
* @param actionName action name
|
|
134
183
|
* @param actionType action type
|
|
135
184
|
* @param property event context (optional)
|
|
136
185
|
* @returns a Promise.
|
|
137
186
|
*/
|
|
138
|
-
|
|
187
|
+
addAction(
|
|
188
|
+
actionName: string,
|
|
189
|
+
actionType: string,
|
|
190
|
+
property?: object
|
|
191
|
+
): Promise<void>;
|
|
139
192
|
/**
|
|
140
193
|
* view load duration.
|
|
141
194
|
* @param viewName view name
|
|
142
195
|
* @param loadTime view load duration
|
|
143
196
|
* @returns a Promise.
|
|
144
197
|
*/
|
|
145
|
-
|
|
198
|
+
onCreateView(viewName: string, loadTime: number): Promise<void>;
|
|
146
199
|
/**
|
|
147
200
|
* view start.
|
|
148
201
|
* @param viewName page name
|
|
149
202
|
* @param property event context (optional)
|
|
150
203
|
* @returns a Promise.
|
|
151
204
|
*/
|
|
152
|
-
|
|
205
|
+
startView(viewName: string, property?: object): Promise<void>;
|
|
153
206
|
/**
|
|
154
207
|
* view end.
|
|
155
208
|
* @param property event context (optional)
|
|
156
209
|
* @returns a Promise.
|
|
157
210
|
*/
|
|
158
|
-
|
|
211
|
+
stopView(property?: object): Promise<void>;
|
|
159
212
|
/**
|
|
160
213
|
* Exception capture and log collection.
|
|
161
214
|
* @param stack stack log
|
|
@@ -163,7 +216,7 @@ import { FTRumActionTracking} from './rum/FTRumActionTracking';
|
|
|
163
216
|
* @param property event context (optional)
|
|
164
217
|
* @returns a Promise.
|
|
165
218
|
*/
|
|
166
|
-
|
|
219
|
+
addError(stack: string, message: string, property?: object): Promise<void>;
|
|
167
220
|
/**
|
|
168
221
|
* Exception capture and log collection.
|
|
169
222
|
* @param type error type
|
|
@@ -172,21 +225,26 @@ import { FTRumActionTracking} from './rum/FTRumActionTracking';
|
|
|
172
225
|
* @param property event context (optional)
|
|
173
226
|
* @returns a Promise.
|
|
174
227
|
*/
|
|
175
|
-
|
|
228
|
+
addErrorWithType(
|
|
229
|
+
type: string,
|
|
230
|
+
stack: string,
|
|
231
|
+
message: string,
|
|
232
|
+
property?: object
|
|
233
|
+
): Promise<void>;
|
|
176
234
|
/**
|
|
177
235
|
* Start resource request.
|
|
178
236
|
* @param key unique id
|
|
179
237
|
* @param property event context (optional)
|
|
180
238
|
* @returns a Promise.
|
|
181
239
|
*/
|
|
182
|
-
|
|
240
|
+
startResource(key: string, property?: object): Promise<void>;
|
|
183
241
|
/**
|
|
184
242
|
* End resource request.
|
|
185
243
|
* @param key unique id
|
|
186
244
|
* @param property event context (optional)
|
|
187
245
|
* @returns a Promise.
|
|
188
246
|
*/
|
|
189
|
-
|
|
247
|
+
stopResource(key: string, property?: object): Promise<void>;
|
|
190
248
|
/**
|
|
191
249
|
* Send resource data metrics.
|
|
192
250
|
* @param key unique id
|
|
@@ -194,54 +252,100 @@ import { FTRumActionTracking} from './rum/FTRumActionTracking';
|
|
|
194
252
|
* @param metrics resource performance data
|
|
195
253
|
* @returns a Promise.
|
|
196
254
|
*/
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
255
|
+
addResource(
|
|
256
|
+
key: string,
|
|
257
|
+
resource: FTRUMResource,
|
|
258
|
+
metrics?: FTRUMResourceMetrics
|
|
259
|
+
): Promise<void>;
|
|
260
|
+
};
|
|
202
261
|
|
|
262
|
+
class FTReactNativeRUMWrapper implements FTReactNativeRUMType {
|
|
263
|
+
// eslint-disable-next-line @typescript-eslint/no-var-requires
|
|
264
|
+
private rum: FTReactNativeRUMType = require('./specs/NativeFTReactNativeRUM')
|
|
265
|
+
.default;
|
|
203
266
|
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
}
|
|
214
|
-
startAction(actionName:string,actionType:string,property?:object): Promise<void>{
|
|
215
|
-
return this.rum.startAction(actionName,actionType,property);
|
|
216
|
-
}
|
|
217
|
-
addAction(actionName: string, actionType: string, property?: object): Promise<void> {
|
|
218
|
-
return this.rum.addAction(actionName,actionType,property);
|
|
219
|
-
}
|
|
220
|
-
onCreateView(viewName:string,loadTime:number): Promise<void>{
|
|
221
|
-
return this.rum.onCreateView(viewName,loadTime);
|
|
222
|
-
}
|
|
223
|
-
startView(viewName: string, property?:object): Promise<void>{
|
|
224
|
-
return this.rum.startView(viewName,property);
|
|
225
|
-
}
|
|
226
|
-
stopView(property?:object): Promise<void>{
|
|
227
|
-
return this.rum.stopView(property);
|
|
228
|
-
}
|
|
229
|
-
addError(stack: string, message: string,property?:object): Promise<void>{
|
|
230
|
-
return this.rum.addError(stack,message,property);
|
|
231
|
-
}
|
|
232
|
-
addErrorWithType(type:string,stack: string, message: string,property?:object): Promise<void>{
|
|
233
|
-
return this.rum.addErrorWithType(type,stack,message,property);
|
|
267
|
+
setConfig(config: FTRUMConfig): Promise<void> {
|
|
268
|
+
console.log('FTRUMConfig');
|
|
269
|
+
if (config.enableAutoTrackError) {
|
|
270
|
+
FTRumErrorTracking.startTracking();
|
|
271
|
+
}
|
|
272
|
+
if (config.enableAutoTrackUserAction) {
|
|
273
|
+
FTRumActionTracking.startTracking();
|
|
274
|
+
}
|
|
275
|
+
return this.rum.setConfig(config);
|
|
234
276
|
}
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
|
|
277
|
+
startAction(
|
|
278
|
+
actionName: string,
|
|
279
|
+
actionType: string,
|
|
280
|
+
property?: object
|
|
281
|
+
): Promise<void> {
|
|
282
|
+
// Automatically merge bridge context properties with local properties
|
|
283
|
+
const mergedProperties =
|
|
284
|
+
bridgeContextManager.mergeWithLocalPropertiesSync(property);
|
|
285
|
+
return this.rum.startAction(actionName, actionType, mergedProperties);
|
|
286
|
+
}
|
|
287
|
+
addAction(
|
|
288
|
+
actionName: string,
|
|
289
|
+
actionType: string,
|
|
290
|
+
property?: object
|
|
291
|
+
): Promise<void> {
|
|
292
|
+
// Automatically merge bridge context properties with local properties
|
|
293
|
+
const mergedProperties =
|
|
294
|
+
bridgeContextManager.mergeWithLocalPropertiesSync(property);
|
|
295
|
+
return this.rum.addAction(actionName, actionType, mergedProperties);
|
|
296
|
+
}
|
|
297
|
+
onCreateView(viewName: string, loadTime: number): Promise<void> {
|
|
298
|
+
return this.rum.onCreateView(viewName, loadTime);
|
|
299
|
+
}
|
|
300
|
+
startView(viewName: string, property?: object): Promise<void> {
|
|
301
|
+
// Automatically merge bridge context properties with local properties
|
|
302
|
+
const mergedProperties =
|
|
303
|
+
bridgeContextManager.mergeWithLocalPropertiesSync(property);
|
|
304
|
+
return this.rum.startView(viewName, mergedProperties);
|
|
305
|
+
}
|
|
306
|
+
stopView(property?: object): Promise<void> {
|
|
307
|
+
// Automatically merge bridge context properties with local properties
|
|
308
|
+
const mergedProperties =
|
|
309
|
+
bridgeContextManager.mergeWithLocalPropertiesSync(property);
|
|
310
|
+
return this.rum.stopView(mergedProperties);
|
|
311
|
+
}
|
|
312
|
+
addError(stack: string, message: string, property?: object): Promise<void> {
|
|
313
|
+
// Automatically merge bridge context properties with local properties
|
|
314
|
+
const mergedProperties =
|
|
315
|
+
bridgeContextManager.mergeWithLocalPropertiesSync(property);
|
|
316
|
+
return this.rum.addError(stack, message, mergedProperties);
|
|
317
|
+
}
|
|
318
|
+
addErrorWithType(
|
|
319
|
+
type: string,
|
|
320
|
+
stack: string,
|
|
321
|
+
message: string,
|
|
322
|
+
property?: object
|
|
323
|
+
): Promise<void> {
|
|
324
|
+
// Automatically merge bridge context properties with local properties
|
|
325
|
+
const mergedProperties =
|
|
326
|
+
bridgeContextManager.mergeWithLocalPropertiesSync(property);
|
|
327
|
+
return this.rum.addErrorWithType(type, stack, message, mergedProperties);
|
|
328
|
+
}
|
|
329
|
+
startResource(key: string, property?: object): Promise<void> {
|
|
330
|
+
// Automatically merge bridge context properties with local properties
|
|
331
|
+
const mergedProperties =
|
|
332
|
+
bridgeContextManager.mergeWithLocalPropertiesSync(property);
|
|
333
|
+
return this.rum.startResource(key, mergedProperties);
|
|
334
|
+
}
|
|
335
|
+
stopResource(key: string, property?: object): Promise<void> {
|
|
336
|
+
// Automatically merge bridge context properties with local properties
|
|
337
|
+
const mergedProperties =
|
|
338
|
+
bridgeContextManager.mergeWithLocalPropertiesSync(property);
|
|
339
|
+
return this.rum.stopResource(key, mergedProperties);
|
|
340
|
+
}
|
|
341
|
+
addResource(
|
|
342
|
+
key: string,
|
|
343
|
+
resource: FTRUMResource,
|
|
344
|
+
metrics: FTRUMResourceMetrics = {}
|
|
345
|
+
): Promise<void> {
|
|
346
|
+
return this.rum.addResource(key, resource, metrics);
|
|
347
|
+
}
|
|
348
|
+
}
|
|
247
349
|
|
|
350
|
+
export const FTReactNativeRUM: FTReactNativeRUMType =
|
|
351
|
+
new FTReactNativeRUMWrapper();
|
package/src/ft_tracing.tsx
CHANGED
|
@@ -1,17 +1,36 @@
|
|
|
1
|
-
import { NativeModules } from 'react-native';
|
|
1
|
+
// import { NativeModules } from 'react-native';
|
|
2
2
|
//FTReactNativeTrace
|
|
3
3
|
|
|
4
4
|
/**
|
|
5
5
|
* Trace types for use.
|
|
6
6
|
*/
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
7
|
+
export enum TraceType {
|
|
8
|
+
//
|
|
9
|
+
// datadog trace
|
|
10
|
+
//
|
|
11
|
+
// x-datadog-trace-id
|
|
12
|
+
// x-datadog-parent-id
|
|
13
|
+
// x-datadog-sampling-priority
|
|
14
|
+
// x-datadog-origin
|
|
15
|
+
//
|
|
16
|
+
ddTrace,
|
|
17
|
+
//
|
|
18
|
+
// zipkin multi header
|
|
19
|
+
//
|
|
20
|
+
// X-B3-TraceId
|
|
21
|
+
// X-B3-SpanId
|
|
22
|
+
// X-B3-Sampled
|
|
23
|
+
//
|
|
24
|
+
zipkinMulti,
|
|
25
|
+
/// zipkin single header,b3
|
|
26
|
+
zipkinSingle,
|
|
27
|
+
// w3c, traceparent
|
|
28
|
+
traceparent,
|
|
29
|
+
// skywalking 8.0+, sw-8
|
|
30
|
+
skywalking,
|
|
31
|
+
// jaeger, header uber-trace-id
|
|
32
|
+
jaeger,
|
|
33
|
+
}
|
|
15
34
|
/**
|
|
16
35
|
* Configure trace.
|
|
17
36
|
* @param sampleRate sampling rate
|
|
@@ -19,61 +38,62 @@ import { NativeModules } from 'react-native';
|
|
|
19
38
|
* @param enableLinkRUMData whether to link with RUM data
|
|
20
39
|
* @param enableNativeAutoTrace whether to enable automatic tracing
|
|
21
40
|
*/
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
41
|
+
export interface FTTraceConfig {
|
|
42
|
+
sampleRate?: number;
|
|
43
|
+
traceType?: TraceType;
|
|
44
|
+
enableLinkRUMData?: boolean;
|
|
45
|
+
enableNativeAutoTrace?: boolean;
|
|
46
|
+
}
|
|
28
47
|
|
|
29
|
-
|
|
48
|
+
type FTReactNativeTraceType = {
|
|
30
49
|
/**
|
|
31
50
|
* Configure trace to enable distributed tracing.
|
|
32
51
|
* @param config trace configuration parameters.
|
|
33
52
|
* @returns a Promise.
|
|
34
53
|
*/
|
|
35
|
-
|
|
54
|
+
setConfig(config: FTTraceConfig): Promise<void>;
|
|
36
55
|
/**
|
|
37
56
|
* Get trace HTTP request header data.
|
|
38
57
|
* @param url request URL
|
|
39
58
|
* @returns trace request header parameters
|
|
40
59
|
* @deprecated use getTraceHeaderFields() replace.
|
|
41
60
|
*/
|
|
42
|
-
|
|
43
|
-
|
|
61
|
+
getTraceHeader(key: string, url: string): Promise<object>;
|
|
62
|
+
/**
|
|
44
63
|
* Get trace HTTP request header data.
|
|
45
64
|
* @param url request URL
|
|
46
65
|
* @returns trace request header parameters
|
|
47
66
|
*/
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
class FTReactNativeTraceWrapper implements FTReactNativeTraceType {
|
|
52
|
-
private trace: FTReactNativeTraceType = NativeModules.FTReactNativeTrace;
|
|
67
|
+
getTraceHeaderFields(url: string, key?: string): Promise<object>;
|
|
68
|
+
};
|
|
53
69
|
|
|
70
|
+
class FTReactNativeTraceWrapper implements FTReactNativeTraceType {
|
|
71
|
+
/* eslint-disable @typescript-eslint/no-var-requires */
|
|
72
|
+
private trace: FTReactNativeTraceType =
|
|
73
|
+
require('./specs/NativeFTReactNativeTrace').default;
|
|
74
|
+
/* eslint-enable @typescript-eslint/no-var-requires */
|
|
54
75
|
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
76
|
+
setConfig(config: FTTraceConfig): Promise<void> {
|
|
77
|
+
return this.trace.setConfig(config);
|
|
78
|
+
}
|
|
58
79
|
/**
|
|
59
80
|
* Get trace HTTP request header data.
|
|
60
81
|
* @param key unique id
|
|
61
82
|
* @param url request URL
|
|
62
83
|
* @returns a Promise.
|
|
63
84
|
*/
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
85
|
+
getTraceHeader(key: string, url: string): Promise<object> {
|
|
86
|
+
return this.trace.getTraceHeaderFields(url, key);
|
|
87
|
+
}
|
|
88
|
+
/**
|
|
68
89
|
* Get trace HTTP request header data.
|
|
69
90
|
* @param url request URL
|
|
70
91
|
* @param key unique id
|
|
71
92
|
* @returns a Promise.
|
|
72
93
|
*/
|
|
73
|
-
|
|
74
|
-
return this.trace.getTraceHeaderFields(url,key);
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
94
|
+
getTraceHeaderFields(url: string, key?: string): Promise<object> {
|
|
95
|
+
return this.trace.getTraceHeaderFields(url, key);
|
|
96
|
+
}
|
|
97
|
+
}
|
|
98
|
+
export const FTReactNativeTrace: FTReactNativeTraceType =
|
|
99
|
+
new FTReactNativeTraceWrapper();
|
package/src/index.tsx
CHANGED
|
@@ -1,17 +1,59 @@
|
|
|
1
|
-
import {
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
1
|
+
import {
|
|
2
|
+
FTMobileConfig,
|
|
3
|
+
FTMobileReactNative,
|
|
4
|
+
EnvType,
|
|
5
|
+
FTDBCacheDiscard,
|
|
6
|
+
FTRemoteConfigResult,
|
|
7
|
+
FTRemoteConfigOverrideRule,
|
|
8
|
+
FTRemoteConfigOverrideMatch,
|
|
9
|
+
FTRemoteConfigOverrideValues,
|
|
10
|
+
} from './ft_mobile_agent';
|
|
11
|
+
import {
|
|
12
|
+
FTLogConfig,
|
|
13
|
+
FTReactNativeLog,
|
|
14
|
+
FTLogStatus,
|
|
15
|
+
FTLogCacheDiscard,
|
|
16
|
+
} from './ft_logger';
|
|
17
|
+
import {
|
|
18
|
+
FTRUMConfig,
|
|
19
|
+
FTRUMResource,
|
|
20
|
+
FTReactNativeRUM,
|
|
21
|
+
ErrorMonitorType,
|
|
22
|
+
DeviceMetricsMonitorType,
|
|
23
|
+
DetectFrequency,
|
|
24
|
+
FTRUMResourceMetrics,
|
|
25
|
+
FTRUMCacheDiscard,
|
|
26
|
+
IOSCrashMonitoringType,
|
|
27
|
+
} from './ft_rum';
|
|
28
|
+
import { FTTraceConfig, FTReactNativeTrace, TraceType } from './ft_tracing';
|
|
29
|
+
import { FTRumActionTracking } from './rum/FTRumActionTracking';
|
|
30
|
+
import { FTRumErrorTracking } from './rum/FTRumErrorTracking';
|
|
17
31
|
|
|
32
|
+
export {
|
|
33
|
+
FTMobileReactNative,
|
|
34
|
+
FTMobileConfig,
|
|
35
|
+
EnvType,
|
|
36
|
+
FTDBCacheDiscard,
|
|
37
|
+
FTRemoteConfigResult,
|
|
38
|
+
FTRemoteConfigOverrideRule,
|
|
39
|
+
FTRemoteConfigOverrideMatch,
|
|
40
|
+
FTRemoteConfigOverrideValues,
|
|
41
|
+
FTLogConfig,
|
|
42
|
+
FTReactNativeLog,
|
|
43
|
+
FTLogStatus,
|
|
44
|
+
FTLogCacheDiscard,
|
|
45
|
+
FTRUMConfig,
|
|
46
|
+
FTReactNativeRUM,
|
|
47
|
+
FTRUMResource,
|
|
48
|
+
ErrorMonitorType,
|
|
49
|
+
DeviceMetricsMonitorType,
|
|
50
|
+
DetectFrequency,
|
|
51
|
+
FTRUMResourceMetrics,
|
|
52
|
+
FTRUMCacheDiscard,
|
|
53
|
+
IOSCrashMonitoringType,
|
|
54
|
+
FTTraceConfig,
|
|
55
|
+
FTReactNativeTrace,
|
|
56
|
+
TraceType,
|
|
57
|
+
FTRumActionTracking,
|
|
58
|
+
FTRumErrorTracking,
|
|
59
|
+
};
|