There are several ways to query your data. This document will show you some example NRQL queries from mobile monitoring data. To see descriptions of the mobile-reported events and attributes available, see Mobile events.
Mobile, MobileSession, and MobileCrash event query examples
Mobile queries allow you to understand and compare a wide variety of mobile data, including interactions, location, device profile, app version, crashes, and performance.
These examples use queries made on the Mobile, MobileSession, and MobileCrash event types:
SELECT uniqueCount(uuid) FROM Mobile SINCE 1 day ago FACET name
SELECT uniqueCount(uuid) FROM MobileSession WHERE countryCode='CN' FACET regionCode SINCE 7 days ago
SELECT uniqueCount(uuid) FROM MobileSession FACET osVersion SINCE 7 days ago
SELECT percentile(sessionDuration, 90) FROM MobileSession since 1 day ago compare with 2 days ago
SELECT histogram(memUsageMb) FROM MobileSession WHERE sessionDuration > 5
SELECT count(*) FROM MobileCrash FACET crashException
SELECT percentage(uniqueCount(sessionId), WHERE category = 'Crash') as `Crash rate` FROM MobileSession, MobileCrash facet appVersion since 90 days ago
MobileRequest event query examples
This feature requires mobile monitoring agent version 5.14.0 or higher. MobileRequest data is enabled by default for:
For earlier versions, starting with Android version 5.14.0 or iOS version 5.14.0, you must enable the feature. Upgrade to the latest Android or iOS version, or add the required feature flag to your app.
Below are some NRQL queries that address common use cases. Use the MobileRequest attributes to make your own NRQL queries. The last two examples use MobileRequestError events in addition to MobileRequest to get an error rate.
Which domains are prone to failure and error?
SELECT percentage(count(*), where errorType = 'NetworkFailure' OR errorType = 'HTTPError') as 'Error Rate %', count(*) as '# of Requests', filter(count(*), where errorType='NetworkFailure' OR errorType='HTTPError' as '# of Errors') FROM MobileRequestError, MobileRequest facet requestDomain
What is the error rate seen by our mobile apps for the most business-critical API?
SELECT percentage(count(*), where errorType = 'NetworkFailure' OR errorType = 'HTTPError') as 'Error Rate %', count(*) as '# of Requests', filter(count(*), where errorType='NetworkFailure' OR errorType='HTTPError' as '# of Errors') FROM MobileRequestError, MobileRequest facet requestPath where requestPath = '{MY_API_PATH}'
For important requests in the 90th percentile, what is the response time by URL?
SELECT percentile(responseTime, 90), latest(requestUrl) as 'Latest URL' from MobileRequest facet cases(where requestUrl like '%{YOUR_CORE_API}%' as 'Core API', where requestUrl like '%{YOUR_FEATURE_API}%' as 'New Feature API')
How much network traffic from the apps are backend services receiving?
SELECT count(*) FROM MobileRequest FACET requestDomain since 3 days ago
What % of users are impacted by http response times greater than 3 seconds?
SELECT filter(uniqueCount(MobileRequest.uuid), WHERE responseTime > 3) / uniqueCount(MobileSession.uuid) * 100 as '% Users Impacted' FROM MobileRequest, MobileSession since 1 day ago timeseries compare with 2 days ago
What is the distribution of response time and request count across domain, country, carrier, or ASN owner?
SELECT histogram(responseTime, 20, 20) FROM MobileRequest since 3 days ago facet asnOwner
What is the breakdown of response time by different percentiles?
SELECT percentile(responseTime, 98) as '98 percentile (sec)', percentile(responseTime, 90) as '90 percentile (sec)', percentile(responseTime, 50) as '50 percentile (sec)' from MobileRequest since 3 days ago
How do requests per session compare across different apps or subsequent builds of those apps?
SELECT count(*)/uniqueCount(sessionId) from MobileRequest, MobileSession facet appName timeseries
MobileRequestError event query examples
Below are some NRQL queries that address common use cases. Use the MobileRequestError attributes to make your own NRQL queries.
Which queries are causing the most errors?
SELECT count(*) FROM MobileRequestError where errorType = 'HTTPError' FACET requestUrl
What network failures are most common for my application?
SELECT count(*) FROM MobileRequestError where errorType = 'NetworkFailure' facet networkError
Which domains are prone to failure and error?
SELECT percentage(count(*), where errorType = 'NetworkFailure' OR errorType = 'HTTPError') as 'Error Rate %', count(*) as '# of Requests', filter(count(*), where errorType='NetworkFailure' OR errorType='HTTPError' as '# of Errors') FROM MobileRequestError, MobileRequest facet requestDomain
What is the error rate in our mobile apps for the most business-critical API?
SELECT percentage(count(*), where errorType = 'NetworkFailure' OR errorType = 'HTTPError') as 'Error Rate %', count(*) as '# of Requests', filter(count(*), where errorType='NetworkFailure' OR errorType='HTTPError' as '# of Errors') FROM MobileRequestError, MobileRequest facet requestPath where requestPath = '{MY_API_PATH}'
How many users are experiencing errors as compared to my total user count?
SELECT filter(uniqueCount(MobileRequestError.uuid), WHERE errorType = 'HTTPError') / uniqueCount(MobileSession.uuid) * 100 as '% Users Impacted by Errors' FROM MobileRequestError, MobileSession COMPARE WITH 7 days AGO
Which version(s) of my app are causing the most errors?
SELECT count(*) FROM MobileRequestError FACET appVersion
Which unique devices (by UUID) are having the most issues with my application?
SELECT count(*), latest(device), latest(carrier), latest(asnOwner), latest(countryCode) FROM MobileRequestError FACET deviceUuid limit 100 SINCE 1 days ago
What does my historical HTTP Error count look like (by domain)?
SELECT count(*) FROM MobileRequestError where errorType = 'HTTPError' FACET requestDomain timeseries