@dynatrace/react-native-plugin 2.305.1 → 2.307.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 CHANGED
@@ -27,17 +27,18 @@ If you want to start using this plugin and are not a Dynatrace customer yet, hea
27
27
  * Android Gradle plugin version 7.0+
28
28
  * Java 11
29
29
  * For iOS users: Minimum iOS 12
30
+ * NodeJS 18+
30
31
 
31
32
  ## Agent Versions
32
33
  This agent versions are configured in this plugin:
33
34
 
34
- * Android Agent: 8.305.1.1005
35
- * iOS Agent: 8.305.3.1016
35
+ * Android Agent: 8.307.1.1005
36
+ * iOS Agent: 8.307.1.1014
36
37
 
37
38
  ## Quick Setup
38
39
 
39
40
  1. [Install plugin](#1-install-the-plugin)
40
- 2. [Register Dynatrace transformer](#2-register-the-dynatrace-transformer)
41
+ 2. [Register Dynatrace transformer and reporter](#2-register-the-dynatrace-transformer-and-reporter)
41
42
  3. [Setup configuration](#3-setup-dynatraceconfigjs)
42
43
  4. [Update Babel Configuration](#4-update-babel-configuration)
43
44
  5. [Build and run your app](#4-build-and-run-your-app)
@@ -106,7 +107,9 @@ This agent versions are configured in this plugin:
106
107
  - Standalone Project: If you are using React Native standalone and embed it in your native project have a look [here](#configuration-of-standalone-react-native-project).
107
108
  - If for some reason (e.g. seperate native projects) `react-native link` doesn't work as expected, [manually add the iOS agent to your project](#manually-adding-ios-oneagent-to-a-project).
108
109
 
109
- ## 2. Register the Dynatrace transformer
110
+ ## 2. Register the Dynatrace transformer and reporter
111
+
112
+ The transformer will add modifications to your code during build. The reporter will notify us if you clear the cache of the metro bundler.
110
113
 
111
114
  Depending on your React Native version, you will need to use a different way to register the transformer. If you don't know the version, enter `react-native --version` in your terminal.
112
115
 
@@ -193,7 +196,7 @@ The required changes for the versions above can be found [here](#react-automatic
193
196
 
194
197
  1. Only for Expo: If using expo make sure that your project is containing a "android" and/or "ios" folder. This can be done by using `npx expo prebuild`.
195
198
 
196
- 2. Execute [`npx instrumentDynatrace`](#npx-instrumentdynatrace) or `react-native instrument-dynatrace` in the root of your React Native project. This will configure both Android and iOS projects with the settings from `dynatrace.config.js`. You can use the same [custom arguments](#customizing-paths-for-configuration) as mentioned above.
199
+ 2. Execute [`npx instrumentDynatrace`](#npx-instrumentdynatrace) or `react-native instrument-dynatrace` in the root of your React Native project. This will configure both Android and iOS projects with the settings from `dynatrace.config.js`. You can use the same [custom arguments](#customizing-paths-for-configuration) as mentioned above. Be aware this configuration step will modify your application's *.plist and build.gradle file. This modification enables auto instrumentation on Android and is writing the configuration for both platforms needed for the OneAgent.
197
200
 
198
201
  1. Use `react-native run-android` or `react-native run-ios` to rebuild and run your app. Specify custom paths via [custom arguments.](#customizing-paths-for-configuration).
199
202
 
@@ -318,13 +321,13 @@ Dynatrace.withMonitoring(MyFunctionalComponent, "MyFunctionalComponent");
318
321
 
319
322
  The String "MyFunctionalComponent" is optional as the name of the component can be retrieved through [different properties](#how-does-dynatrace-determine-the-user-action-name).
320
323
 
321
- Combining manual and auto instrumentation is not creating a problem as both are executing the same thing. Manual instrumentation would only override the content of auto instrumentation happening through the transformer.
324
+ Combining manual and auto instrumentation should not be a problem. As they're running the same execution, the manual instrumentation will only override the content of auto instrumentation happening through the transformer.
322
325
 
323
326
  ### Create custom actions
324
327
 
325
328
  There are two options to create an action. Either using `enterAutoAction` (the previous `enterAction`) or `enterManualAction`:
326
329
 
327
- * `enterAutoAction` - Creates an Action which will be automatically handled by the plugin (This is the type of action which is internally used by the plugin when monitoring components and touchables). This means that the plugin decides about the hierachy of this action. If there is no open action, the following action will be a root action. All other actions created by this method, while a root action is open, will be automatically inserted as a child action. Furthermore the plugin will automatically link webrequest (if they are not tagged manually) to the open root action.
330
+ * `enterAutoAction` - Creates an Action which will be automatically handled by the plugin (This is the type of action which is internally used by the plugin when monitoring components and touchables). This means that the plugin decides about the hierachy of this action. If there is no open action, the following action will be a root action. All other actions created by this method, while a root action is open, will be automatically inserted as a child action. Furthermore the plugin will automatically link webrequest (if they are not tagged manually) to the open root action. Be aware that the timeout/wait time for sub actions or web requests cannot be modified on the Android side for React Native Auto actions. The timeout is fixed to a 1000ms.
328
331
 
329
332
  ```ts
330
333
  import { Dynatrace } from '@dynatrace/react-native-plugin';
@@ -1236,7 +1239,7 @@ module.exports = {
1236
1239
 
1237
1240
  If you want to register the Dynatrace transformer in your configuration and you already have a transformer in place, change the upstreaming transformer for the Dynatrace transformer.
1238
1241
 
1239
- This can be done via a configuration value in the `dynatrace.config.js`. The following example shows how the configuration might look like for the popular `react-native-svg-transformer`. Be aware that the following example is targeting *React Native v0.72.1* or newer.
1242
+ This can be done via a configuration value in the `dynatrace.config.js`. The following example shows how the configuration might look like for the popular `react-native-svg-transformer`. Be aware that the following example is targeting *React Native v0.72.1* or newer. Be aware if you are using a different second transformer, you need to change `react-native-svg-transformer/react-native` accordingly.
1240
1243
 
1241
1244
  #### dynatrace.config.js
1242
1245
 
@@ -1244,7 +1247,7 @@ This can be done via a configuration value in the `dynatrace.config.js`. The fol
1244
1247
  // The `...` only indicates that there are other values as well, but we've omitted them in this example.
1245
1248
  module.exports = {
1246
1249
  react : {
1247
- upstreamTransformer: require.resolve('customTransformerLib/myTransformer'),
1250
+ upstreamTransformer: require.resolve('react-native-svg-transformer/react-native'),
1248
1251
  ...
1249
1252
  },
1250
1253
  ...
@@ -1460,6 +1463,10 @@ If you are struggling with a problem, submit a support ticket to Dynatrace (supp
1460
1463
  <br/><br/>
1461
1464
  ## Changelog
1462
1465
 
1466
+ 2.307.1
1467
+ * Updated Android (8.307.1.1005) & iOS Agent (8.307.1.1014)
1468
+ * Now require the use of NodeJS 18+
1469
+
1463
1470
  2.305.1
1464
1471
  * Updated Android (8.305.1.1005) & iOS Agent (8.305.3.1016)
1465
1472
 
@@ -70,7 +70,7 @@ repositories {
70
70
  }
71
71
 
72
72
  dependencies {
73
- implementation 'com.dynatrace.agent:agent-android:8.305.1.1005'
73
+ implementation 'com.dynatrace.agent:agent-android:8.307.1.1005'
74
74
  implementation "com.facebook.react:react-native:${safeExtGet('reactNative', '+')}"
75
75
  }
76
76
 
@@ -268,6 +268,10 @@ public class DynatraceRNBridgeImpl {
268
268
  }
269
269
  }
270
270
 
271
+ public void forwardEvent(ReadableMap attributes) {
272
+ HybridBridge.forwardEvent(new JSONObject(toHashMap(attributes)));
273
+ }
274
+
271
275
  public void setGPSLocation(double latitude, double longitude, String platform){
272
276
  if(this.shouldWorkOnAndroid(platform)){
273
277
  Location location = new Location("");
@@ -24,6 +24,22 @@ class DynatraceUtils {
24
24
  arrayList.add(array.getBoolean(i));
25
25
  break;
26
26
  case Number:
27
+ double value = array.getDouble(i);
28
+
29
+ if(Double.isFinite(value)){
30
+ if (value >= Integer.MIN_VALUE && value <= Integer.MAX_VALUE && value == (int) value) {
31
+ // This is a int
32
+ arrayList.add((int) array.getDouble(i));
33
+ }
34
+
35
+ if (value >= Long.MIN_VALUE && value <= Long.MAX_VALUE && value == (long) value){
36
+ // This is a long
37
+ arrayList.add((long) array.getDouble(i));
38
+ }
39
+
40
+ break;
41
+ }
42
+
27
43
  arrayList.add(array.getDouble(i));
28
44
  break;
29
45
  case String:
@@ -55,6 +71,22 @@ class DynatraceUtils {
55
71
  hashMap.put(key, map.getBoolean(key));
56
72
  break;
57
73
  case Number:
74
+ double value = map.getDouble(key);
75
+
76
+ if(Double.isFinite(value)){
77
+ if (value >= Integer.MIN_VALUE && value <= Integer.MAX_VALUE && value == (int) value) {
78
+ // This is a int
79
+ hashMap.put(key, (int) map.getDouble(key));
80
+ }
81
+
82
+ if (value >= Long.MIN_VALUE && value <= Long.MAX_VALUE && value == (long) value){
83
+ // This is a long
84
+ hashMap.put(key, (long) map.getDouble(key));
85
+ }
86
+
87
+ break;
88
+ }
89
+
58
90
  hashMap.put(key, map.getDouble(key));
59
91
  break;
60
92
  case String:
@@ -140,6 +140,11 @@ public class DynatraceRNBridge extends NativeDynatraceBridgeSpec {
140
140
  this.impl.sendBizEvent(type, attributes, platform);
141
141
  }
142
142
 
143
+ @Override
144
+ public void forwardEvent(ReadableMap attributes) {
145
+ this.impl.forwardEvent(attributes);
146
+ }
147
+
143
148
  @Override
144
149
  public void setGPSLocation(double latitude, double longitude, String platform){
145
150
  this.impl.setGPSLocation(latitude, longitude, platform);
@@ -142,6 +142,11 @@ public class DynatraceRNBridge extends ReactContextBaseJavaModule {
142
142
  this.impl.sendBizEvent(type, attributes, platform);
143
143
  }
144
144
 
145
+ @ReactMethod
146
+ public void forwardEvent(ReadableMap attributes) {
147
+ this.impl.forwardEvent(attributes);
148
+ }
149
+
145
150
  @ReactMethod
146
151
  public void setGPSLocation(double latitude, double longitude, String platform){
147
152
  this.impl.setGPSLocation(latitude, longitude, platform);
@@ -1,3 +1,3 @@
1
1
  dependencies {
2
- classpath 'com.dynatrace.tools.android:gradle-plugin:8.305.1.1005'
2
+ classpath 'com.dynatrace.tools.android:gradle-plugin:8.307.1.1005'
3
3
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@dynatrace/react-native-plugin",
3
- "version": "2.305.1",
3
+ "version": "2.307.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",
@@ -74,11 +74,11 @@
74
74
  "author": "Dynatrace",
75
75
  "license": "SEE LICENSE IN LICENSE.md",
76
76
  "dependencies": {
77
- "@babel/runtime": "^7.26.0",
78
- "jscodeshift": "^17.1.1",
77
+ "@babel/runtime": "^7.26.7",
78
+ "jscodeshift": "^17.1.2",
79
79
  "plist": "^3.1.0",
80
80
  "proxy-polyfill": "^0.3.2",
81
- "semver": "^7.6.3"
81
+ "semver": "^7.7.1"
82
82
  },
83
83
  "homepage": "https://www.dynatrace.com/",
84
84
  "peerDependencies": {
@@ -100,19 +100,19 @@
100
100
  "@types/jest": "^29.5.1",
101
101
  "@types/jscodeshift": "^0.11.6",
102
102
  "@types/libxmljs": "^0.18.3",
103
- "@types/node": "^18.17.12",
103
+ "@types/node": "^18.19.71",
104
104
  "@types/plist": "^3.0.2",
105
105
  "@types/react-native": "^0.63.32",
106
106
  "@types/semver": "^7.5.0",
107
107
  "@types/shelljs": "^0.8.8",
108
108
  "@types/uglify-js": "^3.17.1",
109
- "@typescript-eslint/eslint-plugin": "^5.16.0",
110
- "@typescript-eslint/parser": "^5.16.0",
109
+ "@typescript-eslint/eslint-plugin": "^8.22.0",
110
+ "@typescript-eslint/parser": "^8.22.0",
111
111
  "compressing": "^1.5.1",
112
- "eslint": "^8.45.0",
112
+ "eslint": "^9.19.0",
113
113
  "eslint-config-prettier": "^8.5.0",
114
- "eslint-plugin-import": "^2.26.0",
115
- "eslint-plugin-jsdoc": "^39.1.0",
114
+ "eslint-plugin-import": "^2.31.0",
115
+ "eslint-plugin-jsdoc": "^50.6.3",
116
116
  "eslint-plugin-prefer-arrow": "^1.2.3",
117
117
  "eslint-plugin-unicorn": "^42.0.0",
118
118
  "husky": "^9.1.6",
@@ -177,5 +177,8 @@
177
177
  "android": {
178
178
  "javaPackageName": "com.dynatrace.android.agent"
179
179
  }
180
+ },
181
+ "engines": {
182
+ "node": ">=18"
180
183
  }
181
184
  }
@@ -111,7 +111,7 @@ Pod::Spec.new do |s|
111
111
  #
112
112
 
113
113
  s.dependency "React"
114
- s.dependency 'Dynatrace', '~> 8.305.3.1016'
114
+ s.dependency 'Dynatrace', '~> 8.307.1.1014'
115
115
 
116
116
  # Allows for better compatibility for older and newer versions
117
117
  if defined?(install_modules_dependencies)
@@ -109,6 +109,8 @@ export interface Spec extends TurboModule {
109
109
  plaform?: string,
110
110
  ): void;
111
111
 
112
+ forwardEvent(attributes: UnsafeObject): void;
113
+
112
114
  setGPSLocation(
113
115
  latitude: number,
114
116
  longitude: number,