@dynatrace/react-native-plugin 2.337.2 → 2.339.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.
Files changed (38) hide show
  1. package/README.md +11 -5
  2. package/android/build.gradle +1 -1
  3. package/files/default.config.js +2 -0
  4. package/files/plugin.gradle +1 -1
  5. package/instrumentation/jsx/components/ClassComponent.js +2 -1
  6. package/instrumentation/libs/UserInteraction.js +1 -1
  7. package/instrumentation/libs/react-navigation/ReactNavigation.js +7 -4
  8. package/instrumentation/libs/withOnPressMonitoring.js +5 -2
  9. package/lib/core/Application.js +5 -2
  10. package/lib/core/Dynatrace.js +113 -44
  11. package/lib/core/DynatraceAction.js +78 -21
  12. package/lib/core/DynatraceInternal.js +19 -4
  13. package/lib/core/DynatraceRootAction.js +6 -3
  14. package/lib/core/DynatraceWebRequestTiming.js +25 -4
  15. package/lib/core/ErrorHandler.js +9 -2
  16. package/lib/core/logging/ConsoleLogger.js +17 -6
  17. package/lib/core/logging/LogMessages.js +764 -0
  18. package/lib/core/logging/LogType.js +9 -0
  19. package/lib/features/ui-interaction/IUserInteractionEvent.js +1 -1
  20. package/lib/features/ui-interaction/Runtime.js +7 -3
  21. package/lib/next/Dynatrace.js +42 -22
  22. package/lib/next/appstart/AppStartObserver.js +7 -2
  23. package/lib/next/events/EventPipeline.js +12 -5
  24. package/lib/next/events/EventTimestamp.js +5 -1
  25. package/lib/next/events/ExceptionEventData.js +1 -1
  26. package/lib/next/events/HttpRequestEventData.js +16 -7
  27. package/lib/next/events/modifier/BaseDataEventModifier.js +4 -1
  28. package/lib/next/events/modifier/EventModifierUtil.js +12 -5
  29. package/lib/next/events/modifier/ModifyEventValidation.js +20 -7
  30. package/lib/next/events/modifier/SendEventValidation.js +10 -4
  31. package/lib/next/events/modifier/StringLengthEventModifier.js +4 -1
  32. package/lib/next/events/modifier/ValueRestrictionModifier.js +5 -1
  33. package/lib/next/events/spec/EventSpecContstants.js +6 -2
  34. package/lib/next/provider/TimestampProvider.js +1 -1
  35. package/lib/next/util/TraceContextUtils.js +4 -3
  36. package/package.json +5 -4
  37. package/react-native-dynatrace.podspec +1 -1
  38. package/scripts/Config.js +1 -1
package/README.md CHANGED
@@ -35,8 +35,8 @@ If you want to start using this plugin and are not a Dynatrace customer yet, hea
35
35
  ## Agent Versions
36
36
  These agent versions are configured in this plugin:
37
37
 
38
- * Android Agent: 8.337.3.1013
39
- * iOS Agent: 8.337.1.1003
38
+ * Android Agent: 8.339.1.1004
39
+ * iOS Agent: 8.339.1.1011
40
40
 
41
41
  ## Quick Setup
42
42
 
@@ -779,7 +779,6 @@ Dynatrace.sendSessionPropertyEvent(new SessionPropertyEventData()
779
779
  * If you send the same property multiple times, only one value will be kept (first or last)
780
780
  * Use session properties for data that applies to the entire user session
781
781
  * Field naming follows the same rules as events, but with `session_properties.` prefix
782
- * Additionally, the `duration` property is allowed
783
782
  * Maximum of 50 custom properties per event
784
783
  * If the limit is exceeded, properties are sorted alphabetically by key and excess properties are dropped deterministically
785
784
 
@@ -979,7 +978,7 @@ Dynatrace.startView("UserProfileDetailed");
979
978
 
980
979
  User Interaction is an automatic instrumentation feature that captures touch and press events in your React Native application without requiring any manual API calls. When enabled, the plugin instruments your UI components at build time and sends structured interaction events to Dynatrace at runtime.
981
980
 
982
- The following is an example of how this feature can be configured in your `dynatrace.config.js` file. Note that this feature is disabled by default.
981
+ The following is an example of how this feature can be configured in your `dynatrace.config.js` file. Note that this feature is enabled by default.
983
982
 
984
983
  ```js
985
984
  react: {
@@ -1050,7 +1049,7 @@ If masking is active for an interaction, the event still contains the same struc
1050
1049
  "ui_element.components": ["Pressable"],
1051
1050
  "ui_element.id": "App/View[1]/Pressable[1]",
1052
1051
  "ui_element.name_origin": "component",
1053
- "interaction.type": "touch",
1052
+ "interaction.name": "touch",
1054
1053
  "positions": [{ "x": 120, "y": 460 }],
1055
1054
  "ui_element.responder.detected_name": "Pressable",
1056
1055
  "ui_element.responder.components": ["Pressable"],
@@ -1988,6 +1987,13 @@ If you are struggling with a problem, submit a support ticket to Dynatrace (supp
1988
1987
  <br/><br/>
1989
1988
  ## Changelog
1990
1989
 
1990
+ 2.339.1
1991
+ * Updated Android (8.339.1.1004) & iOS Agent (8.339.1.1011)
1992
+ * Enabled User Interaction Feature by default
1993
+
1994
+ 2.337.3
1995
+ * Fixed issue causing fractional timestamps
1996
+
1991
1997
  2.337.2
1992
1998
  * Updated Android Agent (8.337.3.1013)
1993
1999
  * Fixed crash in `Dynatrace.getUserPrivacyOptions()` on Android
@@ -72,7 +72,7 @@ repositories {
72
72
  }
73
73
 
74
74
  dependencies {
75
- implementation 'com.dynatrace.agent:agent-android:8.337.3.1013'
75
+ implementation 'com.dynatrace.agent:agent-android:8.339.1.1004'
76
76
  implementation "com.facebook.react:react-native:${safeExtGet('reactNative', '+')}"
77
77
  }
78
78
 
@@ -48,6 +48,8 @@ module.exports = {
48
48
  }
49
49
  },
50
50
 
51
+ userInteraction: true,
52
+
51
53
  navigation: {
52
54
  /**
53
55
  * Enables the automatic instrumentation of @react-navigation
@@ -1,4 +1,4 @@
1
1
  // TEMPLATE: plugin-gradle.template
2
2
  dependencies {
3
- classpath 'com.dynatrace.tools.android:gradle-plugin:8.337.3.1013'
3
+ classpath 'com.dynatrace.tools.android:gradle-plugin:8.339.1.1004'
4
4
  }
@@ -5,6 +5,7 @@ const react_1 = require("react");
5
5
  const ConfigurationHandler_1 = require("../../../lib/core/configuration/ConfigurationHandler");
6
6
  const ConsoleLogger_1 = require("../../../lib/core/logging/ConsoleLogger");
7
7
  const Dynatrace_1 = require("../../../lib/core/Dynatrace");
8
+ const LogMessages_1 = require("../../../lib/core/logging/LogMessages");
8
9
  const ComponentUtil_1 = require("./ComponentUtil");
9
10
  class DynatraceClassComponent extends react_1.Component {
10
11
  constructor(props) {
@@ -15,7 +16,7 @@ class DynatraceClassComponent extends react_1.Component {
15
16
  }
16
17
  render() {
17
18
  if (!ConfigurationHandler_1.ConfigurationHandler.isConfigurationAvailable()) {
18
- this.logger.info('React Native plugin has not been started yet! Component will not be reported!');
19
+ this.logger.info(LogMessages_1.LogMessage.COMPONENT_NOT_STARTED);
19
20
  }
20
21
  else {
21
22
  if (ConfigurationHandler_1.ConfigurationHandler.isLifecycleUpdateEnabled() ||
@@ -80,7 +80,7 @@ const flushTouch = (responderComponentInfo) => {
80
80
  const { touchedComponentInfo, positions, timeoutId } = pendingTouch;
81
81
  clearTimeout(timeoutId);
82
82
  pendingTouch = null;
83
- const event = Object.assign({ 'characteristics.has_user_interaction': true, 'ui_element.detected_name': touchedComponentInfo.detectedName, 'ui_element.components': touchedComponentInfo.components, 'ui_element.id': touchedComponentInfo.id, 'interaction.type': 'touch', positions, 'ui_element.name_origin': touchedComponentInfo.nameOrigin }, (responderComponentInfo && {
83
+ const event = Object.assign({ 'characteristics.has_user_interaction': true, 'ui_element.detected_name': touchedComponentInfo.detectedName, 'ui_element.components': touchedComponentInfo.components, 'ui_element.id': touchedComponentInfo.id, 'interaction.name': 'touch', positions, 'ui_element.name_origin': touchedComponentInfo.nameOrigin }, (responderComponentInfo && {
84
84
  'ui_element.responder.detected_name': responderComponentInfo.detectedName,
85
85
  'ui_element.responder.components': responderComponentInfo.components,
86
86
  'ui_element.responder.id': responderComponentInfo.id,
@@ -4,6 +4,7 @@ exports.monitorNavigation = void 0;
4
4
  const react_1 = require("react");
5
5
  const react_native_1 = require("react-native");
6
6
  const ConsoleLogger_1 = require("../../../lib/core/logging/ConsoleLogger");
7
+ const LogMessages_1 = require("../../../lib/core/logging/LogMessages");
7
8
  const DynatraceBridge_1 = require("../../../lib/core/DynatraceBridge");
8
9
  const BaseDataEventModifier_1 = require("../../../lib/next/events/modifier/BaseDataEventModifier");
9
10
  const ConfigurationHandler_1 = require("../../../lib/core/configuration/ConfigurationHandler");
@@ -46,7 +47,7 @@ const monitorNavigation = (getRootState) => {
46
47
  exports.monitorNavigation = monitorNavigation;
47
48
  const startView = (newPath) => {
48
49
  if (!ConfigurationHandler_1.ConfigurationHandler.isConfigurationAvailable()) {
49
- logger.info('React Native plugin has not been started yet! Navigation will not be reported!');
50
+ logger.info(LogMessages_1.LogMessage.NAVIGATION_NOT_STARTED);
50
51
  return;
51
52
  }
52
53
  const startViewInternalEvent = new BaseDataEventModifier_1.BaseDataEventModifier().modifyEvent(Object.assign({ 'view.detected_name': newPath }, (activePath && {
@@ -56,16 +57,18 @@ const startView = (newPath) => {
56
57
  if (typeof fn === 'function') {
57
58
  fn(startViewInternalEvent);
58
59
  }
59
- logger.debug(`startViewinternal(${JSON.stringify(startViewInternalEvent)})`);
60
+ logger.debug(LogMessages_1.LogMessage.START_VIEW_INTERNAL, {
61
+ event: JSON.stringify(startViewInternalEvent),
62
+ });
60
63
  };
61
64
  const stopView = () => {
62
65
  if (!ConfigurationHandler_1.ConfigurationHandler.isConfigurationAvailable()) {
63
- logger.info('React Native plugin has not been started yet! Navigation will not be reported!');
66
+ logger.info(LogMessages_1.LogMessage.NAVIGATION_NOT_STARTED);
64
67
  return;
65
68
  }
66
69
  const fn = DynatraceBridge_1.DynatraceNative === null || DynatraceBridge_1.DynatraceNative === void 0 ? void 0 : DynatraceBridge_1.DynatraceNative.stopViewInternal;
67
70
  if (typeof fn === 'function') {
68
71
  fn();
69
72
  }
70
- logger.debug('stopViewInternal()');
73
+ logger.debug(LogMessages_1.LogMessage.STOP_VIEW_INTERNAL);
71
74
  };
@@ -4,6 +4,7 @@ exports.findTouchableName = exports.chooseTouchableName = exports.wrapOnPress =
4
4
  const ReactNative = require("react-native");
5
5
  const React = require("react");
6
6
  const ConsoleLogger_1 = require("../../lib/core/logging/ConsoleLogger");
7
+ const LogMessages_1 = require("../../lib/core/logging/LogMessages");
7
8
  const ConfigurationHandler_1 = require("../../lib/core/configuration/ConfigurationHandler");
8
9
  const Dynatrace_1 = require("../../lib/core/Dynatrace");
9
10
  const ComponentUtil_1 = require("../jsx/components/ComponentUtil");
@@ -71,7 +72,9 @@ const wrapOnPress = (onPress, touchableName, isButtonLike, buttonLabel) => {
71
72
  }
72
73
  catch (e) {
73
74
  const errorMsg = e instanceof Error ? e.stack || e.message : String(e);
74
- Logger.debug(`registerPress bridge hook failed: ${errorMsg}`);
75
+ Logger.debug(LogMessages_1.LogMessage.REGISTER_PRESS_HOOK_FAILED, {
76
+ errorMsg,
77
+ });
75
78
  }
76
79
  }
77
80
  if (args[0] &&
@@ -80,7 +83,7 @@ const wrapOnPress = (onPress, touchableName, isButtonLike, buttonLabel) => {
80
83
  (0, UserInteraction_1.notifyPress)(args[0]);
81
84
  }
82
85
  if (!ConfigurationHandler_1.ConfigurationHandler.isConfigurationAvailable()) {
83
- Logger.info('React Native plugin has not been started yet! Touch will not be reported!');
86
+ Logger.info(LogMessages_1.LogMessage.TOUCH_NOT_STARTED);
84
87
  onPress(...args);
85
88
  }
86
89
  else {
@@ -6,6 +6,7 @@ const RuntimeConfigurationObserver_1 = require("../next/configuration/RuntimeCon
6
6
  const ConfigurationBuilder_1 = require("./configuration/ConfigurationBuilder");
7
7
  const ConfigurationHandler_1 = require("./configuration/ConfigurationHandler");
8
8
  const ConsoleLogger_1 = require("./logging/ConsoleLogger");
9
+ const LogMessages_1 = require("./logging/LogMessages");
9
10
  AppStartObserver_1.AppStartObserver.call();
10
11
  RuntimeConfigurationObserver_1.RuntimeConfigurationObserver.call();
11
12
  const logger = new ConsoleLogger_1.ConsoleLogger('ApplicationHandler');
@@ -17,8 +18,10 @@ exports.ApplicationHandler = {
17
18
  config = new ConfigurationBuilder_1.ConfigurationBuilder('', '').buildConfiguration();
18
19
  }
19
20
  ConfigurationHandler_1.ConfigurationHandler.setConfiguration(config);
20
- logger.debug('Configuration set: ' + config.toString());
21
- logger.info('Dynatrace React Native Plugin started!');
21
+ logger.debug(LogMessages_1.LogMessage.CONFIGURATION_SET, {
22
+ config: config.toString(),
23
+ });
24
+ logger.info(LogMessages_1.LogMessage.PLUGIN_STARTED);
22
25
  }
23
26
  },
24
27
  };
@@ -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('Dynatrace error handler will not be enabled as errorHandler was set to false!');
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('Configuration is already available! Duplicated startup blocked.');
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(`enterManualAction(${name})`);
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('Action Name was empty or null! Action will have no effect.');
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(`enterManualAction(${name}): React Native plugin has not been started yet! Action can't be created!`);
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(`enterAutoAction(${name})`);
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('Action Name was empty or null! Action will have no effect.');
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(`enterAutoAction(${name}): React Native plugin has not been started yet! Action can't be created!`);
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(`reportError(${errorName}, ${errorCode})`);
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(`reportError(${errorName}, ${errorCode}): React Native plugin has not been started yet! Error will not be reported!`);
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(`reportErrorStacktrace(${errorName}, ${reason}, ${stacktrace})`);
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(`reportErrorStacktrace(${errorName}, ${reason}, ${stacktrace}): React Native plugin has not been started yet! Error will not be reported!`);
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(`reportErrorStacktrace(${errorName}, ${errorValue}, ${reason}, ${stacktrace})`);
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(`reportErrorStacktrace(${errorName}, ${errorValue}, ${reason}, ${stacktrace}): React Native plugin has not been started yet! Error will not be reported!`);
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(`reportCrash(${crashName}, ${reason}, ${stacktrace})`);
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(`reportCrash(${crashName}, ${reason}, ${stacktrace}): React Native plugin has not been started yet! Crash will not be reported!`);
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(`reportCrashWithException(${crashName}, ${crash.stack})`);
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(`reportCrashWithException(${crashName}, ${crash}): React Native plugin has not been started yet! Crash will not be reported!`);
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(`sendBizEvent(${type}, ${attributes})): Type must be a non empty string`);
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(`sendBizEvent(${type}, ${attributes})): Payload toplevel must be an object`);
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(`sendBizEvent(${type}, ${internalAttributes})`);
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(`sendBizEvent(${type}, ${attributes}): React Native plugin has not been started yet! Biz Event will not be reported!`);
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('Dynatrace endSession()');
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('endSession(): React Native plugin has not been started yet! Session will not be ended!');
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(`Dynatrace identifyUser(${user})`);
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(`identifyUser(${user}): React Native plugin has not been started yet! Session will not be tagged!`);
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(`setGPSLocation(${latitude}, ${longitude})`);
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(`setGPSLocation(${latitude}, ${longitude}): React Native plugin has not been started yet! GPS Position will not be set!`);
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('Dynatrace isCrashReportingOptedIn()');
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('isCrashReportingOptedIn(): React Native plugin has not been started yet! Crash reporting value not available!');
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(`setCrashReportingOptedIn(${crashReporting})`);
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(`setCrashReportingOptedIn(${crashReporting}): React Native plugin has not been started yet! Crash reporting value will not be set!`);
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('getDataCollectionLevel()');
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('getDataCollectionLevel(): React Native plugin has not been started yet! Data Collection level not available!');
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(`setDataCollectionLevel(${dataCollectionLevel})`);
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(`setDataCollectionLevel(${dataCollectionLevel}): React Native plugin has not been started yet! Data Collection level will not be set!`);
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('getUserPrivacyOptions()');
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('getUserPrivacyOptions(): React Native plugin has not been started yet! User Privacy Options are not available!');
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(`applyUserPrivacyOptions(${JSON.stringify(userPrivacyOptions)})`);
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(`applyUserPrivacyOptions(${JSON.stringify(userPrivacyOptions)}): React Native plugin has not been started yet! User Privacy Options can't be applied!`);
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('flushEvents()');
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('flushEvents(): React Native plugin has not been started yet! Flushing Event not possible!');
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('setBeaconHeaders(headers)');
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('setBeaconHeaders(headers): React Native plugin has not been started yet! Setting Beacon Headers is not possible!');
406
+ logger.info(LogMessages_1.LogMessage.SET_BEACON_HEADERS_NOT_STARTED);
338
407
  }
339
408
  },
340
409
  addEventModifier: (eventModifier) => Dynatrace_1.Dynatrace.addEventModifier(eventModifier),