• EnglishEspañol日本語한국어Português
  • Log inStart now

Mobile crash count and crash rate example (v2)

This describes how to use the New Relic REST API (v2) to get your mobile application's overall and version-specific crash count and crash rate, which appear on the Summary page in the upper right corner.

These examples use the default time period of the last 30 minutes. To obtain crash data for a different time range, add the time period to the commands.

Prerequisites

To use the API in these examples, you need:

  • Your New Relic REST API key
  • Your New Relic mobile monitoring app ID or your mobile monitoring app version ID.

To find the mobile monitoring app ID, see Finding the product ID: mobile monitoring.

To find the mobile monitoring app version ID, see Find the mobile app version ID below.

Mobile app: Get crash data

To obtain crash count and crash rate data for the overall mobile application, use the mobile application ID in the following REST API command:

curl -X GET "https://api.newrelic.com/v2/mobile_applications/${MOBILE_ID}.json" \
-H "X-Api-Key:${API_KEY}" -i

The crash_summary output data contains both the crash_count and crash_rate.

"crash_summary": {
"supports_crash_data": true,
"unresolved_crash_count": 14,
"crash_rate": 28.155339805825243
}

To obtain crash summary data for all the mobile applications in the account, use this REST API command:

curl -X GET "https://api.newrelic.com/v2/mobile_applications.json" \
-H "X-Api-Key:${API_KEY}" -i

Mobile app version: Get crash count data

To obtain the crash count metric data for a specific version of the mobile application, include the mobile application version ID in the following REST API command:

curl -X GET "https://api.newrelic.com/v2/mobile_applications/${MOBILE_APP_VERSION}/metrics/data.json" \
-H "X-Api-Key:${API_KEY}" -i \
-d 'name=Mobile/Crash/All&values[]=call_count&summarize=true'

Mobile app version: Get crash rate data

To calculate a specific version's crash rate, use the following equation:

Crash Rate = (Mobile/Crash/All:call_count) / (Session/Start:call_count)

To get the two metric values needed in the equation, use the following REST API command with the mobile application version ID .

curl -X GET "https://api.newrelic.com/v2/mobile_applications/${MOBILE_APP_VERSION}/metrics/data.json" \
-H "X-Api-Key:${API_KEY}" -i \
-d 'names[]=Mobile/Crash/All&names[]=Session/Start&values[]=call_count&summarize=true'

Find the mobile app version ID

Important

You must provide the version ID only when you want to obtain crash data for a specific version.

To find the version ID of your mobile application, run the following NRQL query:

SELECT count(*) from Mobile where appName='YOUR_APP_NAME' facet appVersionId since 1 day ago
Copyright © 2024 New Relic Inc.

This site is protected by reCAPTCHA and the Google Privacy Policy and Terms of Service apply.