@dynatrace/react-native-plugin 2.287.3 → 2.291.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
@@ -15,6 +15,8 @@ If you want to start using this plugin and are not a Dynatrace customer yet, hea
15
15
  * Reporting React Native errors
16
16
  * Manual instrumentation
17
17
  * Typescript bindings to add manual instrumentation
18
+ * New React-Native architecture
19
+ >**Note:** With iOS specifically, we noticed that there are some features that are not working the same as when using the current default architecture. You may experience issues with crash reporting being captured and web requests being linked to specific user actions. Per react native, [the new architecture is experimental](https://reactnative.dev/docs/the-new-architecture/landing-page#should-i-use-the-new-architecture-today). We will keep an eye on new updates and will continue to improve our support for the new architecture on both platforms.
18
20
 
19
21
  ## Requirements
20
22
  * React v16.8 or newer
@@ -29,8 +31,8 @@ If you want to start using this plugin and are not a Dynatrace customer yet, hea
29
31
  ## Agent Versions
30
32
  This agent versions are configured in this plugin:
31
33
 
32
- * Android Agent: 8.287.1.1006
33
- * iOS Agent: 8.287.2.1009
34
+ * Android Agent: 8.291.1.1002
35
+ * iOS Agent: 8.291.1.1004
34
36
 
35
37
  ## Quick Setup
36
38
 
@@ -55,7 +57,7 @@ This agent versions are configured in this plugin:
55
57
  * [Crash Reporting](#manually-report-a-crash)
56
58
  * [User Privacy Options](#user-privacy-options)
57
59
  * [Report GPS Position](#report-gps-location)
58
- * [Business events capturing](#business-event-capturing)
60
+ * [Business event capturing](#business-event-capturing)
59
61
  * [Platform independent reporting](#platform-independent-reporting)
60
62
  * [Set beacon headers](#setting-beacon-headers)
61
63
  * [Exclude Individual JSX Elements](#exclude-individual-jsx-elements)
@@ -73,6 +75,7 @@ This agent versions are configured in this plugin:
73
75
  * [Agent debug logs](#native-oneagent-debug-logs)
74
76
  * [How does Dynatrace determine the user action name?](#how-does-dynatrace-determine-the-user-action-name)
75
77
  * [Using dtActionName](#using-dtactionname-to-change-the-name-of-the-action)
78
+ * [How does Dynatrace automatically report crashes?](#how-does-dynatrace-automatically-report-crashes)
76
79
  * [React Automatic Runtime](#react-automatic-runtime)
77
80
  * [Using a second transformer besides the dynatrace transformer](#using-a-second-transformer-besides-the-dynatrace-transformer)
78
81
  * [Upgrading project to Gradle 6](#updating-to-gradle-6)
@@ -217,10 +220,10 @@ module.exports = {
217
220
 
218
221
  Example of a startup call:
219
222
 
220
- ```js
223
+ ```ts
221
224
  import { Dynatrace, ConfigurationBuilder } from '@dynatrace/react-native-plugin';
222
225
 
223
- Dynatrace.start(new ConfigurationBuilder("beaconUrl", "applicationId").buildConfiguration());
226
+ await Dynatrace.start(new ConfigurationBuilder("beaconUrl", "applicationId").buildConfiguration());
224
227
  ```
225
228
 
226
229
  For more details see the section about [startup API](#plugin-startup).
@@ -231,39 +234,45 @@ For more details see the section about [startup API](#plugin-startup).
231
234
 
232
235
  To use the API of the React Native plugin, import the API:
233
236
 
234
- ```js
235
- import { Dynatrace, Platform } from '@dynatrace/react-native-plugin';
237
+ ```ts
238
+ import { Dynatrace } from '@dynatrace/react-native-plugin';
236
239
  ```
237
240
 
238
241
  ### Plugin startup
239
242
 
240
243
  The manual startup of the plugin is triggered via the `start(configuration: IConfiguration)` method. If you configured `dynatrace.config.js` for manual startup then the plugin doesn't send any data when not calling this function. Besides the application id and the beacon URL, there are several optional configuration parameters, which are shown in the table below.
241
244
 
242
- ```js
245
+ ```ts
246
+ import { Dynatrace, ConfigurationBuilder, LogLevel } from '@dynatrace/react-native-plugin';
247
+
243
248
  const configurationBuilder = new ConfigurationBuilder("beaconUrl", "applicationId");
244
249
 
245
250
  configurationBuilder.withCrashReporting(true)
251
+ .withErrorHandler(true)
252
+ .withReportFatalErrorAsCrash(true)
246
253
  .withLogLevel(LogLevel.Info)
247
254
  .withLifecycleUpdate(false)
248
255
  .withUserOptIn(false)
249
256
  .withActionNamePrivacy(false)
250
257
  .withBundleName(undefined);
251
258
 
252
- Dynatrace.start(configurationBuilder.buildConfiguration());
259
+ await Dynatrace.start(configurationBuilder.buildConfiguration());
253
260
  ```
254
261
 
255
- **Info**: The values used in the function calls for the parameters are also their default value.
262
+ **Info**: The value used in the function calls for the parameters is also their default value.
256
263
 
257
- | Property name | Type | Default | Description |
258
- |------------------|--------|-------------|---------------------------------------------------|
259
- |beaconUrl |string |undefined |Identifies your environment within Dynatrace. This property is mandatory for [manual startup](#manual-oneagent-startup). OneAgent issues an error when the key isn't present.|
260
- |applicationId |string |undefined |Identifies your mobile app. This property is mandatory for [manual startup](#manual-oneagent-startup). OneAgent issues an error when the key isn't present.|
261
- |reportCrash |boolean |true |Reports crashes. |
262
- |logLevel |LogLevel|LogLevel.Info|Allows you to choose between `LogLevel.Info` and `LogLevel.Debug`. Debug returns more logs. This is especially important when something is not functioning correctly.|
263
- |lifecycleUpdate |boolean |false |Decide if you want to see update cycles on lifecycle actions as well. This is per default false as it creates a lot more actions.|
264
- |userOptIn |boolean |false |Activates the privacy mode when set to `true`. User consent must be queried and set. The privacy settings for [data collection](#data-collection) and [crash reporting](#crash-reporting) can be changed via OneAgent SDK for Mobile as described under Data privacy. The default value is `false`.|
265
- |actionNamePrivacy|boolean|false|Activates a privacy mode especially for Touchables and Buttons. Setting this option to true means that a name for the control will no longer be shown, e.g. "Touch on Button". When setting a dtActionName onto the component this setting will be ignored.
266
- |bundleName|string|undefined|Should be used only if you have a multiple bundle setup where you load several .bundle files within your React Native application. Enter the name of your bundle. This should be unique in comparison to your other bundle names. This will ensure that actions coming from different bundles will not interfere with each other.
264
+ | Property name | Type | Default | Description |
265
+ |-------------------------|--------|-------------|---------------------------------------------------|
266
+ |beaconUrl |string |undefined |Identifies your environment within Dynatrace. This property is mandatory for [manual startup](#manual-oneagent-startup). OneAgent issues an error when the key isn't present.|
267
+ |applicationId |string |undefined |Identifies your mobile app. This property is mandatory for [manual startup](#manual-oneagent-startup). OneAgent issues an error when the key isn't present.|
268
+ |reportCrash |boolean |true |Reports crashes. |
269
+ |errorHandler |boolean |true |Enables the error/crash handler. |
270
+ |reportFatalErrorAsCrash |boolean |true |Reports an unhandled fatal error as a crash or an error. |
271
+ |logLevel |LogLevel|LogLevel.Info|Allows you to choose between `LogLevel.Info` and `LogLevel.Debug`. Debug returns more logs. This is especially important when something is not functioning correctly.|
272
+ |lifecycleUpdate |boolean |false |Decide if you want to see update cycles on lifecycle actions as well. This is per default false as it creates a lot more actions.|
273
+ |userOptIn |boolean |false |Activates the privacy mode when set to `true`. User consent must be queried and set. The privacy settings for [data collection](#user-privacy-options) and [crash reporting](#crash-reporting) can be changed via OneAgent SDK for Mobile as described under Data privacy. The default value is `false`.|
274
+ |actionNamePrivacy |boolean |false |Activates a privacy mode especially for Touchables and Buttons. Setting this option to true means that a name for the control will no longer be shown, e.g. "Touch on Button". When setting a dtActionName onto the component this setting will be ignored.
275
+ |bundleName |string |undefined |Should be used only if you have a multiple bundle setup where you load several .bundle files within your React Native application. Enter the name of your bundle. This should be unique in comparison to your other bundle names. This will ensure that actions coming from different bundles will not interfere with each other.
267
276
 
268
277
  **Attention:**
269
278
  * Keep in mind that configuration within the `dynatrace.config.js` file is the basis, even for manual startup. When we look at the lifecycleUpdate property: Per default if not used, it is false. If enabled (set to true) in `dynatrace.config.js` file, this will be also true if manual startup is used. You can still override this behavior by calling `ConfigurationBuilder.withLifecycleUpdate(false)`.
@@ -275,13 +284,16 @@ A component can be either monitored automatically or manually. The auto instrume
275
284
 
276
285
  * Example with Functional Component:
277
286
 
278
- ```js
287
+ ```ts
288
+ import { Dynatrace } from '@dynatrace/react-native-plugin';
289
+
279
290
  export function MyFunctionalComponent(){
280
291
  ...
281
292
  }
282
293
 
283
294
  Dynatrace.withMonitoring(MyFunctionalComponent, "MyFunctionalComponent");
284
295
  ```
296
+ ![rnFunctionalComp](https://dt-cdn.net/images/rnfunctionalcomp-800-d98eacef6d.png)
285
297
 
286
298
  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).
287
299
 
@@ -293,24 +305,31 @@ There are two options to create an action. Either using `enterAutoAction` (the p
293
305
 
294
306
  * `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.
295
307
 
296
- ```js
297
- let myAction = Dynatrace.enterAutoAction("MyButton tapped");
308
+ ```ts
309
+ import { Dynatrace } from '@dynatrace/react-native-plugin';
310
+
311
+ const myAction = Dynatrace.enterAutoAction("MyButton tapped");
298
312
  //Perform the action and whatever else is needed.
299
313
  myAction.leaveAction();
300
314
  ```
315
+ ![rnSingle](https://dt-cdn.net/images/rnsingle-800-e7e1b343ed.png)
301
316
 
302
317
  * `enterManualAction` - Creates an Action which will NOT be handled by the plugin. This means that you have full control about the hierachy of your actions. This function will create a root action for you, which has the ability to create child actions via `enterAction`. Be aware, because of the full manual approach the plugin will not link webrequest automatically. Webrequest have to be manually tagged by using the tag provided by the action via `getRequestTag`.
303
318
 
304
- ```js
305
- let myAction = Dynatrace.enterManualAction("MyButton tapped");
319
+ ```ts
320
+ import { Dynatrace } from '@dynatrace/react-native-plugin';
321
+
322
+ const myAction = Dynatrace.enterManualAction("MyButton tapped");
306
323
  //Perform the action and whatever else is needed.
307
324
  myAction.leaveAction();
308
325
  ```
309
326
 
310
327
  To create a custom action named `"MyButton tapped"`, use the following code. The *leaveAction* closes the action again. To report values for this action before closing, see [Report Values](#report-values).
311
328
 
312
- ```js
313
- let myAction = Dynatrace.enterAutoAction("MyButton tapped");
329
+ ```ts
330
+ import { Dynatrace } from '@dynatrace/react-native-plugin';
331
+
332
+ const myAction = Dynatrace.enterAutoAction("MyButton tapped");
314
333
  //Perform the action and whatever else is needed.
315
334
  myAction.leaveAction();
316
335
  ```
@@ -319,20 +338,25 @@ myAction.leaveAction();
319
338
 
320
339
  You can create a single custom action as well as sub actions. The `MyButton Sub Action` is automatically put under the `MyButton tapped`. As long as `MyButton tapped` is open, it gathers all the web requests.
321
340
 
322
- ```js
323
- let myAction = Dynatrace.enterManualAction("MyButton tapped");
324
- let mySubAction = myAction.enterAction("MyButton Sub Action");
341
+ ```ts
342
+ import { Dynatrace } from '@dynatrace/react-native-plugin';
343
+
344
+ const myAction = Dynatrace.enterManualAction("MyButton tapped");
345
+ const mySubAction = myAction.enterAction("MyButton Sub Action");
325
346
  //Perform the action and whatever else is needed.
326
347
  mySubAction.leaveAction();
327
348
  myAction.leaveAction();
328
349
  ```
350
+ ![subAction](https://dt-cdn.net/images/subaction-800-172dbcca6c.png)
329
351
 
330
352
  ### Cancel actions
331
353
 
332
354
  Actions can be canceled. That means they will not be sent and discarded fully. This also means that any values and sub actions attached to the action will be removed.
333
355
 
334
- ```js
335
- let myAction = Dynatrace.enterAutoAction("MyButton tapped");
356
+ ```ts
357
+ import { Dynatrace } from '@dynatrace/react-native-plugin';
358
+
359
+ const myAction = Dynatrace.enterAutoAction("MyButton tapped");
336
360
  // Action will be canceled
337
361
  myAction.cancel();
338
362
 
@@ -347,7 +371,9 @@ You can manually tag and time your web requests. With the API shown below, you a
347
371
  **Note:**
348
372
  Using this API will force the request to be added to the action that is manually created.
349
373
 
350
- ```js
374
+ ```ts
375
+ import { Dynatrace, DynatraceWebRequestTiming } from '@dynatrace/react-native-plugin';
376
+
351
377
  let url = 'https://www.dynatrace.com';
352
378
  // You can also use enterAutoAction if desired
353
379
  let action = Dynatrace.enterManualAction("Manual Web Request");
@@ -368,10 +394,13 @@ try {
368
394
  action.leaveAction();
369
395
  }
370
396
  ```
397
+ ![rnManualWeb](https://dt-cdn.net/images/rnmanualweb-800-662d009613.png)
371
398
 
372
399
  There is also the option to report values for request and response size:
373
400
 
374
- ```js
401
+ ```ts
402
+ import { Dynatrace, DynatraceWebRequestTiming } from '@dynatrace/react-native-plugin';
403
+
375
404
  let url = 'https://www.dynatrace.com';
376
405
  // You can also use enterAutoAction if desired
377
406
  let action = Dynatrace.enterManualAction("Manual Web Request");
@@ -380,7 +409,11 @@ let timing = new DynatraceWebRequestTiming(url, tag);
380
409
 
381
410
  try {
382
411
  timing.startWebRequestTiming();
383
- let axiosResponse = await axios.get(url);
412
+ let axiosResponse = await axios.get(url, {
413
+ headers: {
414
+ timing.getRequestTagHeader(): tag
415
+ }
416
+ });
384
417
  timing.stopWebRequestTimingWithSize(axiosResponse.status, axiosResponse.data, 122, 63);
385
418
  } catch (error) {
386
419
  timing.stopWebRequestTiming(-1, error);
@@ -388,6 +421,7 @@ try {
388
421
  action.leaveAction();
389
422
  }
390
423
  ```
424
+ ![rnBytes](https://dt-cdn.net/images/rnbytes-800-139042060c.png)
391
425
 
392
426
  ### Report values
393
427
 
@@ -403,11 +437,14 @@ reportStringValue(valueName: string, value: string, platform?: Platform): void
403
437
 
404
438
  To report a string value, use the following:
405
439
 
406
- ```js
407
- let myAction = Dynatrace.enterAutoAction("MyButton tapped");
440
+ ```ts
441
+ import { Dynatrace } from '@dynatrace/react-native-plugin';
442
+
443
+ const myAction = Dynatrace.enterAutoAction("MyButton tapped");
408
444
  myAction.reportStringValue("ValueName", "ImportantValue");
409
445
  myAction.leaveAction();
410
446
  ```
447
+ ![rnReportString](https://dt-cdn.net/images/rnreportstring-800-739e5ba752.png)
411
448
 
412
449
  If you look at the API calls, you will see the optional parameter `platform?: Platform`. This parameter offers the possibility to report values only for a specific platform. to know more, see [Platform independent reporting](#platform-independent-reporting).
413
450
 
@@ -419,6 +456,7 @@ To manually report an error stacktrace, use the following API call:
419
456
  ```ts
420
457
  reportErrorStacktrace(errorName: string, errorValue: string, reason: string, stacktrace: string, platform?: Platform): void;
421
458
  ```
459
+ ![rnStack](https://dt-cdn.net/images/rnstack-800-26c6ac7408.png)
422
460
 
423
461
  **Note:**
424
462
  The previous API without *errorValue* is deprecated and will be removed in the future. Please use the new API with errorValue if possible.
@@ -427,15 +465,20 @@ The previous API without *errorValue* is deprecated and will be removed in the f
427
465
 
428
466
  You can identify a user and tag the current session with a name by making the following call:
429
467
 
430
- ```js
468
+ ```ts
469
+ import { Dynatrace } from '@dynatrace/react-native-plugin';
470
+
431
471
  Dynatrace.identifyUser("User XY");
432
472
  ```
473
+ ![rnTag](https://dt-cdn.net/images/rntag-800-77fe848023.png)
433
474
 
434
475
  ### End the current user session
435
476
 
436
477
  To end the current user session, use the following API call:
437
478
 
438
- ```js
479
+ ```ts
480
+ import { Dynatrace } from '@dynatrace/react-native-plugin';
481
+
439
482
  Dynatrace.endSession();
440
483
  ```
441
484
 
@@ -449,6 +492,7 @@ You can manually report a crash via the following API call:
449
492
  reportCrash(crashName: string, reason: string, stacktrace: string, platform?: Platform): void;
450
493
  reportCrashWithException(crashName: string, crash: Error, platform?: Platform): void;
451
494
  ```
495
+ ![rnCrash](https://dt-cdn.net/images/rncrash-800-3e7391140f.png)
452
496
 
453
497
  > **Note**: If you use this API call to report a crash manually, it will force the session to be completed. Any new actions that are captured afterwards will be added into a new session.
454
498
 
@@ -480,12 +524,16 @@ applyUserPrivacyOptions(userPrivacyOptions: UserPrivacyOptions, platform?: Platf
480
524
  To check the current privacy options that are set:
481
525
 
482
526
  ```ts
483
- let privacyOptions = await Dynatrace.getUserPrivacyOptions();
527
+ import { Dynatrace } from '@dynatrace/react-native-plugin';
528
+
529
+ const privacyOptions = await Dynatrace.getUserPrivacyOptions();
484
530
  ```
485
531
 
486
532
  If you want to create a new `UserPrivacyOptions` object:
487
533
 
488
534
  ```ts
535
+ import { DataCollectionLevel, UserPrivacyOptions } from '@dynatrace/react-native-plugin';
536
+
489
537
  let privacyConfig = new UserPrivacyOptions(DataCollectionLevel.UserBehavior, true);
490
538
  ```
491
539
 
@@ -506,6 +554,8 @@ let crashReporting = privacyConfig.crashReportingOptedIn;
506
554
  To apply the values that were set on the object:
507
555
 
508
556
  ```ts
557
+ import { Dynatrace } from '@dynatrace/react-native-plugin';
558
+
509
559
  Dynatrace.applyUserPrivacyOptions(privacyConfig);
510
560
  ```
511
561
 
@@ -521,33 +571,41 @@ setGPSLocation(latitude: number, longitude: number, platform?: Platform): void
521
571
 
522
572
  You probably noticed that each method has an additional *optional* parameter named `platform` of type `Platform`. You can use this to only trigger manual instrumentation for a specific OS. The available values are: `Platform.Ios` and `Platform.Android`. Default is that it will work on any platform. Otherwise it is passed *only* to the relevant OS. For example:
523
573
  * Passing to **iOS** only:
524
- ```js
525
- let myAction = Dynatrace.enterAutoAction("MyButton tapped", Platform.Ios);
574
+ ```ts
575
+ import { Dynatrace, Platform } from '@dynatrace/react-native-plugin';
576
+
577
+ const myAction = Dynatrace.enterAutoAction("MyButton tapped", Platform.Ios);
526
578
  //Perform the action and whatever else is needed.
527
579
  myAction.leaveAction("ios");
528
580
  ```
529
581
 
530
582
  * Passing to **Android** only:
531
- ```js
532
- let myAction = Dynatrace.enterAutoAction("MyButton tapped", Platform.Android);
583
+ ```ts
584
+ import { Dynatrace, Platform } from '@dynatrace/react-native-plugin';
585
+
586
+ const myAction = Dynatrace.enterAutoAction("MyButton tapped", Platform.Android);
533
587
  //Perform the action and whatever else is needed.
534
588
  myAction.leaveAction("android");
535
589
  ```
536
590
 
537
591
  * Passing to **both**:
538
- ```js
539
- let myAction = Dynatrace.enterAutoAction("MyButton tapped");
592
+ ```ts
593
+ import { Dynatrace } from '@dynatrace/react-native-plugin';
594
+
595
+ const myAction = Dynatrace.enterAutoAction("MyButton tapped");
540
596
  //Perform the action and whatever else is needed.
541
597
  myAction.leaveAction();
542
598
  ```
543
599
 
544
- ### Business events capturing
600
+ ### Business event capturing
545
601
 
546
602
  With `sendBizEvent`, you can report business events. These events are standalone events, as OneAgent sends them detached from user actions or user sessions.
547
603
 
548
604
  For more information on business events, see [dynatrace documentation](https://www.dynatrace.com/support/help/how-to-use-dynatrace/business-analytics/ba-events-capturing#expand--example-configuration-files-for-rum--2).
549
605
 
550
- ```dart
606
+ ```ts
607
+ import { Dynatrace } from '@dynatrace/react-native-plugin';
608
+
551
609
  Dynatrace.sendBizEvent("com.easytravel.funnel.booking-finished", {
552
610
  "event.name" : "Confirmed Booking",
553
611
  "screen": "booking-confirmation",
@@ -562,6 +620,7 @@ Dynatrace.sendBizEvent("com.easytravel.funnel.booking-finished", {
562
620
  "childrenTravelers": 0
563
621
  });
564
622
  ```
623
+ ![rnBiz](https://dt-cdn.net/images/rnbiz-1262-f57a0a67f3.png)
565
624
 
566
625
  ### Setting beacon headers
567
626
 
@@ -569,7 +628,7 @@ This allows you to put a set of http headers on every agent http request (i.e. A
569
628
 
570
629
  **Note:** To clear the previously set headers, call the method without the headers parameter or with a null value for the headers parameter.
571
630
 
572
- ```js
631
+ ```ts
573
632
  setBeaconHeaders(headers?: Map<string, string> | null, platform?: Platform): void;
574
633
  ```
575
634
 
@@ -577,7 +636,7 @@ setBeaconHeaders(headers?: Map<string, string> | null, platform?: Platform): voi
577
636
 
578
637
  If you want to instrument a functional component or class component but want to exclude a certain button or element, you can do this via the `dtActionIgnore` property. Example:
579
638
 
580
- ```js
639
+ ```ts
581
640
  function TouchableHighlightScreen() {
582
641
  return (
583
642
  <View>
@@ -755,13 +814,15 @@ module.exports = {
755
814
 
756
815
  ### Manual Startup Counterparts
757
816
 
758
- Here is a list of all the counterparts for the options that can be used with a manual startup. Below the counterparts table you will find an example configuration block for both Android and iOS.
817
+ Here is a list of all the counterparts for the options that can be used with a manual startup. Below in the counterparts table you will find an example configuration block for both Android and iOS.
759
818
 
760
819
  | Property Name | Default | Android | iOS | React |
761
820
  |---------------|------|---------|-------------|-------------|
762
821
  |beaconUrl|undefined|autoStart.beaconUrl|DTXBeaconURL| - |
763
822
  |applicationId|undefined|autoStart.applicationId|DTXApplicationId| - |
764
823
  |reportCrash|true|crashReporting|DTXCrashReportingEnabled| - |
824
+ |errorHandler|true| - | - |errorHandler.enabled|
825
+ |reportFatalErrorAsCrash|true| - | - |errorHandler.reportFatalErrorAsCrash|
765
826
  |logLevel|LogLevel.Info|debug.agentLogging|DTXLogLevel| debug |
766
827
  |lifecycleUpdate|false| - | - | lifecycle.includeUpdate |
767
828
  |userOptIn|false|userOptIn|DTXUserOptIn| - |
@@ -816,6 +877,25 @@ react: {
816
877
 
817
878
  This activates the debug mode. You will get more console output during instrumentation and at runtime.
818
879
 
880
+ #### Error Handler
881
+
882
+ ```js
883
+ react: {
884
+ errorHandler: {
885
+ enabled: true,
886
+ reportFatalErrorAsCrash: true,
887
+ },
888
+ }
889
+ ```
890
+
891
+ The `enabled` property activates our Error/Crash handler which will insert our handler into your React Native application. This is true per default.
892
+
893
+ The `reportFatalErrorAsCrash` property should be set to false if you are wanting to report a fatal/unhandled error as an error and NOT a crash. Setting this value to false will keep the current session open.
894
+
895
+ **Note:**
896
+ if `enabled` is set to false, the value of `reportFatalErrorAsCrash` is not be considered/used as our error handler will not be started.
897
+
898
+
819
899
  #### Autostart
820
900
 
821
901
  ```js
@@ -824,7 +904,7 @@ react: {
824
904
  }
825
905
  ```
826
906
 
827
- This activates the AutoStart mode, which will insert an auto start call in your React Native application. This is per default true. If you want to use a manual startup call, please have a look into the [manual startup section](#manual-oneagent-startup).
907
+ This activates the AutoStart mode which will insert an auto start call in your React Native application. This is true per default. If you want to use a manual startup call, please have a look into the [manual startup section](#manual-oneagent-startup).
828
908
 
829
909
  #### Bundle Name
830
910
 
@@ -927,7 +1007,7 @@ The variable ${APPLICATION_ID} must then be inserted with a prebuild script. Mak
927
1007
 
928
1008
  ## User opt-in mode
929
1009
 
930
- Specifies if the user has to opt-in for being monitored. When enabled, you must specify the privacy setting. For more information, see the [API section](#data-collection).
1010
+ Specifies if the user has to opt-in for being monitored. When enabled, you must specify the privacy setting. For more information, see the [API section](#user-privacy-options).
931
1011
 
932
1012
  ### Android
933
1013
 
@@ -1040,6 +1120,19 @@ JavaScript:
1040
1120
 
1041
1121
  *Note:* [actionNamePrivacy](#plugin-startup) has no impact on using dtActionName. dtActionName will always be used.
1042
1122
 
1123
+ ## How does Dynatrace automatically report crashes?
1124
+
1125
+ In general, Dynatrace always closes the session when a crash occurs. Usually a crash is when the application gets fully terminated. In React Native, we also see fatal errors in the JavaScript part as a full crash even though the native application is still alive. When this happens we will end the session. This is due to visibility reasons and may change in the future. The automated crash reporting will be (automatically) put in place by the transformer at the very beginning of the application. Using a custom error handler afterwards will not interfere with our crash handler.
1126
+
1127
+ **Note:** The behavior mentioned below occurs if an error contains a stacktrace or if the stacktrace is empty/missing.
1128
+
1129
+ * Non fatal error: If the internal React Native crash handler shows the error is not fatal, we will report it as error.
1130
+ * Fatal error: If the error is considered as fatal by the React Native crash handler, it will be treated as crash.
1131
+ * Native crashes: If a crash appears solely on the native side and is not noticed by the internal React Native crash handler, it will be reported directly by the Android or iOS agent.
1132
+ * Exception: Some JavaScript crashes will result in Native crashes. Therefore, they are filtered on the native side as normally the crash would be reported twice. On the JavaScript side, these crashes are already reported by us before they hit the native side resulting in no lost information.
1133
+ Additionally, you can use our crash and error reporting APIs which are available with [manual instrumentation](#manual-instrumentation).
1134
+
1135
+
1043
1136
  ## React Automatic Runtime
1044
1137
 
1045
1138
  React introduced with React v17.x, React v16.14.0, React v15.7.0, and React v14.10 the automatic runtime which changes the JSX transformation (https://reactjs.org/blog/2020/09/22/introducing-the-new-jsx-transform.html).
@@ -1308,6 +1401,7 @@ To resolve problems with the plugin, first look at creating logs and identify wh
1308
1401
  ** The android configuration was not added to your project. Please refer to the [install the plugin](#install-the-plugin) section.
1309
1402
  * For Android, if you see an error like "Gradle sync failed: Could not find com.dynatrace.tools.android:gradle-plugin:8.223.1.1003.", please see the [MavenCentral](#mavenCentral) section for an example and more information.
1310
1403
  * When using NodeJS version `15+` and version `2.231.1` of our plugin you could encounter the following error: `npm ERR! Could not resolve dependency: npm ERR! peer react@"^16.0" from @react-native-community/picker@1.8.1`. Using the old deprecrated [Picker dependency](https://www.npmjs.com/package/@react-native-community/picker) was causing peer dependency issues so we updated the auto-instrumentation to use the [new Picker dependency.](https://www.npmjs.com/package/@react-native-picker/picker) If you are still using this `@react-native-community/picker`, you can manually instrument the picker without issue ([create custom actions](#create-custom-actions)).
1404
+ * To disable the error handler when using manual startup, you will need to use/migrate to the `ConfigurationBuilder` instead of the deprecated `ManualStartupConfiguration`. There is no option to disable the crash handler using `ManualStartupConfiguration`.
1311
1405
 
1312
1406
  ## Report a bug or open a support case
1313
1407
 
@@ -1320,6 +1414,15 @@ If you are struggling with a problem, submit a support ticket to Dynatrace (supp
1320
1414
  <br/><br/>
1321
1415
  ## Changelog
1322
1416
 
1417
+ 2.291.1
1418
+ * Update Android (8.291.1.1002) & iOS Agent (8.291.1.1004)
1419
+ * Updated the way we report unhandled errors without a stacktrace
1420
+
1421
+ 2.289.1
1422
+ * Update Android (8.289.2.1007) & iOS Agent (8.289.1.1015)
1423
+ * Added option to disable error handler for auto and manual start
1424
+ * Updated touchable instrumentation for React Native v74
1425
+
1323
1426
  2.287.3
1324
1427
  * Update Android (8.287.1.1006) & iOS Agent (8.287.2.1009)
1325
1428
  * Added request and response size to [manual web request tagging](#manual-web-request-tagging)
@@ -1464,7 +1567,7 @@ If you are struggling with a problem, submit a support ticket to Dynatrace (supp
1464
1567
  * Fixed transformation problems with TSImportType and JSX
1465
1568
  * Updated error handler to report crashes instead of error stacktraces
1466
1569
  * Added [setBeaconHeaders API](#setting-beacon-headers)
1467
- * Added [UserPrivacyOptions API](#data-collection)
1570
+ * Added [UserPrivacyOptions API](#user-privacy-options)
1468
1571
  * Updated DataCollection level enum members to match native agents
1469
1572
 
1470
1573
  1.202.0
@@ -70,7 +70,7 @@ repositories {
70
70
  }
71
71
 
72
72
  dependencies {
73
- implementation 'com.dynatrace.agent:agent-android:8.287.1.1006'
73
+ implementation 'com.dynatrace.agent:agent-android:8.291.1.1002'
74
74
  implementation "com.facebook.react:react-native:${safeExtGet('reactNative', '+')}"
75
75
  }
76
76
 
@@ -161,12 +161,11 @@ public class DynatraceRNBridgeImpl {
161
161
  }
162
162
  }
163
163
 
164
- public void reportCrash(String errorName, String reason, String stacktrace, boolean isRealError, boolean newSession, String platform){
164
+ public void reportCrash(String errorName, String reason, String stacktrace, boolean isRealError, String platform){
165
165
  if (this.shouldWorkOnAndroid(platform)) {
166
166
  Dynatrace.reportCrash(isRealError ? PlatformType.JAVA_SCRIPT : PlatformType.CUSTOM, errorName, reason, stacktrace);
167
- if(newSession){
168
- Dynatrace.createNewSession();
169
- }
167
+ // Generate new session like iOS to make sure the behavior is the same
168
+ Dynatrace.createNewSession();
170
169
  }
171
170
  }
172
171
 
@@ -71,12 +71,12 @@ public class DynatraceRNBridge extends NativeDynatraceBridgeSpec {
71
71
  }
72
72
 
73
73
  @Override
74
- public void reportCrash(String errorName, String reason, String stacktrace, boolean isRealError, boolean newSession, String platform){
75
- this.impl.reportCrash(errorName, reason, stacktrace, isRealError, newSession, platform);
74
+ public void reportCrash(String errorName, String reason, String stacktrace, boolean isRealError, String platform){
75
+ this.impl.reportCrash(errorName, reason, stacktrace, isRealError, platform);
76
76
  }
77
77
 
78
78
  @Override
79
- public void storeCrash(String errorName, String reason, String stacktrace, String platform){
79
+ public void storeCrash(String errorName, String reason, String stacktrace){
80
80
  // Empty on Purpose
81
81
  }
82
82
 
@@ -73,12 +73,12 @@ public class DynatraceRNBridge extends ReactContextBaseJavaModule {
73
73
  }
74
74
 
75
75
  @ReactMethod
76
- public void reportCrash(String errorName, String reason, String stacktrace, boolean isRealError, boolean newSession, String platform){
77
- this.impl.reportCrash(errorName, reason, stacktrace, isRealError, newSession, platform);
76
+ public void reportCrash(String errorName, String reason, String stacktrace, boolean isRealError, String platform){
77
+ this.impl.reportCrash(errorName, reason, stacktrace, isRealError, platform);
78
78
  }
79
79
 
80
80
  @ReactMethod
81
- public void storeCrash(String errorName, String reason, String stacktrace, String platform){
81
+ public void storeCrash(String errorName, String reason, String stacktrace){
82
82
  // Empty on Purpose
83
83
  }
84
84
 
@@ -10,6 +10,20 @@ module.exports = {
10
10
  */
11
11
  debug: true,
12
12
 
13
+ errorHandler: {
14
+ /**
15
+ * Error handler is enabled.
16
+ */
17
+ enabled: true,
18
+
19
+ /**
20
+ * If we catch an unhandled error (fatal) with our error handler, we will report it as a crash
21
+ * when using the default value of true. If the value is set to false, we will report the fatal
22
+ * error as an error and continue the session.
23
+ */
24
+ reportFatalErrorAsCrash: true,
25
+ },
26
+
13
27
  lifecycle: {
14
28
  /**
15
29
  * Decide if you want to see Update Cycles as well
@@ -1,3 +1,3 @@
1
1
  dependencies {
2
- classpath 'com.dynatrace.tools.android:gradle-plugin:8.287.1.1006'
2
+ classpath 'com.dynatrace.tools.android:gradle-plugin:8.291.1.1002'
3
3
  }
@@ -172,22 +172,22 @@ RCT_EXPORT_METHOD(reportError:(NSString *)errorName errorValue:(NSString *)error
172
172
  }
173
173
  }
174
174
 
175
- RCT_EXPORT_METHOD(reportCrash:(NSString *)errorName errorReason:(NSString *)errorReason stacktrace:(NSString *)stacktrace isRealError:(BOOL)isRealError newSession:(BOOL)newSession platform: (NSString *) platform)
175
+ RCT_EXPORT_METHOD(reportCrash:(NSString *)errorName errorReason:(NSString *)errorReason stacktrace:(NSString *)stacktrace isRealError:(BOOL)isRealError platform: (NSString *) platform)
176
176
  {
177
177
  if ([self shouldWorkOnIosWithPlatform: platform])
178
178
  {
179
179
  if(isRealError){
180
- [DTXAction reportExternalCrashForPlatformType:DTXActionPlatformJavaScript crashName:errorName reason:errorReason stacktrace:stacktrace];
180
+ [DTXAction reportExternalCrashForPlatformType:DTXActionPlatformCustom crashName:errorName reason:errorReason stacktrace:stacktrace];
181
181
  }else{
182
182
  [DTXAction reportExternalCrashForPlatformType:DTXActionPlatformCustom crashName:errorName reason:errorReason stacktrace:stacktrace];
183
183
  }
184
184
 
185
- // We ignore the newSession parameter and always end the session as the iOS agent has no troubles with this behavior
185
+ // Always end the session as the iOS agent has no troubles with this behavior
186
186
  [Dynatrace endVisit];
187
187
  }
188
188
  }
189
189
 
190
- RCT_EXPORT_METHOD(storeCrash:(NSString *)crashName reason:(NSString *)reason stacktrace:(NSString *)stacktrace newSession:(BOOL)newSession) {
190
+ RCT_EXPORT_METHOD(storeCrash:(NSString *)crashName reason:(NSString *)reason stacktrace:(NSString *)stacktrace) {
191
191
  NSString* dirPath = [[[[NSFileManager defaultManager] URLsForDirectory:NSApplicationSupportDirectory inDomains:NSUserDomainMask] firstObject] path];
192
192
  dirPath = [dirPath stringByAppendingPathComponent:@"DTXExternalCrashes"];
193
193
  // Create the Application Support/DTXExternalCrashes directory if it does not exist
@@ -202,10 +202,7 @@ RCT_EXPORT_METHOD(storeCrash:(NSString *)crashName reason:(NSString *)reason sta
202
202
  // Store react native crash
203
203
  [[NSFileManager defaultManager] createFileAtPath:[dirPath stringByAppendingPathComponent:@"RNCrash.txt"] contents:[crashJson dataUsingEncoding:NSUTF8StringEncoding] attributes:nil];
204
204
 
205
- // Create a new session if the app is in debug mode or reloadOnFatalError value is set to true where the crash is caught and the app is not forced to shutdown
206
- if (newSession) {
207
- [Dynatrace endVisit];
208
- }
205
+ [Dynatrace endVisit];
209
206
  }
210
207
 
211
208
  RCT_EXPORT_METHOD(reportErrorInAction:(nonnull NSString *)key errorName:(NSString *)errorName errorCode:(nonnull NSNumber *)errorCode platform: (NSString *) platform)