title | tags | metaDescription | redirects | freshnessValidatedDate | ||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
Browser/SPA NRQL query examples |
|
New Relic NRQL: How to run queries of your browser and single-page application (SPA) data reported by Browser. |
|
never |
This document will explain how you can use NRQL to query and explore your Browser data, including SPA data.
To view JavaScript errors, you'd run a NRQL query of the JavaScriptError
event reported by Browser. For example:
SELECT * FROM JavaScriptError
Here's an example of JSON resulting from running this query, which includes JavaScriptError
attributes.
"event": {
"deviceType": "Desktop",
"firstErrorInSession": true,
"releaseIds": "{\"jQuery\":\"v3.1.1\",\"multiverse\":\"98e7ab6\"}",
"appName": "Book Staging Multiverse",
"errorClass": "Error",
"errorMessage": "Script error message",
"requestUri": "/synthetic-multiverse/",
"userAgentName": "Chrome",
"transactionName": "Unnamed Transaction",
"userAgentVersion": "44",
"appId": 950582,
"userAgentOS": "Linux",
"timestamp": 1502262005,
"browserInteractionID": ,
"parentEventId":
}
To run a NRQL query of your Browser SPA data, use the BrowserInteraction
or AjaxRequest
events. For example:
SELECT * FROM BrowserInteraction
Here are some examples of NRQL queries you can make of your SPA data. To see all Browser attributes, see Browser default attributes.
To count the route changes and page loads in the past day:```sql
SELECT count(*) FROM BrowserInteraction
SINCE 1 day ago
```
<Collapser id="avg-duration-route-change" title="Average duration of route changes and page loads"
To find the average duration of route changes and page loads in the past day:
```sql
SELECT average(duration) FROM BrowserInteraction
SINCE 1 day ago
```
<Collapser id="slowest-route-changes" title="Slowest route changes"
To find the 10 slowest route changes in the past day:
```sql
SELECT average(duration) FROM BrowserInteraction
WHERE category = 'Route change'
SINCE 1 day ago FACET browserInteractionName
```
<Collapser id="most-popular-route-changes" title="Most popular route changes"
To find the ten most popular route changes in the last day:
```sql
SELECT count(*) FROM BrowserInteraction
WHERE category = 'Route change'
SINCE 1 day ago FACET browserInteractionName
```
<Collapser id="compare-throughput" title="Compare page load and route change throughput"
To compare the throughput between page loads and route changes in the last day, at 1-hour increments:
```sql
SELECT count(*) FROM BrowserInteraction SINCE 1 day ago FACET category TIMESERIES 1 hour
```
<Collapser id="compare-performance" title="Compare page load and route change performance"
To compare the performance of page loads and route changes in the last day, at 1-hour increments:
```sql
SELECT average(duration) FROM BrowserInteraction
SINCE 1 day ago FACET category TIMESERIES 1 hour
```
<Collapser id="create-table" title="Create table using certain criteria"
To create a data table of the average, minimum, and maximum Ajax counts for the 20 slowest route changes:
```sql
SELECT average(duration), average(ajaxCount), min(ajaxCount), max(ajaxCount)
FROM BrowserInteraction WHERE category = 'Route change' SINCE 1 day ago
FACET browserInteractionName LIMIT 20
```