@dynatrace/react-native-plugin 2.307.1 → 2.309.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 (130) hide show
  1. package/README.md +7 -3
  2. package/android/build.gradle +3 -1
  3. package/android/src/main/java/com/dynatrace/android/agent/DynatraceAppStartModule.kt +128 -0
  4. package/android/src/main/java/com/dynatrace/android/agent/DynatraceInternalModule.kt +22 -0
  5. package/android/src/main/java/com/dynatrace/android/agent/DynatraceRNBridgeImpl.kt +411 -0
  6. package/android/src/main/java/com/dynatrace/android/agent/DynatraceReactPackage.kt +54 -0
  7. package/android/src/main/java/com/dynatrace/android/agent/DynatraceUtils.kt +86 -0
  8. package/android/src/main/java/com/dynatrace/android/agent/model/AppStartMeasurement.kt +15 -0
  9. package/android/src/main/java/com/dynatrace/android/agent/model/AppStartMeasurementType.kt +18 -0
  10. package/android/src/new/java/com/dynatrace/android/agent/DynatraceRNBridge.kt +228 -0
  11. package/android/src/old/java/com/dynatrace/android/agent/DynatraceRNBridge.kt +258 -0
  12. package/files/plugin.gradle +1 -1
  13. package/index.js +10 -10
  14. package/instrumentation/DynatraceInstrumentation.js +1 -0
  15. package/{lib → instrumentation/jsx}/CreateElement.js +6 -5
  16. package/{lib/instrumentor/base → instrumentation/jsx}/ElementHelper.js +14 -12
  17. package/{lib/jsx-dev-runtime.js → instrumentation/jsx/JsxDevRuntime.js} +10 -19
  18. package/instrumentation/jsx/JsxRuntime.js +63 -0
  19. package/instrumentation/jsx/JsxRuntimeUtil.js +31 -0
  20. package/instrumentation/jsx/components/ClassComponent.js +49 -0
  21. package/instrumentation/jsx/components/ComponentUtil.js +33 -0
  22. package/instrumentation/jsx/components/FunctionalComponent.js +20 -0
  23. package/{lib/instrumentor/base → instrumentation/jsx/components}/Picker.js +1 -1
  24. package/{lib/instrumentor/base → instrumentation/jsx/components}/RefreshControl.js +1 -1
  25. package/{lib/instrumentor/base → instrumentation/jsx/components}/Switch.js +1 -1
  26. package/{lib/instrumentor/base → instrumentation/jsx/components}/Touchable.js +5 -5
  27. package/instrumentation/libs/community/Picker.InstrInfo.js +20 -0
  28. package/{lib → instrumentation/libs}/community/Picker.js +1 -1
  29. package/instrumentation/libs/community/gesture-handler/Touchables.InstrInfo.js +23 -0
  30. package/{lib → instrumentation/libs}/community/gesture-handler/Touchables.js +1 -1
  31. package/{lib → instrumentation/libs}/react-native/RefreshControl.InstrInfo.js +2 -2
  32. package/{lib → instrumentation/libs}/react-native/RefreshControl.js +5 -5
  33. package/{lib → instrumentation/libs}/react-native/Switch.InstrInfo.js +2 -2
  34. package/{lib → instrumentation/libs}/react-native/Switch.js +5 -5
  35. package/instrumentation/libs/react-native/Touchables.InstrInfo.js +25 -0
  36. package/{lib → instrumentation/libs}/react-native/Touchables.js +1 -1
  37. package/{lib → instrumentation/libs}/react-navigation/ReactNavigation.js +6 -5
  38. package/{lib/instrumentor → instrumentation}/model/Types.js +1 -14
  39. package/instrumentation/model/TypesUtil.js +17 -0
  40. package/ios/DynatraceRNBridge.h +10 -1
  41. package/ios/DynatraceRNBridge.mm +152 -0
  42. package/jsx-dev-runtime.js +1 -1
  43. package/jsx-runtime.js +1 -1
  44. package/lib/core/Application.js +20 -0
  45. package/lib/{instrumentor/base → core}/Dynatrace.js +57 -48
  46. package/lib/{instrumentor/base → core}/DynatraceAction.js +23 -22
  47. package/lib/core/DynatraceInternal.js +46 -0
  48. package/lib/{instrumentor/base → core}/DynatraceRootAction.js +5 -4
  49. package/lib/{instrumentor/base → core}/DynatraceWebRequestTiming.js +6 -5
  50. package/lib/{instrumentor/base → core}/ErrorHandler.js +6 -5
  51. package/lib/{instrumentor/base → core}/configuration/Configuration.js +1 -1
  52. package/lib/{instrumentor/base → core}/configuration/ConfigurationDefaults.js +1 -2
  53. package/lib/{instrumentor/base → core}/configuration/ConfigurationHandler.js +2 -2
  54. package/lib/{instrumentor/base → core}/configuration/ManualStartupConfiguration.js +1 -1
  55. package/lib/core/logging/ConsoleLogger.js +27 -0
  56. package/lib/core/logging/LogLevel.js +12 -0
  57. package/lib/dynatrace-transformer.js +1 -1
  58. package/lib/next/Dynatrace.js +86 -0
  59. package/lib/next/DynatraceSecondGenForwarder.js +17 -0
  60. package/lib/next/IDynatrace.js +2 -0
  61. package/lib/next/IDynatraceForwarder.js +2 -0
  62. package/lib/next/appstart/AppStartObserver.js +32 -0
  63. package/lib/next/appstart/AppStartType.js +38 -0
  64. package/lib/next/events/EventCreator.js +77 -0
  65. package/lib/next/events/EventPipeline.js +57 -0
  66. package/lib/next/events/EventTimestamp.js +24 -0
  67. package/lib/next/events/ViewInfoCreator.js +27 -0
  68. package/lib/next/events/modifier/BaseDataEventModifier.js +31 -0
  69. package/lib/next/events/modifier/EventLimitation.js +69 -0
  70. package/lib/next/events/modifier/EventModifierUtil.js +88 -0
  71. package/lib/next/events/modifier/IEventModifier.js +2 -0
  72. package/lib/next/events/modifier/ModifyEventValidation.js +187 -0
  73. package/lib/next/events/modifier/NonFiniteNumbersModifier.js +50 -0
  74. package/lib/next/events/modifier/SendEventValidation.js +84 -0
  75. package/lib/next/events/spec/EventFieldKeysEnum.js +2 -0
  76. package/lib/next/events/spec/EventSpecContstants.js +46 -0
  77. package/lib/next/events/spec/IAppStartEvent.js +2 -0
  78. package/lib/next/events/spec/ICrashEvent.js +2 -0
  79. package/lib/next/events/spec/IErrorCodeEvent.js +2 -0
  80. package/lib/next/events/spec/IErrorExceptionEvent.js +2 -0
  81. package/lib/next/events/spec/IReactNativeEvent.js +2 -0
  82. package/lib/next/events/spec/IRumEvent.js +2 -0
  83. package/lib/next/provider/ITimestampProvider.js +2 -0
  84. package/lib/next/provider/TimestampProvider.js +10 -0
  85. package/package.json +41 -33
  86. package/react-native-dynatrace.podspec +1 -1
  87. package/src/lib/{instrumentor/base → core}/interface/NativeDynatraceBridge.ts +8 -0
  88. package/typings/react-native-dynatrace.d.ts +0 -1
  89. package/android/src/main/java/com/dynatrace/android/agent/DynatraceRNBridgeImpl.java +0 -366
  90. package/android/src/main/java/com/dynatrace/android/agent/DynatraceReactPackage.java +0 -67
  91. package/android/src/main/java/com/dynatrace/android/agent/DynatraceUtils.java +0 -108
  92. package/android/src/main/java/com/dynatrace/android/agent/PrivateDTBridge.java +0 -28
  93. package/android/src/new/java/com/dynatrace/android/agent/DynatraceRNBridge.java +0 -192
  94. package/android/src/old/java/com/dynatrace/android/agent/DynatraceRNBridge.java +0 -194
  95. package/lib/community/Picker.InstrInfo.js +0 -20
  96. package/lib/community/gesture-handler/Touchables.InstrInfo.js +0 -56
  97. package/lib/instrumentor/DynatraceInstrumentation.js +0 -1
  98. package/lib/instrumentor/base/Application.js +0 -16
  99. package/lib/instrumentor/base/DynatraceInternal.js +0 -34
  100. package/lib/instrumentor/base/Logger.js +0 -16
  101. package/lib/instrumentor/base/model/LogLevel.js +0 -17
  102. package/lib/jsx-runtime.js +0 -69
  103. package/lib/react/Component.js +0 -90
  104. package/lib/react-native/Touchables.InstrInfo.js +0 -60
  105. /package/{lib/instrumentor/base/interface → instrumentation/jsx}/IDynatraceProperties.js +0 -0
  106. /package/{lib → instrumentation/libs}/community/gesture-handler/index.js +0 -0
  107. /package/{lib → instrumentation/libs}/gesture-handler.js +0 -0
  108. /package/{lib → instrumentation/libs}/react-native/index.js +0 -0
  109. /package/{lib → instrumentation/libs}/react-native.js +0 -0
  110. /package/{lib/instrumentor → instrumentation}/model/Reference.js +0 -0
  111. /package/{lib/instrumentor → instrumentation}/parser/Babel.js +0 -0
  112. /package/lib/{instrumentor/base → core}/DynatraceBridge.js +0 -0
  113. /package/lib/{instrumentor/base → core}/NullAction.js +0 -0
  114. /package/lib/{instrumentor/base → core}/NullRootAction.js +0 -0
  115. /package/lib/{instrumentor/base → core}/NullWebRequestTiming.js +0 -0
  116. /package/lib/{instrumentor/base → core}/UserPrivacyOptions.js +0 -0
  117. /package/lib/{instrumentor/base → core}/configuration/ConfigurationBuilder.js +0 -0
  118. /package/lib/{instrumentor/base → core}/configuration/ConfigurationPreset.js +0 -0
  119. /package/lib/{instrumentor/base → core}/configuration/IConfiguration.js +0 -0
  120. /package/lib/{instrumentor/base → core}/interface/IDynatrace.js +0 -0
  121. /package/lib/{instrumentor/base → core}/interface/IDynatraceAction.js +0 -0
  122. /package/lib/{instrumentor/base → core}/interface/IDynatraceInternal.js +0 -0
  123. /package/lib/{instrumentor/base → core}/interface/IDynatraceRootAction.js +0 -0
  124. /package/lib/{instrumentor/base → core}/interface/IWebRequestTiming.js +0 -0
  125. /package/lib/{instrumentor/base → core}/interface/NativeDynatraceBridge.js +0 -0
  126. /package/lib/{instrumentor/base/interface → core/logging}/ILogger.js +0 -0
  127. /package/lib/{instrumentor/base → core}/model/DataCollectionLevel.js +0 -0
  128. /package/lib/{instrumentor/base → core}/model/Json.js +0 -0
  129. /package/lib/{instrumentor/base → core}/model/Platform.js +0 -0
  130. /package/lib/{instrumentor/base → core}/util/StringUtils.js +0 -0
@@ -3,105 +3,106 @@ Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.DynatraceAction = void 0;
4
4
  const StringUtils_1 = require("./util/StringUtils");
5
5
  const DynatraceBridge_1 = require("./DynatraceBridge");
6
- const Logger_1 = require("./Logger");
6
+ const ConsoleLogger_1 = require("./logging/ConsoleLogger");
7
7
  class DynatraceAction {
8
8
  constructor(key, name, manual) {
9
9
  this.key = key;
10
10
  this.name = name;
11
11
  this.manual = manual;
12
12
  this.closed = false;
13
+ this.logger = new ConsoleLogger_1.ConsoleLogger('DynatraceAction');
13
14
  }
14
15
  reportError(errorName, errorCode, platform) {
15
16
  if (this.closed) {
16
- Logger_1.Logger.logDebug(`DynatraceAction reportError(${errorName}, ${errorCode}): Action was closed already!`);
17
+ this.logger.debug(`reportError(${errorName}, ${errorCode}): Action was closed already!`);
17
18
  return;
18
19
  }
19
20
  if (!StringUtils_1.StringUtils.isStringNullEmptyOrUndefined(errorName)) {
20
21
  DynatraceBridge_1.DynatraceNative.reportErrorInAction(this.key, errorName, errorCode, platform === null || platform === void 0 ? void 0 : platform.toString());
21
- Logger_1.Logger.logDebug(`DynatraceAction reportError(${errorName}, ${errorCode}): in Action - ${this.name}`);
22
+ this.logger.debug(`reportError(${errorName}, ${errorCode}): in Action - ${this.name}`);
22
23
  }
23
24
  else {
24
- Logger_1.Logger.logDebug(`DynatraceAction reportError(errorName, errorCode): Error will not be reported because errorName is invalid! errorName: ${errorName}, errorCode: ${errorCode}`);
25
+ this.logger.debug(`reportError(errorName, errorCode): Error will not be reported because errorName is invalid! errorName: ${errorName}, errorCode: ${errorCode}`);
25
26
  }
26
27
  }
27
28
  reportEvent(eventName, platform) {
28
29
  if (this.closed) {
29
- Logger_1.Logger.logDebug(`DynatraceAction reportEvent(${eventName}): Action was closed already!`);
30
+ this.logger.debug(`reportEvent(${eventName}): Action was closed already!`);
30
31
  return;
31
32
  }
32
33
  if (!StringUtils_1.StringUtils.isStringNullEmptyOrUndefined(eventName)) {
33
34
  DynatraceBridge_1.DynatraceNative.reportEventInAction(this.key, eventName, platform === null || platform === void 0 ? void 0 : platform.toString());
34
- Logger_1.Logger.logDebug(`DynatraceAction reportEvent(${eventName}): in Action - ${this.name}`);
35
+ this.logger.debug(`reportEvent(${eventName}): in Action - ${this.name}`);
35
36
  }
36
37
  else {
37
- Logger_1.Logger.logDebug(`DynatraceAction reportEvent(eventName): Event will not be reported because eventName is invalid! eventName: ${eventName} in Action - ${this.name}`);
38
+ this.logger.debug(`reportEvent(eventName): Event will not be reported because eventName is invalid! eventName: ${eventName} in Action - ${this.name}`);
38
39
  }
39
40
  }
40
41
  reportStringValue(valueName, value, platform) {
41
42
  if (this.closed) {
42
- Logger_1.Logger.logDebug(`DynatraceAction reportStringValue(${valueName}, ${value}): Action was closed already!`);
43
+ this.logger.debug(`reportStringValue(${valueName}, ${value}): Action was closed already!`);
43
44
  return;
44
45
  }
45
46
  if (!StringUtils_1.StringUtils.isStringNullEmptyOrUndefined(valueName)) {
46
47
  DynatraceBridge_1.DynatraceNative.reportStringValueInAction(this.key, valueName, value, platform === null || platform === void 0 ? void 0 : platform.toString());
47
- Logger_1.Logger.logDebug(`DynatraceAction reportStringValue(${valueName}, ${value}): in Action - ${this.name}`);
48
+ this.logger.debug(`reportStringValue(${valueName}, ${value}): in Action - ${this.name}`);
48
49
  }
49
50
  else {
50
- Logger_1.Logger.logDebug(`DynatraceAction reportStringValue(valueName, value): String value will not be reported because valueName is invalid! valueName: ${valueName}, value: ${value} in Action - ${this.name}`);
51
+ this.logger.debug(`reportStringValue(valueName, value): String value will not be reported because valueName is invalid! valueName: ${valueName}, value: ${value} in Action - ${this.name}`);
51
52
  }
52
53
  }
53
54
  reportIntValue(valueName, value, platform) {
54
55
  if (this.closed) {
55
- Logger_1.Logger.logDebug(`DynatraceAction reportIntValue(${valueName}, ${value}): Action was closed already!`);
56
+ this.logger.debug(`reportIntValue(${valueName}, ${value}): Action was closed already!`);
56
57
  return;
57
58
  }
58
59
  if (!StringUtils_1.StringUtils.isStringNullEmptyOrUndefined(valueName)) {
59
60
  DynatraceBridge_1.DynatraceNative.reportIntValueInAction(this.key, valueName, value, platform === null || platform === void 0 ? void 0 : platform.toString());
60
- Logger_1.Logger.logDebug(`DynatraceAction reportIntValue(${valueName}, ${value}): in Action - ${this.name}`);
61
+ this.logger.debug(`reportIntValue(${valueName}, ${value}): in Action - ${this.name}`);
61
62
  }
62
63
  else {
63
- Logger_1.Logger.logDebug(`DynatraceAction reportIntValue(valueName, value): Int value will not be reported because valueName is invalid! valueName: ${valueName}, value: ${value} in Action - ${this.name}`);
64
+ this.logger.debug(`reportIntValue(valueName, value): Int value will not be reported because valueName is invalid! valueName: ${valueName}, value: ${value} in Action - ${this.name}`);
64
65
  }
65
66
  }
66
67
  reportDoubleValue(valueName, value, platform) {
67
68
  if (this.closed) {
68
- Logger_1.Logger.logDebug(`DynatraceAction reportDoubleValue(${valueName}, ${value}): Action was closed already!`);
69
+ this.logger.debug(`reportDoubleValue(${valueName}, ${value}): Action was closed already!`);
69
70
  return;
70
71
  }
71
72
  if (!StringUtils_1.StringUtils.isStringNullEmptyOrUndefined(valueName)) {
72
73
  DynatraceBridge_1.DynatraceNative.reportDoubleValueInAction(this.key, valueName, value, platform === null || platform === void 0 ? void 0 : platform.toString());
73
- Logger_1.Logger.logDebug(`DynatraceAction reportDoubleValue(${valueName}, ${value}): in Action - ${this.name}`);
74
+ this.logger.debug(`reportDoubleValue(${valueName}, ${value}): in Action - ${this.name}`);
74
75
  }
75
76
  else {
76
- Logger_1.Logger.logDebug(`DynatraceAction reportDoubleValue(valueName, value): Double value will not be reported because valueName is invalid! valueName: ${valueName}, value: ${value} in Action - ${this.name}`);
77
+ this.logger.debug(`reportDoubleValue(valueName, value): Double value will not be reported because valueName is invalid! valueName: ${valueName}, value: ${value} in Action - ${this.name}`);
77
78
  }
78
79
  }
79
80
  leaveAction(platform) {
80
81
  if (this.closed) {
81
- Logger_1.Logger.logDebug('DynatraceAction leaveAction(): Action was closed already!');
82
+ this.logger.debug('leaveAction(): Action was closed already!');
82
83
  return;
83
84
  }
84
85
  this.closed = true;
85
- Logger_1.Logger.logDebug(`DynatraceAction leaveAction(): ${this.name}`);
86
+ this.logger.debug(`leaveAction(): ${this.name}`);
86
87
  DynatraceBridge_1.DynatraceNative.leaveAction(this.key, this.manual, platform === null || platform === void 0 ? void 0 : platform.toString());
87
88
  }
88
89
  cancel(platform) {
89
90
  if (this.closed) {
90
- Logger_1.Logger.logDebug('DynatraceAction cancelAction(): Action was closed already!');
91
+ this.logger.debug('cancelAction(): Action was closed already!');
91
92
  return;
92
93
  }
93
94
  this.closed = true;
94
- Logger_1.Logger.logDebug(`DynatraceAction cancelAction(): ${this.name}`);
95
+ this.logger.debug(`cancelAction(): ${this.name}`);
95
96
  DynatraceBridge_1.DynatraceNative.cancelAction(this.key, platform === null || platform === void 0 ? void 0 : platform.toString());
96
97
  }
97
98
  getRequestTag(url) {
98
99
  if (this.closed) {
99
- Logger_1.Logger.logDebug(`DynatraceAction getRequestTag(${url}): Action was closed already!`);
100
+ this.logger.debug(`getRequestTag(${url}): Action was closed already!`);
100
101
  return new Promise((resolve) => {
101
102
  resolve('');
102
103
  });
103
104
  }
104
- Logger_1.Logger.logDebug(`DynatraceAction getRequestTag(${url}): in Action - ${this.name}`);
105
+ this.logger.debug(`getRequestTag(${url}): in Action - ${this.name}`);
105
106
  return DynatraceBridge_1.DynatraceNative.getRequestTag(this.key, url);
106
107
  }
107
108
  getRequestTagHeader() {
@@ -0,0 +1,46 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.DynatraceInternal = void 0;
4
+ const react_native_1 = require("react-native");
5
+ const Dynatrace_1 = require("../next/Dynatrace");
6
+ const DynatraceBridge_1 = require("./DynatraceBridge");
7
+ const StringUtils_1 = require("./util/StringUtils");
8
+ const ConsoleLogger_1 = require("./logging/ConsoleLogger");
9
+ let counter = 0;
10
+ const logger = new ConsoleLogger_1.ConsoleLogger('DyntraceInt');
11
+ exports.DynatraceInternal = {
12
+ reportErrorFromHandler: (isFatal, errorName, reason, stacktrace, isReportFatalErrorAsCrash, platform) => {
13
+ if (isFatal && isReportFatalErrorAsCrash) {
14
+ if (react_native_1.Platform.OS === 'ios') {
15
+ logger.debug(`storeCrash(${errorName}, ${reason}, ${stacktrace})`);
16
+ DynatraceBridge_1.DynatraceNative.storeCrash(errorName, reason, stacktrace);
17
+ }
18
+ else {
19
+ logger.debug(`reportCrash(${errorName}, ${reason}, ${stacktrace})`);
20
+ DynatraceBridge_1.DynatraceNative.reportCrash(errorName, reason, stacktrace, true, platform === null || platform === void 0 ? void 0 : platform.toString());
21
+ }
22
+ Dynatrace_1.Dynatrace.reportCrash({
23
+ name: errorName,
24
+ message: reason,
25
+ stack: stacktrace,
26
+ }, false, isFatal);
27
+ }
28
+ else {
29
+ if (!StringUtils_1.StringUtils.isStringNullEmptyOrUndefined(stacktrace)) {
30
+ logger.debug(`reportError(${errorName}, ${reason}, ${stacktrace})`);
31
+ DynatraceBridge_1.DynatraceNative.reportError(errorName, '-', reason, stacktrace, platform === null || platform === void 0 ? void 0 : platform.toString());
32
+ Dynatrace_1.Dynatrace.reportError({
33
+ name: errorName,
34
+ message: reason,
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
+ }
43
+ }
44
+ },
45
+ getCounter: () => counter++,
46
+ };
@@ -3,18 +3,19 @@ Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.DynatraceRootAction = void 0;
4
4
  const StringUtils_1 = require("./util/StringUtils");
5
5
  const DynatraceBridge_1 = require("./DynatraceBridge");
6
- const Logger_1 = require("./Logger");
7
6
  const DynatraceAction_1 = require("./DynatraceAction");
8
7
  const NullAction_1 = require("./NullAction");
9
8
  const DynatraceInternal_1 = require("./DynatraceInternal");
10
9
  const ConfigurationHandler_1 = require("./configuration/ConfigurationHandler");
10
+ const ConsoleLogger_1 = require("./logging/ConsoleLogger");
11
11
  class DynatraceRootAction extends DynatraceAction_1.DynatraceAction {
12
12
  constructor(key, name) {
13
13
  super(key, name, true);
14
+ this.logger = new ConsoleLogger_1.ConsoleLogger('DynatraceRootAction');
14
15
  }
15
16
  enterAction(name, platform) {
16
17
  if (this.closed) {
17
- Logger_1.Logger.logDebug(`DynatraceRootAction enterAction(${name}): Action was closed already!`);
18
+ this.logger.debug(`enterAction(${name}): Action was closed already!`);
18
19
  return new NullAction_1.NullAction();
19
20
  }
20
21
  let childKey;
@@ -28,12 +29,12 @@ class DynatraceRootAction extends DynatraceAction_1.DynatraceAction {
28
29
  childKey = 'DEFAULT_' + DynatraceInternal_1.DynatraceInternal.getCounter();
29
30
  }
30
31
  if (!StringUtils_1.StringUtils.isStringNullEmptyOrUndefined(name)) {
31
- Logger_1.Logger.logDebug(`DynatraceRootAction enterAction(${name})`);
32
+ this.logger.debug(`enterAction(${name})`);
32
33
  DynatraceBridge_1.DynatraceNative.enterManualActionWithParent(name, childKey, this.key, platform === null || platform === void 0 ? void 0 : platform.toString());
33
34
  return new DynatraceAction_1.DynatraceAction(childKey, name, true);
34
35
  }
35
36
  else {
36
- Logger_1.Logger.logDebug('Action Name was empty or null! Action will have no effect.');
37
+ this.logger.debug(`enterAction(${name}): Action Name was empty or null! Action will have no effect.`);
37
38
  return new NullAction_1.NullAction();
38
39
  }
39
40
  }
@@ -2,20 +2,22 @@
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.DynatraceWebRequestTiming = void 0;
4
4
  const DynatraceBridge_1 = require("./DynatraceBridge");
5
- const Logger_1 = require("./Logger");
5
+ const ConsoleLogger_1 = require("./logging/ConsoleLogger");
6
6
  const StringUtils_1 = require("./util/StringUtils");
7
7
  class DynatraceWebRequestTiming {
8
8
  constructor(requestTag, url) {
9
9
  this.requestTag = requestTag;
10
10
  this.url = url;
11
+ this.logger = new ConsoleLogger_1.ConsoleLogger('DynatraceWebRequestTiming');
11
12
  }
12
13
  startWebRequestTiming() {
13
14
  if (!StringUtils_1.StringUtils.isStringNullEmptyOrUndefined(this.requestTag) &&
14
15
  !StringUtils_1.StringUtils.isStringNullEmptyOrUndefined(this.url)) {
16
+ this.logger.debug(`startWebRequestTiming() - (${this.url}/${this.requestTag})`);
15
17
  DynatraceBridge_1.DynatraceNative.startWebRequestTiming(this.requestTag, this.url);
16
18
  }
17
19
  else {
18
- Logger_1.Logger.logDebug('Web Request Timing could not be created!');
20
+ this.logger.debug(`startWebRequestTiming(): Web Request Timing could not be created! - (${this.url}/${this.requestTag})`);
19
21
  }
20
22
  }
21
23
  stopWebRequestTiming(responseCode, responseMessage) {
@@ -26,12 +28,11 @@ class DynatraceWebRequestTiming {
26
28
  !StringUtils_1.StringUtils.isStringNullEmptyOrUndefined(this.url) &&
27
29
  responseCode != null &&
28
30
  !StringUtils_1.StringUtils.isStringNullOrUndefined(responseMessage)) {
31
+ this.logger.debug(`stopWebRequestTiming(${responseCode}, ${responseMessage}, ${requestSize}, ${responseSize}) - (${this.url}/${this.requestTag})`);
29
32
  DynatraceBridge_1.DynatraceNative.stopWebRequestTimingWithSize(this.requestTag, this.url, responseCode, responseMessage, requestSize, responseSize);
30
33
  }
31
34
  else {
32
- Logger_1.Logger.logDebug(`Web Request Timing could not be stopped! - requestTag: ${this.requestTag} ` +
33
- `url: ${this.url} responseCode: ${responseCode} responseMessage: ${responseMessage} ` +
34
- `requestSize: ${requestSize} responseSize: ${responseSize}`);
35
+ this.logger.debug(`stopWebRequestTiming(${responseCode}, ${responseMessage}, ${requestSize}, ${responseSize}): Web Request Timing could not be stopped! - (${this.url}/${this.requestTag})`);
35
36
  }
36
37
  }
37
38
  getRequestTag() {
@@ -1,13 +1,14 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports._reportErrorToDynatrace = exports.registerErrorHandler = void 0;
4
- const ReactNative = require("react-native");
4
+ const react_native_1 = require("react-native");
5
5
  const DynatraceInternal_1 = require("./DynatraceInternal");
6
6
  const Dynatrace_1 = require("./Dynatrace");
7
7
  const StringUtils_1 = require("./util/StringUtils");
8
- const Logger_1 = require("./Logger");
8
+ const ConsoleLogger_1 = require("./logging/ConsoleLogger");
9
9
  let _isReportFatalErrorAsCrash = true;
10
10
  const _isReactNativeGlobal = (globalScope) => globalScope.ErrorUtils !== undefined;
11
+ const logger = new ConsoleLogger_1.ConsoleLogger('ErrorHandler');
11
12
  const registerErrorHandler = (reportFatalErrorAsCrash) => {
12
13
  if (global !== undefined && _isReactNativeGlobal(global)) {
13
14
  _isReportFatalErrorAsCrash = reportFatalErrorAsCrash;
@@ -31,15 +32,15 @@ const _reportErrorToDynatrace = (exception, isFatal, oldHandler) => {
31
32
  isFatal = false;
32
33
  }
33
34
  DynatraceInternal_1.DynatraceInternal.reportErrorFromHandler(isFatal, String(exception.name), adjustedReason(exception.message), exception.stack != null ? exception.stack : '', _isReportFatalErrorAsCrash);
34
- Logger_1.Logger.logDebug(`ErrorHandler _reportErrorToDynatrace(${exception}, ${isFatal})`);
35
+ logger.debug(`_reportErrorToDynatrace(${exception}, ${isFatal})`);
35
36
  }
36
37
  }
37
38
  else {
38
39
  Dynatrace_1.Dynatrace.reportError(String(exception), -1);
39
- Logger_1.Logger.logDebug(`ErrorHandler _reportErrorToDynatrace(${exception}, -1)`);
40
+ logger.debug(`_reportErrorToDynatrace(${exception}, -1)`);
40
41
  }
41
42
  if (oldHandler !== undefined) {
42
- if (ReactNative.Platform.OS === 'ios') {
43
+ if (react_native_1.Platform.OS === 'ios') {
43
44
  setTimeout(() => {
44
45
  oldHandler(exception, isFatal);
45
46
  }, 200);
@@ -1,7 +1,7 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.Configuration = void 0;
4
- const LogLevel_1 = require("../model/LogLevel");
4
+ const LogLevel_1 = require("../logging/LogLevel");
5
5
  class Configuration {
6
6
  constructor(beaconUrl, applicationId, reportCrash, errorHandler, reportFatalErrorAsCrash, logLevel, lifecycleUpdate, userOptIn, actionNamePrivacy, bundleName, bundleVersion) {
7
7
  this.beaconUrl = beaconUrl;
@@ -1,11 +1,10 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.DEFAULT_ACTION_NAME_PRIVACY = exports.DEFAULT_USER_OPT_IN = exports.DEFAULT_LOGLEVEL = exports.DEFAULT_FATAL_AS_CRASH = exports.DEFAULT_ERROR_HANDLER = exports.DEFAULT_REPORT_CRASH = exports.DEFAULT_LIFECYCLE_UPDATE = void 0;
4
- const LogLevel_1 = require("../model/LogLevel");
5
4
  exports.DEFAULT_LIFECYCLE_UPDATE = false;
6
5
  exports.DEFAULT_REPORT_CRASH = true;
7
6
  exports.DEFAULT_ERROR_HANDLER = true;
8
7
  exports.DEFAULT_FATAL_AS_CRASH = true;
9
- exports.DEFAULT_LOGLEVEL = LogLevel_1.LogLevel.Info;
8
+ exports.DEFAULT_LOGLEVEL = 1;
10
9
  exports.DEFAULT_USER_OPT_IN = false;
11
10
  exports.DEFAULT_ACTION_NAME_PRIVACY = false;
@@ -1,7 +1,6 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.ConfigurationHandler = void 0;
4
- const LogLevel_1 = require("../model/LogLevel");
5
4
  let _configuration;
6
5
  exports.ConfigurationHandler = {
7
6
  setConfiguration(configuration) {
@@ -10,7 +9,8 @@ exports.ConfigurationHandler = {
10
9
  isConfigurationAvailable: () => _configuration !== undefined,
11
10
  isErrorHandlerEnabled: () => _configuration.errorHandler,
12
11
  isReportFatalErrorAsCrash: () => _configuration.reportFatalErrorAsCrash,
13
- isDebugEnabled: () => _configuration.logLevel === LogLevel_1.LogLevel.Debug,
12
+ isDebugEnabled: () => exports.ConfigurationHandler.isConfigurationAvailable() &&
13
+ _configuration.logLevel === 0,
14
14
  isLifecycleUpdateEnabled: () => _configuration.lifecycleUpdate,
15
15
  isActionNamePrivacyEnabled: () => _configuration.actionNamePrivacy,
16
16
  getBundleName: () => _configuration.bundleName,
@@ -1,7 +1,7 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.ManualStartupConfiguration = void 0;
4
- const LogLevel_1 = require("../model/LogLevel");
4
+ const LogLevel_1 = require("../logging/LogLevel");
5
5
  const ConfigurationDefaults_1 = require("./ConfigurationDefaults");
6
6
  const ConfigurationPreset_1 = require("./ConfigurationPreset");
7
7
  class ManualStartupConfiguration {
@@ -0,0 +1,27 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.ConsoleLogger = void 0;
4
+ const ConfigurationHandler_1 = require("../configuration/ConfigurationHandler");
5
+ class ConsoleLogger {
6
+ constructor(name, logLevel) {
7
+ this.name = name;
8
+ this.level = logLevel;
9
+ }
10
+ debug(msg) {
11
+ if (this.isDebugEnabled()) {
12
+ this.logMessage(msg);
13
+ }
14
+ }
15
+ info(msg) {
16
+ this.logMessage(msg);
17
+ }
18
+ logMessage(msg) {
19
+ console.log(`[${this.name}]: ${msg}`);
20
+ }
21
+ isDebugEnabled() {
22
+ return (this.level === 0 ||
23
+ (ConfigurationHandler_1.ConfigurationHandler.isConfigurationAvailable() &&
24
+ ConfigurationHandler_1.ConfigurationHandler.isDebugEnabled()));
25
+ }
26
+ }
27
+ exports.ConsoleLogger = ConsoleLogger;
@@ -0,0 +1,12 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.LogLevelToString = void 0;
4
+ const LogLevelToString = (level) => {
5
+ if (level === 0) {
6
+ return 'Debug';
7
+ }
8
+ else {
9
+ return 'Info';
10
+ }
11
+ };
12
+ exports.LogLevelToString = LogLevelToString;
@@ -6,7 +6,7 @@ const PathsConstants_1 = require("../scripts/PathsConstants");
6
6
  const config = require("../scripts/Config");
7
7
  const Logger_1 = require("../scripts/Logger");
8
8
  const CustomArgumentUtil_1 = require("../scripts/util/CustomArgumentUtil");
9
- const instrumentor = require("./instrumentor/DynatraceInstrumentation");
9
+ const instrumentor = require("../instrumentation/DynatraceInstrumentation");
10
10
  const customArguments = (0, CustomArgumentUtil_1.readCustomArguments)();
11
11
  const transform = (src, filename, options) => {
12
12
  if (typeof src === 'object') {
@@ -0,0 +1,86 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.Dynatrace = void 0;
4
+ const DynatraceBridge_1 = require("../core/DynatraceBridge");
5
+ const ConsoleLogger_1 = require("../core/logging/ConsoleLogger");
6
+ const EventCreator_1 = require("./events/EventCreator");
7
+ const EventPipeline_1 = require("./events/EventPipeline");
8
+ const EventTimestamp_1 = require("./events/EventTimestamp");
9
+ const EventModifierUtil_1 = require("./events/modifier/EventModifierUtil");
10
+ const SendEventValidation_1 = require("./events/modifier/SendEventValidation");
11
+ const TimestampProvider_1 = require("./provider/TimestampProvider");
12
+ class DynatraceImpl {
13
+ constructor(timestampProvider) {
14
+ this.timestampProvider = timestampProvider;
15
+ this.logger = new ConsoleLogger_1.ConsoleLogger('Dynatrace');
16
+ }
17
+ addEventModifier(eventModifier) {
18
+ this.logger.debug('addEventModifier()');
19
+ return EventPipeline_1.EventPipeline.addEventModifier(eventModifier);
20
+ }
21
+ removeEventModifier(eventModifier) {
22
+ this.logger.debug('removeEventModifier()');
23
+ return EventPipeline_1.EventPipeline.removeEventModifier(eventModifier);
24
+ }
25
+ startView(name) {
26
+ this.logger.debug(`startView(${name})`);
27
+ if (name != null && name.length > 0) {
28
+ DynatraceBridge_1.DynatraceNative.startView(name);
29
+ }
30
+ else {
31
+ this.logger.debug(`startView(${name}): Name can't be used. Either empty or null!`);
32
+ }
33
+ }
34
+ stopView() {
35
+ this.logger.debug('stopView()');
36
+ DynatraceBridge_1.DynatraceNative.stopView();
37
+ }
38
+ reportCrash(crash, isApiReported, isFatal = true, additionalData = {}) {
39
+ this.logger.debug(`reportCrash(${JSON.stringify(crash)}, ${isFatal}, ${JSON.stringify(additionalData)})`);
40
+ const eventTimestamp = new EventTimestamp_1.EventTimestamp(this.timestampProvider);
41
+ const event = Object.assign(Object.assign({}, (0, EventCreator_1.createCrashEvent)(crash.name, crash.message, crash.stack, isFatal)), eventTimestamp.getEventTimeInfo());
42
+ if (isApiReported) {
43
+ event["characteristics.is_api_reported"] =
44
+ true;
45
+ }
46
+ EventPipeline_1.EventPipeline.insertEvent(event, additionalData);
47
+ }
48
+ reportErrorCode(errorName, errorCode, isApiReported, additionalData = {}) {
49
+ this.logger.debug(`reportErrorCode(${errorName}, ${errorCode}, ${JSON.stringify(additionalData)})`);
50
+ const eventTimestamp = new EventTimestamp_1.EventTimestamp(this.timestampProvider);
51
+ const event = Object.assign(Object.assign({}, (0, EventCreator_1.createErrorCodeEvent)(errorName, errorCode)), eventTimestamp.getEventTimeInfo());
52
+ if (isApiReported) {
53
+ event["characteristics.is_api_reported"] =
54
+ true;
55
+ }
56
+ EventPipeline_1.EventPipeline.insertEvent(event, additionalData);
57
+ }
58
+ reportError(error, isApiReported, additionalData = {}) {
59
+ this.logger.debug(`reportError(${JSON.stringify(error)}, ${JSON.stringify(additionalData)})`);
60
+ const eventTimestamp = new EventTimestamp_1.EventTimestamp(this.timestampProvider);
61
+ const event = Object.assign(Object.assign({}, (0, EventCreator_1.createErrorEvent)(error.name, error.message, error.stack)), eventTimestamp.getEventTimeInfo());
62
+ if (isApiReported) {
63
+ event["characteristics.is_api_reported"] =
64
+ true;
65
+ }
66
+ EventPipeline_1.EventPipeline.insertEvent(event, additionalData);
67
+ }
68
+ sendEvent(properties) {
69
+ this.logger.debug(`sendEvent(${JSON.stringify(properties)})`);
70
+ const eventValidated = SendEventValidation_1.SendEventValidation.modifyEvent(properties);
71
+ if (eventValidated != null && (0, EventModifierUtil_1.containEventProperties)(eventValidated)) {
72
+ eventValidated["characteristics.has_event_properties"] = true;
73
+ }
74
+ EventPipeline_1.EventPipeline.insertEvent(eventValidated, {});
75
+ }
76
+ sendSessionPropertyEvent(properties) {
77
+ this.logger.debug(`sendSessionPropertyEvent(${JSON.stringify(properties)})`);
78
+ const eventValidated = SendEventValidation_1.SendSessionPropertyEventValidation.modifyEvent(properties);
79
+ if (eventValidated != null &&
80
+ (0, EventModifierUtil_1.containSessionProperties)(eventValidated)) {
81
+ eventValidated["characteristics.has_session_properties"] = true;
82
+ }
83
+ EventPipeline_1.EventPipeline.insertEvent(eventValidated, {});
84
+ }
85
+ }
86
+ exports.Dynatrace = new DynatraceImpl(TimestampProvider_1.defaultTimestampProvider);
@@ -0,0 +1,17 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.DynatraceSecondGenForwarder = void 0;
4
+ class DynatraceSecondGenForwarderImpl {
5
+ reportError(errorName, errorCode) {
6
+ }
7
+ reportErrorWithStacktrace(errorName, reason, stacktrace) {
8
+ }
9
+ reportErrorStacktrace(errorName, errorValue, reason, stacktrace) {
10
+ }
11
+ reportCrash(crashName, reason, stacktrace) {
12
+ }
13
+ reportCrashWithException(crashName, crash) {
14
+ const copyCrash = Object.assign(Object.assign({}, crash), { name: crashName });
15
+ }
16
+ }
17
+ exports.DynatraceSecondGenForwarder = new DynatraceSecondGenForwarderImpl();
@@ -0,0 +1,2 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
@@ -0,0 +1,2 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
@@ -0,0 +1,32 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.AppStartObserver = void 0;
4
+ const react_native_1 = require("react-native");
5
+ const EventCreator_1 = require("../events/EventCreator");
6
+ const ConsoleLogger_1 = require("../../core/logging/ConsoleLogger");
7
+ const DynatraceBridge_1 = require("../../core/DynatraceBridge");
8
+ class AppStartObserverImpl {
9
+ constructor() {
10
+ this.EMIT_APP_START = 'dynatraceAppStartMeasurements';
11
+ this.logger = new ConsoleLogger_1.ConsoleLogger('AppStartObserver');
12
+ this.setupNativeEventEmitter();
13
+ }
14
+ call() {
15
+ }
16
+ setupNativeEventEmitter() {
17
+ if (react_native_1.Platform.OS === 'android' ||
18
+ Object.keys(DynatraceBridge_1.DynatraceNative).length !== 0) {
19
+ const emitter = new react_native_1.NativeEventEmitter(DynatraceBridge_1.DynatraceNative);
20
+ emitter.addListener(this.EMIT_APP_START, (data) => {
21
+ this.logger.debug(`emitter(${JSON.stringify(data)}})`);
22
+ const appStartEvent = (0, EventCreator_1.createAppStartEvent)(data);
23
+ if (appStartEvent != null) {
24
+ }
25
+ else {
26
+ this.logger.debug(`emitter(${JSON.stringify(data)}}): App Start event ignored!`);
27
+ }
28
+ });
29
+ }
30
+ }
31
+ }
32
+ exports.AppStartObserver = new AppStartObserverImpl();
@@ -0,0 +1,38 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.AppStartTypeKeyMapping = exports.AppStartType = void 0;
4
+ var AppStartType;
5
+ (function (AppStartType) {
6
+ AppStartType["DOWNLOAD_START"] = "downloadStart";
7
+ AppStartType["DOWNLOAD_END"] = "downloadEnd";
8
+ AppStartType["RUN_JS_BUNDLE_START"] = "runJsBundleStart";
9
+ AppStartType["RUN_JS_BUNDLE_END"] = "runJsBundleEnd";
10
+ AppStartType["CONTENT_APPEARED"] = "contentAppeared";
11
+ AppStartType["RELOAD"] = "reload";
12
+ })(AppStartType = exports.AppStartType || (exports.AppStartType = {}));
13
+ exports.AppStartTypeKeyMapping = [
14
+ {
15
+ type: AppStartType.RELOAD,
16
+ key: "app_start.react_native.application.reload",
17
+ },
18
+ {
19
+ type: AppStartType.DOWNLOAD_START,
20
+ key: "app_start.react_native.application.download_start",
21
+ },
22
+ {
23
+ type: AppStartType.RUN_JS_BUNDLE_START,
24
+ key: "app_start.react_native.application.run_js_bundle_start",
25
+ },
26
+ {
27
+ type: AppStartType.DOWNLOAD_END,
28
+ key: "app_start.react_native.application.download_end",
29
+ },
30
+ {
31
+ type: AppStartType.RUN_JS_BUNDLE_END,
32
+ key: "app_start.react_native.application.run_js_bundle_end",
33
+ },
34
+ {
35
+ type: AppStartType.CONTENT_APPEARED,
36
+ key: "app_start.react_native.application.content_appeared",
37
+ },
38
+ ];