@dynatrace/react-native-plugin 2.307.1 → 2.311.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 +13 -4
- package/android/build.gradle +3 -1
- package/android/src/main/java/com/dynatrace/android/agent/DynatraceAppStartModule.kt +128 -0
- package/android/src/main/java/com/dynatrace/android/agent/DynatraceInternalModule.kt +22 -0
- package/android/src/main/java/com/dynatrace/android/agent/DynatraceRNBridgeImpl.kt +411 -0
- package/android/src/main/java/com/dynatrace/android/agent/DynatraceReactPackage.kt +54 -0
- package/android/src/main/java/com/dynatrace/android/agent/DynatraceUtils.kt +86 -0
- package/android/src/main/java/com/dynatrace/android/agent/model/AppStartMeasurement.kt +15 -0
- package/android/src/main/java/com/dynatrace/android/agent/model/AppStartMeasurementType.kt +18 -0
- package/android/src/new/java/com/dynatrace/android/agent/DynatraceRNBridge.kt +228 -0
- package/android/src/old/java/com/dynatrace/android/agent/DynatraceRNBridge.kt +258 -0
- package/files/plugin.gradle +1 -1
- package/index.js +10 -10
- package/instrumentation/DynatraceInstrumentation.js +1 -0
- package/{lib → instrumentation/jsx}/CreateElement.js +6 -5
- package/{lib/instrumentor/base → instrumentation/jsx}/ElementHelper.js +14 -12
- package/instrumentation/jsx/JsxDevRuntime.js +54 -0
- package/instrumentation/jsx/JsxRuntime.js +57 -0
- package/instrumentation/jsx/JsxRuntimeUtil.js +31 -0
- package/instrumentation/jsx/components/ClassComponent.js +49 -0
- package/instrumentation/jsx/components/ComponentUtil.js +33 -0
- package/instrumentation/jsx/components/FunctionalComponent.js +15 -0
- package/{lib/instrumentor/base → instrumentation/jsx/components}/Picker.js +1 -1
- package/{lib/instrumentor/base → instrumentation/jsx/components}/RefreshControl.js +1 -1
- package/{lib/instrumentor/base → instrumentation/jsx/components}/Switch.js +8 -8
- package/{lib/instrumentor/base → instrumentation/jsx/components}/Touchable.js +8 -8
- package/instrumentation/libs/community/Picker.InstrInfo.js +20 -0
- package/{lib → instrumentation/libs}/community/Picker.js +1 -1
- package/instrumentation/libs/community/gesture-handler/Touchables.InstrInfo.js +23 -0
- package/{lib → instrumentation/libs}/community/gesture-handler/Touchables.js +1 -1
- package/{lib → instrumentation/libs}/react-native/RefreshControl.InstrInfo.js +2 -2
- package/{lib → instrumentation/libs}/react-native/RefreshControl.js +5 -5
- package/{lib → instrumentation/libs}/react-native/Switch.InstrInfo.js +2 -2
- package/{lib → instrumentation/libs}/react-native/Switch.js +5 -5
- package/instrumentation/libs/react-native/Touchables.InstrInfo.js +25 -0
- package/{lib → instrumentation/libs}/react-native/Touchables.js +1 -1
- package/{lib → instrumentation/libs}/react-navigation/ReactNavigation.js +6 -5
- package/{lib/instrumentor → instrumentation}/model/Types.js +1 -14
- package/instrumentation/model/TypesUtil.js +50 -0
- package/ios/DynatraceRNBridge.h +10 -1
- package/ios/DynatraceRNBridge.mm +152 -1
- package/jsx-dev-runtime.js +1 -1
- package/jsx-runtime.js +1 -1
- package/lib/core/Application.js +20 -0
- package/lib/{instrumentor/base → core}/Dynatrace.js +72 -48
- package/lib/{instrumentor/base → core}/DynatraceAction.js +23 -22
- package/lib/core/DynatraceInternal.js +46 -0
- package/lib/{instrumentor/base → core}/DynatraceRootAction.js +5 -4
- package/lib/{instrumentor/base → core}/DynatraceWebRequestTiming.js +6 -5
- package/lib/{instrumentor/base → core}/ErrorHandler.js +6 -5
- package/lib/{instrumentor/base → core}/configuration/Configuration.js +1 -1
- package/lib/{instrumentor/base → core}/configuration/ConfigurationDefaults.js +1 -2
- package/lib/{instrumentor/base → core}/configuration/ConfigurationHandler.js +2 -2
- package/lib/{instrumentor/base → core}/configuration/ManualStartupConfiguration.js +1 -1
- package/lib/core/logging/ConsoleLogger.js +27 -0
- package/lib/core/logging/LogLevel.js +12 -0
- package/lib/dynatrace-transformer.js +1 -1
- package/lib/next/Dynatrace.js +88 -0
- package/lib/next/DynatraceSecondGenForwarder.js +35 -0
- package/lib/next/IDynatrace.js +2 -0
- package/lib/next/IDynatraceForwarder.js +2 -0
- package/lib/next/appstart/AppStartObserver.js +34 -0
- package/lib/next/appstart/AppStartType.js +38 -0
- package/lib/next/events/EventCreator.js +77 -0
- package/lib/next/events/EventPipeline.js +58 -0
- package/lib/next/events/EventTimestamp.js +27 -0
- package/lib/next/events/ViewInfoCreator.js +27 -0
- package/lib/next/events/modifier/BaseDataEventModifier.js +31 -0
- package/lib/next/events/modifier/EventLimitation.js +69 -0
- package/lib/next/events/modifier/EventModifierUtil.js +89 -0
- package/lib/next/events/modifier/IEventModifier.js +2 -0
- package/lib/next/events/modifier/ModifyEventValidation.js +189 -0
- package/lib/next/events/modifier/SendEventValidation.js +86 -0
- package/lib/next/events/modifier/ValueRestrictionModifier.js +56 -0
- package/lib/next/events/spec/EventFieldKeysEnum.js +2 -0
- package/lib/next/events/spec/EventSpecContstants.js +47 -0
- package/lib/next/events/spec/IAppStartEvent.js +2 -0
- package/lib/next/events/spec/ICrashEvent.js +2 -0
- package/lib/next/events/spec/IErrorCodeEvent.js +2 -0
- package/lib/next/events/spec/IErrorExceptionEvent.js +2 -0
- package/lib/next/events/spec/IReactNativeEvent.js +2 -0
- package/lib/next/events/spec/IRumEvent.js +2 -0
- package/lib/next/provider/ITimestampProvider.js +2 -0
- package/lib/next/provider/TimestampProvider.js +10 -0
- package/package.json +42 -33
- package/react-native-dynatrace.podspec +1 -1
- package/scripts/Android.js +10 -4
- package/scripts/PathsConstants.js +3 -1
- package/scripts/core/InstrumentCall.js +1 -0
- package/src/lib/{instrumentor/base → core}/interface/NativeDynatraceBridge.ts +8 -0
- package/typings/react-native-dynatrace.d.ts +73 -0
- package/android/src/main/java/com/dynatrace/android/agent/DynatraceRNBridgeImpl.java +0 -366
- package/android/src/main/java/com/dynatrace/android/agent/DynatraceReactPackage.java +0 -67
- package/android/src/main/java/com/dynatrace/android/agent/DynatraceUtils.java +0 -108
- package/android/src/main/java/com/dynatrace/android/agent/PrivateDTBridge.java +0 -28
- package/android/src/new/java/com/dynatrace/android/agent/DynatraceRNBridge.java +0 -192
- package/android/src/old/java/com/dynatrace/android/agent/DynatraceRNBridge.java +0 -194
- package/lib/community/Picker.InstrInfo.js +0 -20
- package/lib/community/gesture-handler/Touchables.InstrInfo.js +0 -56
- package/lib/instrumentor/DynatraceInstrumentation.js +0 -1
- package/lib/instrumentor/base/Application.js +0 -16
- package/lib/instrumentor/base/DynatraceInternal.js +0 -34
- package/lib/instrumentor/base/Logger.js +0 -16
- package/lib/instrumentor/base/model/LogLevel.js +0 -17
- package/lib/jsx-dev-runtime.js +0 -70
- package/lib/jsx-runtime.js +0 -69
- package/lib/react/Component.js +0 -90
- package/lib/react-native/Touchables.InstrInfo.js +0 -60
- /package/{lib/instrumentor/base/interface → instrumentation/jsx}/IDynatraceProperties.js +0 -0
- /package/{lib → instrumentation/libs}/community/gesture-handler/index.js +0 -0
- /package/{lib → instrumentation/libs}/gesture-handler.js +0 -0
- /package/{lib → instrumentation/libs}/react-native/index.js +0 -0
- /package/{lib → instrumentation/libs}/react-native.js +0 -0
- /package/{lib/instrumentor → instrumentation}/model/Reference.js +0 -0
- /package/{lib/instrumentor → instrumentation}/parser/Babel.js +0 -0
- /package/lib/{instrumentor/base → core}/DynatraceBridge.js +0 -0
- /package/lib/{instrumentor/base → core}/NullAction.js +0 -0
- /package/lib/{instrumentor/base → core}/NullRootAction.js +0 -0
- /package/lib/{instrumentor/base → core}/NullWebRequestTiming.js +0 -0
- /package/lib/{instrumentor/base → core}/UserPrivacyOptions.js +0 -0
- /package/lib/{instrumentor/base → core}/configuration/ConfigurationBuilder.js +0 -0
- /package/lib/{instrumentor/base → core}/configuration/ConfigurationPreset.js +0 -0
- /package/lib/{instrumentor/base → core}/configuration/IConfiguration.js +0 -0
- /package/lib/{instrumentor/base → core}/interface/IDynatrace.js +0 -0
- /package/lib/{instrumentor/base → core}/interface/IDynatraceAction.js +0 -0
- /package/lib/{instrumentor/base → core}/interface/IDynatraceInternal.js +0 -0
- /package/lib/{instrumentor/base → core}/interface/IDynatraceRootAction.js +0 -0
- /package/lib/{instrumentor/base → core}/interface/IWebRequestTiming.js +0 -0
- /package/lib/{instrumentor/base → core}/interface/NativeDynatraceBridge.js +0 -0
- /package/lib/{instrumentor/base/interface → core/logging}/ILogger.js +0 -0
- /package/lib/{instrumentor/base → core}/model/DataCollectionLevel.js +0 -0
- /package/lib/{instrumentor/base → core}/model/Json.js +0 -0
- /package/lib/{instrumentor/base → core}/model/Platform.js +0 -0
- /package/lib/{instrumentor/base → core}/util/StringUtils.js +0 -0
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.ValueRestrictionModifier = void 0;
|
|
4
|
+
const ConsoleLogger_1 = require("../../../core/logging/ConsoleLogger");
|
|
5
|
+
const EventModifierUtil_1 = require("./EventModifierUtil");
|
|
6
|
+
class ValueRestrictionModifierImpl {
|
|
7
|
+
constructor() {
|
|
8
|
+
this.logger = new ConsoleLogger_1.ConsoleLogger('NonFiniteNumbersModifier');
|
|
9
|
+
}
|
|
10
|
+
modifyEvent(event) {
|
|
11
|
+
if (event != null && this.eventHasRestrictedValues(event)) {
|
|
12
|
+
event["dt.rum.has_nfn_values"] = true;
|
|
13
|
+
}
|
|
14
|
+
return JSON.parse(JSON.stringify(event, (_key, value) => {
|
|
15
|
+
if (value === undefined) {
|
|
16
|
+
return null;
|
|
17
|
+
}
|
|
18
|
+
return value;
|
|
19
|
+
}));
|
|
20
|
+
}
|
|
21
|
+
eventHasRestrictedValues(obj) {
|
|
22
|
+
for (const key in obj) {
|
|
23
|
+
if (Object.prototype.hasOwnProperty.call(obj, key) &&
|
|
24
|
+
(this.valueHasRestrictedValues(obj[key]) ||
|
|
25
|
+
obj[key] === undefined)) {
|
|
26
|
+
this.logger.debug(`eventHasNonFiniteNumbers() - ${key} contains non-finite numbers or undefined: ${obj[key]} changed to null!`);
|
|
27
|
+
return true;
|
|
28
|
+
}
|
|
29
|
+
}
|
|
30
|
+
return false;
|
|
31
|
+
}
|
|
32
|
+
valueHasRestrictedValues(val) {
|
|
33
|
+
if (typeof val === 'function') {
|
|
34
|
+
return true;
|
|
35
|
+
}
|
|
36
|
+
if (Array.isArray(val)) {
|
|
37
|
+
return this.arrayHasRestrictedValues(val);
|
|
38
|
+
}
|
|
39
|
+
if ((0, EventModifierUtil_1.isObject)(val)) {
|
|
40
|
+
return this.eventHasRestrictedValues(val);
|
|
41
|
+
}
|
|
42
|
+
return !this.isFinitePrimitive(val);
|
|
43
|
+
}
|
|
44
|
+
arrayHasRestrictedValues(arr) {
|
|
45
|
+
for (const val of arr) {
|
|
46
|
+
if (this.valueHasRestrictedValues(val) || val === undefined) {
|
|
47
|
+
return true;
|
|
48
|
+
}
|
|
49
|
+
}
|
|
50
|
+
return false;
|
|
51
|
+
}
|
|
52
|
+
isFinitePrimitive(value) {
|
|
53
|
+
return typeof value !== 'number' || isFinite(value);
|
|
54
|
+
}
|
|
55
|
+
}
|
|
56
|
+
exports.ValueRestrictionModifier = new ValueRestrictionModifierImpl();
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.MODIFY_EVENT_WHITELIST_NAMESPACE = exports.MODIFY_EVENT_WHITELIST_FIELDS = exports.SEND_SESSION_PROPERTY_EVENT_WHITELIST_FIELDS = exports.SEND_EVENT_WHITELIST_FIELDS = exports.SEND_SESSION_PROPERTY_EVENT_WHITELIST_NAMESPACES = exports.SEND_EVENT_WHITELIST_NAMESPACES = exports.AllCharacteristicsKeys = exports.KEY_NAME_REGEX = exports.MAX_CUSTOM_EVENT_VALUE_LENGTH = exports.MAX_CUSTOM_EVENT_KEY_LENGTH = exports.MAX_CUSTOM_EVENT_FIELDS = void 0;
|
|
4
|
+
const SPECIFICATION_VERSION = '0.18';
|
|
5
|
+
exports.MAX_CUSTOM_EVENT_FIELDS = 50;
|
|
6
|
+
exports.MAX_CUSTOM_EVENT_KEY_LENGTH = 100;
|
|
7
|
+
exports.MAX_CUSTOM_EVENT_VALUE_LENGTH = 5000;
|
|
8
|
+
exports.KEY_NAME_REGEX = RegExp('^[a-z0-9]+(?:\\.[a-z][a-z0-9]*|_[a-z0-9]+)*$');
|
|
9
|
+
exports.AllCharacteristicsKeys = [
|
|
10
|
+
"characteristics.has_anr",
|
|
11
|
+
"characteristics.has_crash",
|
|
12
|
+
"characteristics.has_csp_violation",
|
|
13
|
+
"characteristics.has_error",
|
|
14
|
+
"characteristics.has_exception",
|
|
15
|
+
"characteristics.has_failed_request",
|
|
16
|
+
"characteristics.has_request",
|
|
17
|
+
"characteristics.has_w3c_navigation_timings",
|
|
18
|
+
"characteristics.has_w3c_resource_timings",
|
|
19
|
+
"characteristics.has_navigation",
|
|
20
|
+
"characteristics.has_page_summary",
|
|
21
|
+
"characteristics.has_user_interaction",
|
|
22
|
+
"characteristics.has_view_summary",
|
|
23
|
+
"characteristics.is_api_reported",
|
|
24
|
+
"characteristics.is_app_start",
|
|
25
|
+
"characteristics.is_internal",
|
|
26
|
+
"characteristics.is_self_monitoring",
|
|
27
|
+
"characteristics.is_visibility_change",
|
|
28
|
+
"characteristics.has_event_properties",
|
|
29
|
+
"characteristics.has_session_properties",
|
|
30
|
+
];
|
|
31
|
+
exports.SEND_EVENT_WHITELIST_NAMESPACES = [
|
|
32
|
+
"event_properties",
|
|
33
|
+
];
|
|
34
|
+
exports.SEND_SESSION_PROPERTY_EVENT_WHITELIST_NAMESPACES = [
|
|
35
|
+
"session_properties",
|
|
36
|
+
];
|
|
37
|
+
exports.SEND_EVENT_WHITELIST_FIELDS = [
|
|
38
|
+
"duration",
|
|
39
|
+
];
|
|
40
|
+
exports.SEND_SESSION_PROPERTY_EVENT_WHITELIST_FIELDS = exports.SEND_EVENT_WHITELIST_FIELDS;
|
|
41
|
+
exports.MODIFY_EVENT_WHITELIST_FIELDS = [
|
|
42
|
+
"exception.stack_trace",
|
|
43
|
+
];
|
|
44
|
+
exports.MODIFY_EVENT_WHITELIST_NAMESPACE = [
|
|
45
|
+
"session_properties",
|
|
46
|
+
"event_properties",
|
|
47
|
+
];
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.defaultTimestampProvider = exports.TimestampProvider = void 0;
|
|
4
|
+
class TimestampProvider {
|
|
5
|
+
getCurrentTimestamp() {
|
|
6
|
+
return new Date().getTime();
|
|
7
|
+
}
|
|
8
|
+
}
|
|
9
|
+
exports.TimestampProvider = TimestampProvider;
|
|
10
|
+
exports.defaultTimestampProvider = new TimestampProvider();
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@dynatrace/react-native-plugin",
|
|
3
|
-
"version": "2.
|
|
3
|
+
"version": "2.311.1",
|
|
4
4
|
"description": "This plugin gives you the ability to use the Dynatrace Mobile agent in your react native application.",
|
|
5
5
|
"main": "index.js",
|
|
6
6
|
"types": "typings/react-native-dynatrace.d.ts",
|
|
@@ -33,6 +33,7 @@
|
|
|
33
33
|
"prepare": "husky"
|
|
34
34
|
},
|
|
35
35
|
"jest": {
|
|
36
|
+
"displayName": "@dynatrace/react-native-plugin",
|
|
36
37
|
"preset": "react-native",
|
|
37
38
|
"moduleDirectories": [
|
|
38
39
|
"node_modules"
|
|
@@ -74,8 +75,8 @@
|
|
|
74
75
|
"author": "Dynatrace",
|
|
75
76
|
"license": "SEE LICENSE IN LICENSE.md",
|
|
76
77
|
"dependencies": {
|
|
77
|
-
"@babel/runtime": "^7.
|
|
78
|
-
"jscodeshift": "^17.
|
|
78
|
+
"@babel/runtime": "^7.27.0",
|
|
79
|
+
"jscodeshift": "^17.3.0",
|
|
79
80
|
"plist": "^3.1.0",
|
|
80
81
|
"proxy-polyfill": "^0.3.2",
|
|
81
82
|
"semver": "^7.7.1"
|
|
@@ -129,46 +130,54 @@
|
|
|
129
130
|
"uglify-js": "^3.17.4"
|
|
130
131
|
},
|
|
131
132
|
"files": [
|
|
132
|
-
"command/command.js",
|
|
133
|
-
"command/util/*",
|
|
134
|
-
"command/interface/*",
|
|
135
|
-
"android/build.gradle",
|
|
136
|
-
"android/src/**/*",
|
|
137
|
-
"ios/**/*",
|
|
138
|
-
"files/*",
|
|
139
|
-
"lib/instrumentor/base/*.js",
|
|
140
|
-
"lib/instrumentor/base/model/*.js",
|
|
141
|
-
"lib/instrumentor/base/configuration/*.js",
|
|
142
|
-
"lib/instrumentor/base/configuration/interface/*.js",
|
|
143
|
-
"lib/instrumentor/base/interface/*.js",
|
|
144
|
-
"lib/instrumentor/base/util/*.js",
|
|
145
|
-
"lib/instrumentor/model/*.js",
|
|
146
|
-
"lib/instrumentor/parser/*.js",
|
|
147
|
-
"lib/instrumentor/DynatraceInstrumentation.js",
|
|
148
|
-
"lib/*.js",
|
|
149
|
-
"lib/community/*.js",
|
|
150
|
-
"lib/community/gesture-handler/*.js",
|
|
151
|
-
"lib/react-navigation/*.js",
|
|
152
|
-
"lib/react-native/*.js",
|
|
153
|
-
"lib/react-native/Touchables.jsx",
|
|
154
|
-
"lib/react/*.js",
|
|
155
|
-
"lib/metro/*.js",
|
|
156
|
-
"lib/util/*.js",
|
|
157
133
|
"react-native.config.js",
|
|
158
134
|
"react-native-dynatrace.js",
|
|
159
135
|
"react-native-dynatrace.podspec",
|
|
136
|
+
"jsx-runtime.js",
|
|
137
|
+
"jsx-dev-runtime.js",
|
|
160
138
|
"README.md",
|
|
161
139
|
"LICENSE.md",
|
|
140
|
+
"package.json",
|
|
141
|
+
"android/build.gradle",
|
|
142
|
+
"android/src/**/*",
|
|
143
|
+
"ios/**/*",
|
|
144
|
+
"files/*",
|
|
145
|
+
"typings/*",
|
|
146
|
+
"command/command.js",
|
|
147
|
+
"command/util/*",
|
|
148
|
+
"command/interface/*",
|
|
162
149
|
"scripts/*",
|
|
163
150
|
"scripts/api/*",
|
|
164
151
|
"scripts/core/*",
|
|
165
152
|
"scripts/api/model/*",
|
|
166
153
|
"scripts/util/*",
|
|
167
|
-
"
|
|
168
|
-
"
|
|
169
|
-
"
|
|
170
|
-
"
|
|
171
|
-
"
|
|
154
|
+
"instrumentation/jsx/*.js",
|
|
155
|
+
"instrumentation/jsx/components/*.js",
|
|
156
|
+
"instrumentation/libs/*.js",
|
|
157
|
+
"instrumentation/libs/community/*.js",
|
|
158
|
+
"instrumentation/libs/community/gesture-handler/*.js",
|
|
159
|
+
"instrumentation/libs/react-navigation/*.js",
|
|
160
|
+
"instrumentation/libs/react-native/*.js",
|
|
161
|
+
"instrumentation/libs/react-native/Touchables.jsx",
|
|
162
|
+
"instrumentation/model/*.js",
|
|
163
|
+
"instrumentation/parser/*.js",
|
|
164
|
+
"instrumentation/DynatraceInstrumentation.js",
|
|
165
|
+
"lib/*.js",
|
|
166
|
+
"lib/core/*.js",
|
|
167
|
+
"lib/core/configuration/*.js",
|
|
168
|
+
"lib/core/interface/*.js",
|
|
169
|
+
"lib/core/logging/*.js",
|
|
170
|
+
"lib/core/model/*.js",
|
|
171
|
+
"lib/core/util/*.js",
|
|
172
|
+
"lib/core/*.js",
|
|
173
|
+
"lib/metro/*.js",
|
|
174
|
+
"lib/next/*.js",
|
|
175
|
+
"lib/next/appstart/*.js",
|
|
176
|
+
"lib/next/events/*.js",
|
|
177
|
+
"lib/next/events/modifier/*.js",
|
|
178
|
+
"lib/next/events/spec/*.js",
|
|
179
|
+
"lib/next/provider/*.js",
|
|
180
|
+
"src/lib/core/interface/NativeDynatraceBridge.ts"
|
|
172
181
|
],
|
|
173
182
|
"codegenConfig": {
|
|
174
183
|
"name": "DynatraceBridgeSpec",
|
|
@@ -111,7 +111,7 @@ Pod::Spec.new do |s|
|
|
|
111
111
|
#
|
|
112
112
|
|
|
113
113
|
s.dependency "React"
|
|
114
|
-
s.dependency 'Dynatrace', '~> 8.
|
|
114
|
+
s.dependency 'Dynatrace', '~> 8.311.1.1013'
|
|
115
115
|
|
|
116
116
|
# Allows for better compatibility for older and newer versions
|
|
117
117
|
if defined?(install_modules_dependencies)
|
package/scripts/Android.js
CHANGED
|
@@ -1,12 +1,13 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
2
|
'use strict';
|
|
3
3
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
4
|
-
exports.writeGradleConfig = exports.instrumentAndroidPlatform = exports.GRADLE_APPLY_BUILDSCRIPT = exports.GRADLE_DYNATRACE_FILE = void 0;
|
|
4
|
+
exports.copyGradleConfigFile = exports.writeGradleConfig = exports.instrumentAndroidPlatform = exports.GRADLE_APPLY_BUILDSCRIPT = exports.GRADLE_DYNATRACE_FILE = void 0;
|
|
5
5
|
const Logger_1 = require("./Logger");
|
|
6
6
|
const FileOperationHelper_1 = require("./FileOperationHelper");
|
|
7
7
|
const PathsConstants_1 = require("./PathsConstants");
|
|
8
|
+
const path_1 = require("path");
|
|
8
9
|
const GRADLE_CONFIG_IDENTIFIER = '// AUTO - INSERTED';
|
|
9
|
-
exports.GRADLE_DYNATRACE_FILE =
|
|
10
|
+
exports.GRADLE_DYNATRACE_FILE = `apply from: "./${PathsConstants_1.DYNATRACE_CONFIG_GRADLE_FILE}"`;
|
|
10
11
|
const GRADLE_BUILDSCRIPT_IDENTIFIER = 'buildscript';
|
|
11
12
|
exports.GRADLE_APPLY_BUILDSCRIPT = 'apply from: "../node_modules/@dynatrace/react-native-plugin/files/plugin.gradle", to: buildscript';
|
|
12
13
|
const GRADLE_REACT_NATIVE_PLUGIN = 'apply plugin: "com.facebook.react.rootproject"';
|
|
@@ -39,7 +40,7 @@ const changeReactNativeBuildGradleFile = (pathToGradle, remove) => {
|
|
|
39
40
|
if (gradleFileContentLines[i].indexOf('plugin.gradle') > -1) {
|
|
40
41
|
gradlePluginFileIndex = i;
|
|
41
42
|
}
|
|
42
|
-
else if (gradleFileContentLines[i].indexOf(
|
|
43
|
+
else if (gradleFileContentLines[i].indexOf(PathsConstants_1.DYNATRACE_CONFIG_GRADLE_FILE) > -1) {
|
|
43
44
|
gradleDynatraceFileIndex = i;
|
|
44
45
|
}
|
|
45
46
|
}
|
|
@@ -112,9 +113,14 @@ const writeGradleConfig = (androidConfig) => {
|
|
|
112
113
|
gradleFileContentLines.splice(gradleFileIndex + 1, 0, androidConfig.config);
|
|
113
114
|
const fullGradleFile = gradleFileContentLines.join('\n');
|
|
114
115
|
FileOperationHelper_1.default.writeTextToFileSync(PathsConstants_1.default.getDynatraceGradleFile(), fullGradleFile);
|
|
115
|
-
Logger_1.default.logMessageSync(
|
|
116
|
+
Logger_1.default.logMessageSync(`Replaced old configuration with current configuration in ${PathsConstants_1.DYNATRACE_CONFIG_GRADLE_FILE}`, Logger_1.default.INFO);
|
|
116
117
|
};
|
|
117
118
|
exports.writeGradleConfig = writeGradleConfig;
|
|
119
|
+
const copyGradleConfigFile = (pathToGradle) => {
|
|
120
|
+
const gradleDirectory = (0, path_1.dirname)(pathToGradle);
|
|
121
|
+
FileOperationHelper_1.default.copyFileSync(PathsConstants_1.default.getDynatraceGradleFile(), (0, path_1.join)(gradleDirectory, PathsConstants_1.DYNATRACE_CONFIG_GRADLE_FILE));
|
|
122
|
+
};
|
|
123
|
+
exports.copyGradleConfigFile = copyGradleConfigFile;
|
|
118
124
|
const removeOldGradleConfig = (gradleFileContent) => {
|
|
119
125
|
const gradleFileContentLines = gradleFileContent.split('\n');
|
|
120
126
|
const gradleConfigIndex = [];
|
|
@@ -1,9 +1,11 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
2
|
'use strict';
|
|
3
3
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
4
|
+
exports.DYNATRACE_CONFIG_GRADLE_FILE = void 0;
|
|
4
5
|
const path_1 = require("path");
|
|
5
6
|
const PATH_FILES = 'files';
|
|
6
7
|
const PATH_LOGS = 'logs';
|
|
8
|
+
exports.DYNATRACE_CONFIG_GRADLE_FILE = 'dynatrace.gradle';
|
|
7
9
|
let rootPath = __dirname;
|
|
8
10
|
exports.default = {
|
|
9
11
|
setRoot: (newRoot) => {
|
|
@@ -25,7 +27,7 @@ exports.default = {
|
|
|
25
27
|
getAndroidFolder: () => (0, path_1.join)(getApplicationPath(), 'android'),
|
|
26
28
|
getAndroidGradleFile: (androidFolder) => (0, path_1.join)(androidFolder, 'build.gradle'),
|
|
27
29
|
getIOSFolder: () => (0, path_1.join)(getApplicationPath(), 'ios'),
|
|
28
|
-
getDynatraceGradleFile: () => (0, path_1.join)(getPluginPath(), PATH_FILES,
|
|
30
|
+
getDynatraceGradleFile: () => (0, path_1.join)(getPluginPath(), PATH_FILES, exports.DYNATRACE_CONFIG_GRADLE_FILE),
|
|
29
31
|
getCurrentLogPath: () => (0, path_1.join)(getPluginPath(), PATH_LOGS, 'currentLog.txt'),
|
|
30
32
|
getLogPath: () => (0, path_1.join)(getPluginPath(), PATH_LOGS),
|
|
31
33
|
};
|
|
@@ -54,6 +54,7 @@ const instrumentCommand = () => {
|
|
|
54
54
|
Logger_1.default.logMessageSync('Starting Android Instrumentation with Dynatrace!', Logger_1.default.INFO);
|
|
55
55
|
android.instrumentAndroidPlatform(pathToGradle, false);
|
|
56
56
|
android.writeGradleConfig(configAgent.android);
|
|
57
|
+
android.copyGradleConfigFile(pathToGradle);
|
|
57
58
|
}
|
|
58
59
|
catch (e) {
|
|
59
60
|
if (e instanceof Error) {
|
|
@@ -6,6 +6,10 @@ import { TurboModuleRegistry } from 'react-native';
|
|
|
6
6
|
import { UnsafeObject } from 'react-native/Libraries/Types/CodegenTypes';
|
|
7
7
|
|
|
8
8
|
export interface Spec extends TurboModule {
|
|
9
|
+
// Event Listener for AppStart
|
|
10
|
+
addListener: (eventName: string) => void;
|
|
11
|
+
removeListeners: (count: number) => void;
|
|
12
|
+
|
|
9
13
|
getConstants: () => {
|
|
10
14
|
DATA_COLLECTION_OFF: string;
|
|
11
15
|
DATA_COLLECTION_PERFORMANCE: string;
|
|
@@ -154,6 +158,10 @@ export interface Spec extends TurboModule {
|
|
|
154
158
|
requestSize: number,
|
|
155
159
|
responseSize: number,
|
|
156
160
|
): void;
|
|
161
|
+
|
|
162
|
+
startView(name: string): void;
|
|
163
|
+
|
|
164
|
+
stopView(): void;
|
|
157
165
|
}
|
|
158
166
|
|
|
159
167
|
// eslint-disable-next-line @typescript-eslint/consistent-type-definitions
|
|
@@ -580,6 +580,79 @@ export declare const Dynatrace: {
|
|
|
580
580
|
* @see https://www.npmjs.com/package/@dynatrace/react-native-plugin#business-event-capturing
|
|
581
581
|
*/
|
|
582
582
|
sendBizEvent(type: string, attributes?: JSONObject, platform?: Platform): void;
|
|
583
|
+
|
|
584
|
+
/**
|
|
585
|
+
* Adds an event modifier, which will be executed in the end before
|
|
586
|
+
* the event is transfered. This allows to modify the event to some extent.
|
|
587
|
+
*
|
|
588
|
+
* @param eventModifier Function which is modify an event
|
|
589
|
+
*/
|
|
590
|
+
addEventModifier(eventModifier: IEventModifier): IEventModifier;
|
|
591
|
+
|
|
592
|
+
/**
|
|
593
|
+
* Is removing an event modifier again, so it will not modify events anymore.
|
|
594
|
+
*
|
|
595
|
+
* @param eventModifier Function which should be removed
|
|
596
|
+
*/
|
|
597
|
+
removeEventModifier(eventModifier: IEventModifier): boolean;
|
|
598
|
+
|
|
599
|
+
/**
|
|
600
|
+
* Send a Event
|
|
601
|
+
*
|
|
602
|
+
* With sendEvent, you can report a event.
|
|
603
|
+
*
|
|
604
|
+
* Note: The 'dt' key, as well as all 'dt.' prefixed keys are considered reserved by Dynatrace
|
|
605
|
+
* and will be stripped from the passed in attributes. TODO: Add Others here.
|
|
606
|
+
*
|
|
607
|
+
* @param {string} type Mandatory event type
|
|
608
|
+
* @param {JSONObject} properties Must be a valid JSON object and cannot contain functions,
|
|
609
|
+
* undefined, Infinity and NaN as values, otherwise they will be removed.
|
|
610
|
+
* Attributes need to be serializable using JSON.stringify.
|
|
611
|
+
* The resulting event will be populated with attributes parameter,
|
|
612
|
+
* and enriched with additional properties, thus also empty objects are valid.
|
|
613
|
+
* @param {any} context optional context that can be used to manipulate the resulting event
|
|
614
|
+
* using an event modifier
|
|
615
|
+
*/
|
|
616
|
+
sendEvent(properties: JSONObject, context?: any): void;
|
|
617
|
+
|
|
618
|
+
/**
|
|
619
|
+
* Sets the current view context which will be used for every event happening in the meantime.
|
|
620
|
+
*
|
|
621
|
+
* @param name Name of the current view
|
|
622
|
+
*/
|
|
623
|
+
startView(name: string): void;
|
|
624
|
+
|
|
625
|
+
/**
|
|
626
|
+
* Removes the current view context
|
|
627
|
+
*/
|
|
628
|
+
stopView(): void;
|
|
629
|
+
|
|
630
|
+
/**
|
|
631
|
+
* Send a Session Properties Event.
|
|
632
|
+
*
|
|
633
|
+
* With sendSessionPropertyEvent you can report properties that apply to all events in the current session. Any
|
|
634
|
+
* custom properties must be added in the 'session_properties.*' namespace, otherwise they will be dropped. Only one
|
|
635
|
+
* session properties event may be active for every session.
|
|
636
|
+
*
|
|
637
|
+
* @param properties any attributes that should be reported for every event in the session.
|
|
638
|
+
*/
|
|
639
|
+
sendSessionPropertyEvent(properties: JSONObject): void;
|
|
640
|
+
}
|
|
641
|
+
|
|
642
|
+
/**
|
|
643
|
+
* Interface which declares event modification through modifyEvent
|
|
644
|
+
*/
|
|
645
|
+
export declare interface IEventModifier {
|
|
646
|
+
/**
|
|
647
|
+
* Event as JSONObject is received and can be modified. If instead of the event
|
|
648
|
+
* null is returned, the event will be canceled.
|
|
649
|
+
*
|
|
650
|
+
* @param event Event as JSONObject
|
|
651
|
+
* @param context optional context that can be used to manipulate the resulting event
|
|
652
|
+
* using an event modifier or undefined if not available
|
|
653
|
+
* @returns Either the modified event or null if you want to cancel the event
|
|
654
|
+
*/
|
|
655
|
+
modifyEvent(event: JSONObject | null, context?: any): JSONObject | null;
|
|
583
656
|
}
|
|
584
657
|
|
|
585
658
|
export declare interface IDynatraceAction {
|