Customize and query mobile app data (React Native)

BETA

If your mobile app is monitored by React Native, you can use any of the standard options to add custom data to New Relic Mobile apps, including session data, custom breadcrumbs, custom interactions, and custom events. You can also customize the data you want to record and query for mobile apps monitored by React Native.

View and use custom data

You can view your data in the New Relic Mobile UI and query your data with NRQL. For example, default and custom data appears in these Mobile UI pages:

React Native events and attributes

In New Relic, attributes are key-value pairs containing information that determines the properties of an event. The specific details can help you gain greater insight into your mobile application.

Except for MobileRequest and MobileRequestError events, you can use the default events for iOS and Android apps monitored by New Relic Mobile with the same data retention. The React Native agent also supports the following attributes, where the event type is MobileJSError and the data source is Mobile.

MobileJSError attributes Description
appBuild

Build number

Type: Static

appId

Cluster agent ID

Type: Static

appVersion

Android: Version name

iOS: NS short bundle version

Type: Static

deviceManufacturer

Set by the agent

Type: Static

deviceModel

Set by the agent

Type: Static

deviceName

Android: Duplicate of deviceManufacturer

iOS: Device

Type: Static

deviceUuid

Android: Randomly generated GUID

iOS: Vendor ID

Type: Static

osMajorVersion

Set by the agent

Type: Static

osName

Set by the agent

Type: Static

osVersion

Set by the agent

Type: Static

platform

Legacy agent used for checking if we are on Unity or other third party platform

Type: Static

platformVersion

The iOS or Android app version

Type: Static

To receive alert notifications about fatal JS errors, create a NRQL baseline condition.

NRQL query examples

Here are some example NRQL queries when using the MobileJSError event and default attributes.

Before creating custom attributes, review New Relic's list of reserved terms used by NRQL and Insights. Otherwise unexpected results may occur.

JS error rate per app version

To get the JS error rate per app version:

SELECT filter(count(*), where eventType() = 'MobileJSError')/filter(count(*), WHERE eventType() = 'MobileSession') as 'JS Error Rate' FROM MobileJSError, MobileSession FACET `appVersion` SINCE 3 days AGO LIMIT 5
Time series view of JS errors

To get a time series view of JS errors:

SELECT filter(count(*), where eventType() = 'MobileJSError') as 'JS error count', filter(count(*), WHERE eventType() = 'MobileSession') as 'MobileSession Count' FROM MobileJSError, MobileSession  SINCE 3 days AGO LIMIT 5 TIMESERIES

For more help

During the public beta, we welcome your questions and comments through the React Native beta discussion board in New Relic's Explorers Hub. Support requests also will be routed there.