@dynatrace/react-native-plugin 2.337.3 → 2.341.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/README.md +122 -21
- package/android/build.gradle +1 -1
- package/android/src/main/java/com/dynatrace/android/agent/DynatraceRNBridgeImpl.kt +0 -1
- package/files/default.config.js +2 -0
- package/files/plugin.gradle +1 -1
- package/instrumentation/BabelPluginDynatrace.js +1 -1
- package/instrumentation/DynatraceInstrumentation.js +1 -1
- package/instrumentation/jsx/CreateElement.js +5 -9
- package/instrumentation/jsx/ElementHelper.js +5 -6
- package/instrumentation/jsx/JsxDevRuntime.js +33 -31
- package/instrumentation/jsx/JsxRuntime.js +30 -30
- package/instrumentation/jsx/JsxRuntimeHelpers.js +14 -0
- package/instrumentation/jsx/components/ClassComponent.js +6 -9
- package/instrumentation/jsx/components/ComponentUtil.js +24 -25
- package/instrumentation/libs/UserInteraction.js +27 -24
- package/instrumentation/libs/react-native/RefreshControl.js +5 -9
- package/instrumentation/libs/react-navigation/ReactNavigation.js +7 -4
- package/instrumentation/libs/withOnPressMonitoring.js +67 -55
- package/lib/core/Application.js +5 -2
- package/lib/core/Dynatrace.js +113 -44
- package/lib/core/DynatraceAction.js +78 -23
- package/lib/core/DynatraceInternal.js +39 -26
- package/lib/core/DynatraceRootAction.js +6 -3
- package/lib/core/DynatraceWebRequestTiming.js +25 -4
- package/lib/core/ErrorHandler.js +46 -19
- package/lib/core/NullAction.js +1 -3
- package/lib/core/logging/ConsoleLogger.js +17 -6
- package/lib/core/logging/LogMessages.js +764 -0
- package/lib/core/logging/LogType.js +9 -0
- package/lib/core/util/JsonUtils.js +6 -0
- package/lib/features/ui-interaction/IUserInteractionEvent.js +1 -1
- package/lib/features/ui-interaction/Runtime.js +7 -3
- package/lib/features/ui-interaction/TouchMetaResolver.js +4 -3
- package/lib/next/Dynatrace.js +42 -22
- package/lib/next/appstart/AppStartObserver.js +7 -2
- package/lib/next/events/EventPipeline.js +12 -5
- package/lib/next/events/EventTimestamp.js +5 -1
- package/lib/next/events/ExceptionEventData.js +1 -1
- package/lib/next/events/HttpRequestEventData.js +18 -9
- package/lib/next/events/interface/HttpRequestEventDataTypes.js +2 -0
- package/lib/next/events/modifier/BaseDataEventModifier.js +4 -1
- package/lib/next/events/modifier/EventModifierUtil.js +12 -5
- package/lib/next/events/modifier/ModifyEventValidation.js +99 -58
- package/lib/next/events/modifier/SendEventValidation.js +10 -4
- package/lib/next/events/modifier/StringLengthEventModifier.js +4 -1
- package/lib/next/events/modifier/ValueRestrictionModifier.js +5 -1
- package/lib/next/events/spec/EventSpecContstants.js +6 -2
- package/lib/next/util/TraceContextUtils.js +4 -3
- package/package.json +7 -5
- package/react-native-dynatrace.podspec +1 -1
- package/scripts/Config.js +7 -3
- package/scripts/DebugFlag.js +20 -0
- package/scripts/FileOperationHelper.js +15 -39
- package/scripts/Logger.js +2 -3
- package/scripts/core/InstrumentCall.js +101 -80
- package/scripts/util/CustomArgumentUtil.js +8 -6
- package/types.d.ts +159 -8
package/lib/core/Dynatrace.js
CHANGED
|
@@ -18,6 +18,7 @@ const DynatraceBridge_1 = require("./DynatraceBridge");
|
|
|
18
18
|
const DataCollectionLevel_1 = require("./model/DataCollectionLevel");
|
|
19
19
|
const UserPrivacyOptions_1 = require("./UserPrivacyOptions");
|
|
20
20
|
const ConsoleLogger_1 = require("./logging/ConsoleLogger");
|
|
21
|
+
const LogMessages_1 = require("./logging/LogMessages");
|
|
21
22
|
const ConfigurationHandler_1 = require("./configuration/ConfigurationHandler");
|
|
22
23
|
const DynatraceRootAction_1 = require("./DynatraceRootAction");
|
|
23
24
|
const NullRootAction_1 = require("./NullRootAction");
|
|
@@ -36,7 +37,7 @@ exports.Dynatrace = {
|
|
|
36
37
|
(0, ErrorHandler_1.startErrorHandler)(configuration.reportFatalErrorAsCrash);
|
|
37
38
|
}
|
|
38
39
|
else {
|
|
39
|
-
logger.debug(
|
|
40
|
+
logger.debug(LogMessages_1.LogMessage.ERROR_HANDLER_DISABLED);
|
|
40
41
|
}
|
|
41
42
|
Application_1.ApplicationHandler.startup(configuration);
|
|
42
43
|
}
|
|
@@ -45,7 +46,7 @@ exports.Dynatrace = {
|
|
|
45
46
|
}
|
|
46
47
|
}
|
|
47
48
|
else {
|
|
48
|
-
logger.debug(
|
|
49
|
+
logger.debug(LogMessages_1.LogMessage.CONFIGURATION_DUPLICATE_STARTUP);
|
|
49
50
|
}
|
|
50
51
|
}),
|
|
51
52
|
withMonitoring: (Component, name) => {
|
|
@@ -80,17 +81,20 @@ exports.Dynatrace = {
|
|
|
80
81
|
key = 'DEFAULT_' + DynatraceInternal_1.DynatraceInternal.getCounter();
|
|
81
82
|
}
|
|
82
83
|
if (!StringUtils_1.StringUtils.isStringNullEmptyOrUndefined(name)) {
|
|
83
|
-
logger.debug(
|
|
84
|
+
logger.debug(LogMessages_1.LogMessage.ENTER_MANUAL_ACTION, { name });
|
|
84
85
|
DynatraceBridge_1.DynatraceNative.enterManualAction(name, key, platform === null || platform === void 0 ? void 0 : platform.toString());
|
|
85
86
|
return new DynatraceRootAction_1.DynatraceRootAction(key, name);
|
|
86
87
|
}
|
|
87
88
|
else {
|
|
88
|
-
logger.debug(
|
|
89
|
+
logger.debug(LogMessages_1.LogMessage.ACTION_NAME_EMPTY);
|
|
89
90
|
return new NullRootAction_1.NullRootAction();
|
|
90
91
|
}
|
|
91
92
|
}
|
|
92
93
|
else {
|
|
93
|
-
logger.info(
|
|
94
|
+
logger.info(LogMessages_1.LogMessage.ACTION_NOT_STARTED, {
|
|
95
|
+
name,
|
|
96
|
+
actionType: 'enterManualAction',
|
|
97
|
+
});
|
|
94
98
|
return new NullRootAction_1.NullRootAction();
|
|
95
99
|
}
|
|
96
100
|
},
|
|
@@ -107,28 +111,34 @@ exports.Dynatrace = {
|
|
|
107
111
|
key = 'DEFAULT_' + DynatraceInternal_1.DynatraceInternal.getCounter();
|
|
108
112
|
}
|
|
109
113
|
if (!StringUtils_1.StringUtils.isStringNullEmptyOrUndefined(name)) {
|
|
110
|
-
logger.debug(
|
|
114
|
+
logger.debug(LogMessages_1.LogMessage.ENTER_AUTO_ACTION, { name });
|
|
111
115
|
DynatraceBridge_1.DynatraceNative.enterAction(name, key, platform === null || platform === void 0 ? void 0 : platform.toString());
|
|
112
116
|
return new DynatraceAction_1.DynatraceAction(key, name, false);
|
|
113
117
|
}
|
|
114
118
|
else {
|
|
115
|
-
logger.debug(
|
|
119
|
+
logger.debug(LogMessages_1.LogMessage.ACTION_NAME_EMPTY);
|
|
116
120
|
return new NullAction_1.NullAction();
|
|
117
121
|
}
|
|
118
122
|
}
|
|
119
123
|
else {
|
|
120
|
-
logger.info(
|
|
124
|
+
logger.info(LogMessages_1.LogMessage.ACTION_NOT_STARTED, {
|
|
125
|
+
name,
|
|
126
|
+
actionType: 'enterAutoAction',
|
|
127
|
+
});
|
|
121
128
|
return new NullAction_1.NullAction();
|
|
122
129
|
}
|
|
123
130
|
},
|
|
124
131
|
reportError: (errorName, errorCode, platform) => {
|
|
125
132
|
if (ConfigurationHandler_1.ConfigurationHandler.isConfigurationAvailable()) {
|
|
126
|
-
logger.debug(
|
|
133
|
+
logger.debug(LogMessages_1.LogMessage.REPORT_ERROR, { errorName, errorCode });
|
|
127
134
|
DynatraceBridge_1.DynatraceNative.reportErrorWithoutStacktrace(errorName, errorCode, platform === null || platform === void 0 ? void 0 : platform.toString());
|
|
128
135
|
DynatraceSecondGenForwarder_1.DynatraceSecondGenForwarder.reportError(errorName, errorCode);
|
|
129
136
|
}
|
|
130
137
|
else {
|
|
131
|
-
logger.info(
|
|
138
|
+
logger.info(LogMessages_1.LogMessage.REPORT_ERROR_NOT_STARTED, {
|
|
139
|
+
errorName,
|
|
140
|
+
errorCode,
|
|
141
|
+
});
|
|
132
142
|
}
|
|
133
143
|
},
|
|
134
144
|
reportErrorWithStacktrace: (errorName, reason, stacktrace, platform) => {
|
|
@@ -139,12 +149,20 @@ exports.Dynatrace = {
|
|
|
139
149
|
reason = reason.substring(0, reasonNewLineIndex);
|
|
140
150
|
}
|
|
141
151
|
}
|
|
142
|
-
logger.debug(
|
|
152
|
+
logger.debug(LogMessages_1.LogMessage.REPORT_ERROR_WITH_STACKTRACE, {
|
|
153
|
+
errorName,
|
|
154
|
+
reason,
|
|
155
|
+
stacktrace,
|
|
156
|
+
});
|
|
143
157
|
DynatraceBridge_1.DynatraceNative.reportError(errorName, '-', reason, stacktrace, platform === null || platform === void 0 ? void 0 : platform.toString());
|
|
144
158
|
DynatraceSecondGenForwarder_1.DynatraceSecondGenForwarder.reportErrorWithStacktrace(errorName, reason, stacktrace);
|
|
145
159
|
}
|
|
146
160
|
else {
|
|
147
|
-
logger.info(
|
|
161
|
+
logger.info(LogMessages_1.LogMessage.REPORT_ERROR_WITH_STACKTRACE_NOT_STARTED, {
|
|
162
|
+
errorName,
|
|
163
|
+
reason,
|
|
164
|
+
stacktrace,
|
|
165
|
+
});
|
|
148
166
|
}
|
|
149
167
|
},
|
|
150
168
|
reportErrorStacktrace: (errorName, errorValue, reason, stacktrace, platform) => {
|
|
@@ -155,12 +173,22 @@ exports.Dynatrace = {
|
|
|
155
173
|
reason = reason.substring(0, reasonNewLineIndex);
|
|
156
174
|
}
|
|
157
175
|
}
|
|
158
|
-
logger.debug(
|
|
176
|
+
logger.debug(LogMessages_1.LogMessage.REPORT_ERROR_STACKTRACE, {
|
|
177
|
+
errorName,
|
|
178
|
+
errorValue,
|
|
179
|
+
reason,
|
|
180
|
+
stacktrace,
|
|
181
|
+
});
|
|
159
182
|
DynatraceBridge_1.DynatraceNative.reportError(errorName, errorValue, reason, stacktrace, platform === null || platform === void 0 ? void 0 : platform.toString());
|
|
160
183
|
DynatraceSecondGenForwarder_1.DynatraceSecondGenForwarder.reportErrorStacktrace(errorName, errorValue, reason, stacktrace);
|
|
161
184
|
}
|
|
162
185
|
else {
|
|
163
|
-
logger.info(
|
|
186
|
+
logger.info(LogMessages_1.LogMessage.REPORT_ERROR_STACKTRACE_NOT_STARTED, {
|
|
187
|
+
errorName,
|
|
188
|
+
errorValue,
|
|
189
|
+
reason,
|
|
190
|
+
stacktrace,
|
|
191
|
+
});
|
|
164
192
|
}
|
|
165
193
|
},
|
|
166
194
|
reportCrash: (crashName, reason, stacktrace, platform) => {
|
|
@@ -172,13 +200,21 @@ exports.Dynatrace = {
|
|
|
172
200
|
reason = reason.substring(0, reasonNewLineIndex);
|
|
173
201
|
}
|
|
174
202
|
}
|
|
175
|
-
logger.debug(
|
|
203
|
+
logger.debug(LogMessages_1.LogMessage.REPORT_CRASH, {
|
|
204
|
+
crashName,
|
|
205
|
+
reason,
|
|
206
|
+
stacktrace,
|
|
207
|
+
});
|
|
176
208
|
DynatraceBridge_1.DynatraceNative.reportCrash(crashName, reason, stacktrace, false, platform === null || platform === void 0 ? void 0 : platform.toString());
|
|
177
209
|
DynatraceSecondGenForwarder_1.DynatraceSecondGenForwarder.reportCrash(crashName, reason, stacktrace);
|
|
178
210
|
}
|
|
179
211
|
}
|
|
180
212
|
else {
|
|
181
|
-
logger.info(
|
|
213
|
+
logger.info(LogMessages_1.LogMessage.REPORT_CRASH_NOT_STARTED, {
|
|
214
|
+
crashName,
|
|
215
|
+
reason,
|
|
216
|
+
stacktrace,
|
|
217
|
+
});
|
|
182
218
|
}
|
|
183
219
|
},
|
|
184
220
|
reportCrashWithException: (crashName, crash, platform) => {
|
|
@@ -192,110 +228,139 @@ exports.Dynatrace = {
|
|
|
192
228
|
crashReason = crashReason.substring(0, reasonNewLineIndex);
|
|
193
229
|
}
|
|
194
230
|
}
|
|
195
|
-
logger.debug(
|
|
231
|
+
logger.debug(LogMessages_1.LogMessage.REPORT_CRASH_WITH_EXCEPTION, {
|
|
232
|
+
crashName,
|
|
233
|
+
stack: crash.stack,
|
|
234
|
+
});
|
|
196
235
|
DynatraceBridge_1.DynatraceNative.reportCrash(crashName, crashReason, crash.stack, true, platform === null || platform === void 0 ? void 0 : platform.toString());
|
|
197
236
|
DynatraceSecondGenForwarder_1.DynatraceSecondGenForwarder.reportCrashWithException(crashName, crash);
|
|
198
237
|
}
|
|
199
238
|
}
|
|
200
239
|
else {
|
|
201
|
-
logger.info(
|
|
240
|
+
logger.info(LogMessages_1.LogMessage.REPORT_CRASH_WITH_EXCEPTION_NOT_STARTED, {
|
|
241
|
+
crashName,
|
|
242
|
+
crash: String(crash),
|
|
243
|
+
});
|
|
202
244
|
}
|
|
203
245
|
},
|
|
204
246
|
sendBizEvent: (type, attributes = {}, platform) => {
|
|
205
247
|
if (ConfigurationHandler_1.ConfigurationHandler.isConfigurationAvailable()) {
|
|
206
248
|
if (StringUtils_1.StringUtils.isStringNullEmptyOrUndefined(type)) {
|
|
207
|
-
logger.debug(
|
|
249
|
+
logger.debug(LogMessages_1.LogMessage.SEND_BIZ_EVENT_TYPE_EMPTY, {
|
|
250
|
+
type,
|
|
251
|
+
attributes: 'attributes',
|
|
252
|
+
});
|
|
208
253
|
return;
|
|
209
254
|
}
|
|
210
255
|
if (typeof attributes !== 'object' ||
|
|
211
256
|
attributes === null ||
|
|
212
257
|
Array.isArray(attributes)) {
|
|
213
|
-
logger.debug(
|
|
258
|
+
logger.debug(LogMessages_1.LogMessage.SEND_BIZ_EVENT_PAYLOAD_INVALID, {
|
|
259
|
+
type,
|
|
260
|
+
attributes: String(attributes),
|
|
261
|
+
});
|
|
214
262
|
return;
|
|
215
263
|
}
|
|
216
264
|
const internalAttributes = Object.assign({}, attributes);
|
|
217
|
-
logger.debug(
|
|
265
|
+
logger.debug(LogMessages_1.LogMessage.SEND_BIZ_EVENT, {
|
|
266
|
+
type,
|
|
267
|
+
attributes: JSON.stringify(internalAttributes),
|
|
268
|
+
});
|
|
218
269
|
DynatraceBridge_1.DynatraceNative.sendBizEvent(type, internalAttributes, platform === null || platform === void 0 ? void 0 : platform.toString());
|
|
219
270
|
}
|
|
220
271
|
else {
|
|
221
|
-
logger.info(
|
|
272
|
+
logger.info(LogMessages_1.LogMessage.SEND_BIZ_EVENT_NOT_STARTED, {
|
|
273
|
+
type,
|
|
274
|
+
attributes: 'attributes',
|
|
275
|
+
});
|
|
222
276
|
}
|
|
223
277
|
},
|
|
224
278
|
endSession: (platform) => {
|
|
225
279
|
if (ConfigurationHandler_1.ConfigurationHandler.isConfigurationAvailable()) {
|
|
226
|
-
logger.debug(
|
|
280
|
+
logger.debug(LogMessages_1.LogMessage.END_SESSION);
|
|
227
281
|
DynatraceBridge_1.DynatraceNative.endVisit(platform === null || platform === void 0 ? void 0 : platform.toString());
|
|
228
282
|
}
|
|
229
283
|
else {
|
|
230
|
-
logger.info(
|
|
284
|
+
logger.info(LogMessages_1.LogMessage.END_SESSION_NOT_STARTED);
|
|
231
285
|
}
|
|
232
286
|
},
|
|
233
287
|
identifyUser: (user, platform) => {
|
|
234
288
|
if (ConfigurationHandler_1.ConfigurationHandler.isConfigurationAvailable()) {
|
|
235
|
-
logger.debug(
|
|
289
|
+
logger.debug(LogMessages_1.LogMessage.IDENTIFY_USER, { user });
|
|
236
290
|
DynatraceBridge_1.DynatraceNative.identifyUser(user, platform === null || platform === void 0 ? void 0 : platform.toString());
|
|
237
291
|
}
|
|
238
292
|
else {
|
|
239
|
-
logger.info(
|
|
293
|
+
logger.info(LogMessages_1.LogMessage.IDENTIFY_USER_NOT_STARTED, { user });
|
|
240
294
|
}
|
|
241
295
|
},
|
|
242
296
|
setGPSLocation: (latitude, longitude, platform) => {
|
|
243
297
|
if (ConfigurationHandler_1.ConfigurationHandler.isConfigurationAvailable()) {
|
|
244
|
-
logger.debug(
|
|
298
|
+
logger.debug(LogMessages_1.LogMessage.SET_GPS_LOCATION, { latitude, longitude });
|
|
245
299
|
DynatraceBridge_1.DynatraceNative.setGPSLocation(latitude, longitude, platform === null || platform === void 0 ? void 0 : platform.toString());
|
|
246
300
|
}
|
|
247
301
|
else {
|
|
248
|
-
logger.info(
|
|
302
|
+
logger.info(LogMessages_1.LogMessage.SET_GPS_LOCATION_NOT_STARTED, {
|
|
303
|
+
latitude,
|
|
304
|
+
longitude,
|
|
305
|
+
});
|
|
249
306
|
}
|
|
250
307
|
},
|
|
251
308
|
isCrashReportingOptedIn: (platform) => __awaiter(void 0, void 0, void 0, function* () {
|
|
252
309
|
if (ConfigurationHandler_1.ConfigurationHandler.isConfigurationAvailable()) {
|
|
253
|
-
logger.debug(
|
|
310
|
+
logger.debug(LogMessages_1.LogMessage.IS_CRASH_REPORTING_OPTED_IN);
|
|
254
311
|
return DynatraceBridge_1.DynatraceNative.isCrashReportingOptedIn(platform === null || platform === void 0 ? void 0 : platform.toString());
|
|
255
312
|
}
|
|
256
313
|
else {
|
|
257
|
-
logger.info(
|
|
314
|
+
logger.info(LogMessages_1.LogMessage.IS_CRASH_REPORTING_OPTED_IN_NOT_STARTED);
|
|
258
315
|
return false;
|
|
259
316
|
}
|
|
260
317
|
}),
|
|
261
318
|
setCrashReportingOptedIn: (crashReporting, platform) => {
|
|
262
319
|
if (ConfigurationHandler_1.ConfigurationHandler.isConfigurationAvailable()) {
|
|
263
|
-
logger.debug(
|
|
320
|
+
logger.debug(LogMessages_1.LogMessage.SET_CRASH_REPORTING_OPTED_IN, {
|
|
321
|
+
crashReporting,
|
|
322
|
+
});
|
|
264
323
|
DynatraceBridge_1.DynatraceNative.setCrashReportingOptedIn(crashReporting, platform === null || platform === void 0 ? void 0 : platform.toString());
|
|
265
324
|
}
|
|
266
325
|
else {
|
|
267
|
-
logger.info(
|
|
326
|
+
logger.info(LogMessages_1.LogMessage.SET_CRASH_REPORTING_OPTED_IN_NOT_STARTED, {
|
|
327
|
+
crashReporting,
|
|
328
|
+
});
|
|
268
329
|
}
|
|
269
330
|
},
|
|
270
331
|
getDataCollectionLevel: (platform) => __awaiter(void 0, void 0, void 0, function* () {
|
|
271
332
|
if (ConfigurationHandler_1.ConfigurationHandler.isConfigurationAvailable()) {
|
|
272
|
-
logger.debug(
|
|
333
|
+
logger.debug(LogMessages_1.LogMessage.GET_DATA_COLLECTION_LEVEL);
|
|
273
334
|
return (0, DataCollectionLevel_1.StringToDataCollectionLevel)(yield DynatraceBridge_1.DynatraceNative.getDataCollectionLevel(platform === null || platform === void 0 ? void 0 : platform.toString()));
|
|
274
335
|
}
|
|
275
336
|
else {
|
|
276
|
-
logger.info(
|
|
337
|
+
logger.info(LogMessages_1.LogMessage.GET_DATA_COLLECTION_LEVEL_NOT_STARTED);
|
|
277
338
|
return DataCollectionLevel_1.DataCollectionLevel.Off;
|
|
278
339
|
}
|
|
279
340
|
}),
|
|
280
341
|
setDataCollectionLevel: (dataCollectionLevel, platform) => {
|
|
281
342
|
if (ConfigurationHandler_1.ConfigurationHandler.isConfigurationAvailable()) {
|
|
282
|
-
logger.debug(
|
|
343
|
+
logger.debug(LogMessages_1.LogMessage.SET_DATA_COLLECTION_LEVEL, {
|
|
344
|
+
dataCollectionLevel: String(dataCollectionLevel),
|
|
345
|
+
});
|
|
283
346
|
DynatraceBridge_1.DynatraceNative.setDataCollectionLevel(dataCollectionLevel.toString(), platform === null || platform === void 0 ? void 0 : platform.toString());
|
|
284
347
|
}
|
|
285
348
|
else {
|
|
286
|
-
logger.info(
|
|
349
|
+
logger.info(LogMessages_1.LogMessage.SET_DATA_COLLECTION_LEVEL_NOT_STARTED, {
|
|
350
|
+
dataCollectionLevel: String(dataCollectionLevel),
|
|
351
|
+
});
|
|
287
352
|
}
|
|
288
353
|
},
|
|
289
354
|
getUserPrivacyOptions: (platform) => __awaiter(void 0, void 0, void 0, function* () {
|
|
290
355
|
var _a;
|
|
291
356
|
if (ConfigurationHandler_1.ConfigurationHandler.isConfigurationAvailable()) {
|
|
292
|
-
logger.debug(
|
|
357
|
+
logger.debug(LogMessages_1.LogMessage.GET_USER_PRIVACY_OPTIONS);
|
|
293
358
|
const options = yield DynatraceBridge_1.DynatraceNative.getUserPrivacyOptions(platform === null || platform === void 0 ? void 0 : platform.toString());
|
|
294
359
|
const currentOptions = new UserPrivacyOptions_1.UserPrivacyOptions((0, DataCollectionLevel_1.StringToDataCollectionLevel)(options.dataCollectionLevel), options.crashReportingOptedIn, (_a = options.screenRecordOptedIn) !== null && _a !== void 0 ? _a : false);
|
|
295
360
|
return currentOptions;
|
|
296
361
|
}
|
|
297
362
|
else {
|
|
298
|
-
logger.info(
|
|
363
|
+
logger.info(LogMessages_1.LogMessage.GET_USER_PRIVACY_OPTIONS_NOT_STARTED);
|
|
299
364
|
return new UserPrivacyOptions_1.UserPrivacyOptions(DataCollectionLevel_1.DataCollectionLevel.Off, false);
|
|
300
365
|
}
|
|
301
366
|
}),
|
|
@@ -304,26 +369,30 @@ exports.Dynatrace = {
|
|
|
304
369
|
if ((userPrivacyOptions.crashReportingOptedIn === true ||
|
|
305
370
|
userPrivacyOptions.crashReportingOptedIn === false) &&
|
|
306
371
|
userPrivacyOptions.dataCollectionLevel in DataCollectionLevel_1.DataCollectionLevel) {
|
|
307
|
-
logger.debug(
|
|
372
|
+
logger.debug(LogMessages_1.LogMessage.APPLY_USER_PRIVACY_OPTIONS, {
|
|
373
|
+
userPrivacyOptions: JSON.stringify(userPrivacyOptions),
|
|
374
|
+
});
|
|
308
375
|
DynatraceBridge_1.DynatraceNative.applyUserPrivacyOptions(userPrivacyOptions, platform === null || platform === void 0 ? void 0 : platform.toString());
|
|
309
376
|
}
|
|
310
377
|
}
|
|
311
378
|
else {
|
|
312
|
-
logger.info(
|
|
379
|
+
logger.info(LogMessages_1.LogMessage.APPLY_USER_PRIVACY_OPTIONS_NOT_STARTED, {
|
|
380
|
+
userPrivacyOptions: JSON.stringify(userPrivacyOptions),
|
|
381
|
+
});
|
|
313
382
|
}
|
|
314
383
|
},
|
|
315
384
|
flushEvents: (platform) => {
|
|
316
385
|
if (ConfigurationHandler_1.ConfigurationHandler.isConfigurationAvailable()) {
|
|
317
|
-
logger.debug(
|
|
386
|
+
logger.debug(LogMessages_1.LogMessage.FLUSH_EVENTS);
|
|
318
387
|
DynatraceBridge_1.DynatraceNative.flushEvents(platform === null || platform === void 0 ? void 0 : platform.toString());
|
|
319
388
|
}
|
|
320
389
|
else {
|
|
321
|
-
logger.info(
|
|
390
|
+
logger.info(LogMessages_1.LogMessage.FLUSH_EVENTS_NOT_STARTED);
|
|
322
391
|
}
|
|
323
392
|
},
|
|
324
393
|
setBeaconHeaders: (headers, platform) => {
|
|
325
394
|
if (ConfigurationHandler_1.ConfigurationHandler.isConfigurationAvailable()) {
|
|
326
|
-
logger.debug(
|
|
395
|
+
logger.debug(LogMessages_1.LogMessage.SET_BEACON_HEADERS);
|
|
327
396
|
if (headers && headers.size > 0) {
|
|
328
397
|
const obj = {};
|
|
329
398
|
headers.forEach((value, key) => (obj[key] = value));
|
|
@@ -334,7 +403,7 @@ exports.Dynatrace = {
|
|
|
334
403
|
}
|
|
335
404
|
}
|
|
336
405
|
else {
|
|
337
|
-
logger.info(
|
|
406
|
+
logger.info(LogMessages_1.LogMessage.SET_BEACON_HEADERS_NOT_STARTED);
|
|
338
407
|
}
|
|
339
408
|
},
|
|
340
409
|
addEventModifier: (eventModifier) => Dynatrace_1.Dynatrace.addEventModifier(eventModifier),
|
|
@@ -4,6 +4,7 @@ exports.DynatraceAction = void 0;
|
|
|
4
4
|
const StringUtils_1 = require("./util/StringUtils");
|
|
5
5
|
const DynatraceBridge_1 = require("./DynatraceBridge");
|
|
6
6
|
const ConsoleLogger_1 = require("./logging/ConsoleLogger");
|
|
7
|
+
const LogMessages_1 = require("./logging/LogMessages");
|
|
7
8
|
class DynatraceAction {
|
|
8
9
|
constructor(key, name, manual) {
|
|
9
10
|
this.key = key;
|
|
@@ -14,96 +15,150 @@ class DynatraceAction {
|
|
|
14
15
|
}
|
|
15
16
|
reportError(errorName, errorCode, platform) {
|
|
16
17
|
if (this.closed) {
|
|
17
|
-
this.logger.debug(
|
|
18
|
+
this.logger.debug(LogMessages_1.LogMessage.ACTION_REPORT_ERROR_CLOSED, {
|
|
19
|
+
errorName,
|
|
20
|
+
errorCode,
|
|
21
|
+
});
|
|
18
22
|
return;
|
|
19
23
|
}
|
|
20
24
|
if (!StringUtils_1.StringUtils.isStringNullEmptyOrUndefined(errorName)) {
|
|
21
25
|
DynatraceBridge_1.DynatraceNative.reportErrorInAction(this.key, errorName, errorCode, platform === null || platform === void 0 ? void 0 : platform.toString());
|
|
22
|
-
this.logger.debug(
|
|
26
|
+
this.logger.debug(LogMessages_1.LogMessage.ACTION_REPORT_ERROR, {
|
|
27
|
+
errorName,
|
|
28
|
+
errorCode,
|
|
29
|
+
name: this.name,
|
|
30
|
+
});
|
|
23
31
|
}
|
|
24
32
|
else {
|
|
25
|
-
this.logger.debug(
|
|
33
|
+
this.logger.debug(LogMessages_1.LogMessage.ACTION_REPORT_ERROR_INVALID, {
|
|
34
|
+
errorName,
|
|
35
|
+
errorCode,
|
|
36
|
+
});
|
|
26
37
|
}
|
|
27
38
|
}
|
|
28
39
|
reportEvent(eventName, platform) {
|
|
29
40
|
if (this.closed) {
|
|
30
|
-
this.logger.debug(
|
|
41
|
+
this.logger.debug(LogMessages_1.LogMessage.ACTION_REPORT_EVENT_CLOSED, {
|
|
42
|
+
eventName,
|
|
43
|
+
});
|
|
31
44
|
return;
|
|
32
45
|
}
|
|
33
46
|
if (!StringUtils_1.StringUtils.isStringNullEmptyOrUndefined(eventName)) {
|
|
34
47
|
DynatraceBridge_1.DynatraceNative.reportEventInAction(this.key, eventName, platform === null || platform === void 0 ? void 0 : platform.toString());
|
|
35
|
-
this.logger.debug(
|
|
48
|
+
this.logger.debug(LogMessages_1.LogMessage.ACTION_REPORT_EVENT, {
|
|
49
|
+
eventName,
|
|
50
|
+
name: this.name,
|
|
51
|
+
});
|
|
36
52
|
}
|
|
37
53
|
else {
|
|
38
|
-
this.logger.debug(
|
|
54
|
+
this.logger.debug(LogMessages_1.LogMessage.ACTION_REPORT_EVENT_INVALID, {
|
|
55
|
+
eventName,
|
|
56
|
+
name: this.name,
|
|
57
|
+
});
|
|
39
58
|
}
|
|
40
59
|
}
|
|
41
60
|
reportStringValue(valueName, value, platform) {
|
|
42
61
|
if (this.closed) {
|
|
43
|
-
this.logger.debug(
|
|
62
|
+
this.logger.debug(LogMessages_1.LogMessage.ACTION_REPORT_STRING_VALUE_CLOSED, {
|
|
63
|
+
valueName,
|
|
64
|
+
value,
|
|
65
|
+
});
|
|
44
66
|
return;
|
|
45
67
|
}
|
|
46
68
|
if (!StringUtils_1.StringUtils.isStringNullEmptyOrUndefined(valueName) &&
|
|
47
69
|
!StringUtils_1.StringUtils.isStringNullEmptyOrUndefined(value)) {
|
|
48
70
|
DynatraceBridge_1.DynatraceNative.reportStringValueInAction(this.key, valueName, value, platform === null || platform === void 0 ? void 0 : platform.toString());
|
|
49
|
-
this.logger.debug(
|
|
71
|
+
this.logger.debug(LogMessages_1.LogMessage.ACTION_REPORT_STRING_VALUE, {
|
|
72
|
+
valueName,
|
|
73
|
+
value,
|
|
74
|
+
name: this.name,
|
|
75
|
+
});
|
|
50
76
|
}
|
|
51
77
|
else {
|
|
52
|
-
this.logger.debug(
|
|
78
|
+
this.logger.debug(LogMessages_1.LogMessage.ACTION_REPORT_STRING_VALUE_INVALID, {
|
|
79
|
+
valueName,
|
|
80
|
+
value,
|
|
81
|
+
name: this.name,
|
|
82
|
+
});
|
|
53
83
|
}
|
|
54
84
|
}
|
|
55
85
|
reportIntValue(valueName, value, platform) {
|
|
56
86
|
if (this.closed) {
|
|
57
|
-
this.logger.debug(
|
|
87
|
+
this.logger.debug(LogMessages_1.LogMessage.ACTION_REPORT_INT_VALUE_CLOSED, {
|
|
88
|
+
valueName,
|
|
89
|
+
value,
|
|
90
|
+
});
|
|
58
91
|
return;
|
|
59
92
|
}
|
|
60
93
|
if (!StringUtils_1.StringUtils.isStringNullEmptyOrUndefined(valueName)) {
|
|
61
94
|
DynatraceBridge_1.DynatraceNative.reportIntValueInAction(this.key, valueName, value, platform === null || platform === void 0 ? void 0 : platform.toString());
|
|
62
|
-
this.logger.debug(
|
|
95
|
+
this.logger.debug(LogMessages_1.LogMessage.ACTION_REPORT_INT_VALUE, {
|
|
96
|
+
valueName,
|
|
97
|
+
value,
|
|
98
|
+
name: this.name,
|
|
99
|
+
});
|
|
63
100
|
}
|
|
64
101
|
else {
|
|
65
|
-
this.logger.debug(
|
|
102
|
+
this.logger.debug(LogMessages_1.LogMessage.ACTION_REPORT_INT_VALUE_INVALID, {
|
|
103
|
+
valueName,
|
|
104
|
+
value,
|
|
105
|
+
name: this.name,
|
|
106
|
+
});
|
|
66
107
|
}
|
|
67
108
|
}
|
|
68
109
|
reportDoubleValue(valueName, value, platform) {
|
|
69
110
|
if (this.closed) {
|
|
70
|
-
this.logger.debug(
|
|
111
|
+
this.logger.debug(LogMessages_1.LogMessage.ACTION_REPORT_DOUBLE_VALUE_CLOSED, {
|
|
112
|
+
valueName,
|
|
113
|
+
value,
|
|
114
|
+
});
|
|
71
115
|
return;
|
|
72
116
|
}
|
|
73
117
|
if (!StringUtils_1.StringUtils.isStringNullEmptyOrUndefined(valueName)) {
|
|
74
118
|
DynatraceBridge_1.DynatraceNative.reportDoubleValueInAction(this.key, valueName, value, platform === null || platform === void 0 ? void 0 : platform.toString());
|
|
75
|
-
this.logger.debug(
|
|
119
|
+
this.logger.debug(LogMessages_1.LogMessage.ACTION_REPORT_DOUBLE_VALUE, {
|
|
120
|
+
valueName,
|
|
121
|
+
value,
|
|
122
|
+
name: this.name,
|
|
123
|
+
});
|
|
76
124
|
}
|
|
77
125
|
else {
|
|
78
|
-
this.logger.debug(
|
|
126
|
+
this.logger.debug(LogMessages_1.LogMessage.ACTION_REPORT_DOUBLE_VALUE_INVALID, {
|
|
127
|
+
valueName,
|
|
128
|
+
value,
|
|
129
|
+
name: this.name,
|
|
130
|
+
});
|
|
79
131
|
}
|
|
80
132
|
}
|
|
81
133
|
leaveAction(platform) {
|
|
82
134
|
if (this.closed) {
|
|
83
|
-
this.logger.debug(
|
|
135
|
+
this.logger.debug(LogMessages_1.LogMessage.ACTION_LEAVE_CLOSED);
|
|
84
136
|
return;
|
|
85
137
|
}
|
|
86
138
|
this.closed = true;
|
|
87
|
-
this.logger.debug(
|
|
139
|
+
this.logger.debug(LogMessages_1.LogMessage.ACTION_LEAVE, { name: this.name });
|
|
88
140
|
DynatraceBridge_1.DynatraceNative.leaveAction(this.key, this.manual, platform === null || platform === void 0 ? void 0 : platform.toString());
|
|
89
141
|
}
|
|
90
142
|
cancel(platform) {
|
|
91
143
|
if (this.closed) {
|
|
92
|
-
this.logger.debug(
|
|
144
|
+
this.logger.debug(LogMessages_1.LogMessage.ACTION_CANCEL_CLOSED);
|
|
93
145
|
return;
|
|
94
146
|
}
|
|
95
147
|
this.closed = true;
|
|
96
|
-
this.logger.debug(
|
|
148
|
+
this.logger.debug(LogMessages_1.LogMessage.ACTION_CANCEL, { name: this.name });
|
|
97
149
|
DynatraceBridge_1.DynatraceNative.cancelAction(this.key, platform === null || platform === void 0 ? void 0 : platform.toString());
|
|
98
150
|
}
|
|
99
151
|
getRequestTag(url) {
|
|
100
152
|
if (this.closed) {
|
|
101
|
-
this.logger.debug(
|
|
102
|
-
|
|
103
|
-
resolve('');
|
|
153
|
+
this.logger.debug(LogMessages_1.LogMessage.ACTION_GET_REQUEST_TAG_CLOSED, {
|
|
154
|
+
url,
|
|
104
155
|
});
|
|
156
|
+
return Promise.resolve('');
|
|
105
157
|
}
|
|
106
|
-
this.logger.debug(
|
|
158
|
+
this.logger.debug(LogMessages_1.LogMessage.ACTION_GET_REQUEST_TAG, {
|
|
159
|
+
url,
|
|
160
|
+
name: this.name,
|
|
161
|
+
});
|
|
107
162
|
return DynatraceBridge_1.DynatraceNative.getRequestTag(this.key, url);
|
|
108
163
|
}
|
|
109
164
|
getRequestTagHeader() {
|
|
@@ -6,41 +6,54 @@ const Dynatrace_1 = require("../next/Dynatrace");
|
|
|
6
6
|
const DynatraceBridge_1 = require("./DynatraceBridge");
|
|
7
7
|
const StringUtils_1 = require("./util/StringUtils");
|
|
8
8
|
const ConsoleLogger_1 = require("./logging/ConsoleLogger");
|
|
9
|
+
const LogMessages_1 = require("./logging/LogMessages");
|
|
9
10
|
let counter = 0;
|
|
10
11
|
const logger = new ConsoleLogger_1.ConsoleLogger('DyntraceInt');
|
|
11
12
|
exports.DynatraceInternal = {
|
|
12
|
-
reportErrorFromHandler: (
|
|
13
|
-
if (
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
13
|
+
reportErrorFromHandler: (_isFatal, errorName, reason, stacktrace, isLegacyApiReported = false, platform) => {
|
|
14
|
+
if (StringUtils_1.StringUtils.isStringNullEmptyOrUndefined(stacktrace)) {
|
|
15
|
+
logger.debug(LogMessages_1.LogMessage.INTERNAL_REPORT_ERROR_SIMPLE, {
|
|
16
|
+
errorName,
|
|
17
|
+
});
|
|
18
|
+
DynatraceBridge_1.DynatraceNative.reportErrorWithoutStacktrace(errorName, -1);
|
|
19
|
+
Dynatrace_1.Dynatrace.reportErrorCode(errorName, -1, isLegacyApiReported);
|
|
20
|
+
}
|
|
21
|
+
else {
|
|
22
|
+
logger.debug(LogMessages_1.LogMessage.INTERNAL_REPORT_ERROR, {
|
|
23
|
+
errorName,
|
|
24
|
+
reason,
|
|
25
|
+
stacktrace,
|
|
26
|
+
});
|
|
27
|
+
DynatraceBridge_1.DynatraceNative.reportError(errorName, '-', reason, stacktrace, platform === null || platform === void 0 ? void 0 : platform.toString());
|
|
28
|
+
Dynatrace_1.Dynatrace.reportError({
|
|
23
29
|
name: errorName,
|
|
24
30
|
message: reason,
|
|
25
31
|
stack: stacktrace,
|
|
26
|
-
},
|
|
32
|
+
}, isLegacyApiReported);
|
|
33
|
+
}
|
|
34
|
+
},
|
|
35
|
+
reportFatalErrorAsCrashFromHandler: (isFatal, errorName, reason, stacktrace, platform) => {
|
|
36
|
+
if (react_native_1.Platform.OS === 'ios') {
|
|
37
|
+
logger.debug(LogMessages_1.LogMessage.STORE_CRASH, {
|
|
38
|
+
errorName,
|
|
39
|
+
reason,
|
|
40
|
+
stacktrace,
|
|
41
|
+
});
|
|
42
|
+
DynatraceBridge_1.DynatraceNative.storeCrash(errorName, reason, stacktrace);
|
|
27
43
|
}
|
|
28
44
|
else {
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
stack: stacktrace,
|
|
36
|
-
}, false);
|
|
37
|
-
}
|
|
38
|
-
else {
|
|
39
|
-
logger.debug(`reportError(${errorName})`);
|
|
40
|
-
DynatraceBridge_1.DynatraceNative.reportErrorWithoutStacktrace(errorName, -1);
|
|
41
|
-
Dynatrace_1.Dynatrace.reportErrorCode(errorName, -1, false);
|
|
42
|
-
}
|
|
45
|
+
logger.debug(LogMessages_1.LogMessage.REPORT_CRASH, {
|
|
46
|
+
crashName: errorName,
|
|
47
|
+
reason,
|
|
48
|
+
stacktrace,
|
|
49
|
+
});
|
|
50
|
+
DynatraceBridge_1.DynatraceNative.reportCrash(errorName, reason, stacktrace, true, platform === null || platform === void 0 ? void 0 : platform.toString());
|
|
43
51
|
}
|
|
52
|
+
Dynatrace_1.Dynatrace.reportCrash({
|
|
53
|
+
name: errorName,
|
|
54
|
+
message: reason,
|
|
55
|
+
stack: stacktrace,
|
|
56
|
+
}, false, isFatal);
|
|
44
57
|
},
|
|
45
58
|
getCounter: () => counter++,
|
|
46
59
|
};
|