Query SPA data in Insights

If you are monitoring your single-page application (SPA) with New Relic Browser, you can use see New Relic Insights to query and explore your SPA data. This document includes examples of SPA-related queries.

View sample SPA data

To view a sample of your SPA data in Insights:

  1. Go to insights.newrelic.com > Data Explorer.
  2. Select BrowserInteraction or AjaxRequest.

The Data Explorer will switch to showing information about that event type. The chart will update, and a recent event will appear below.

To see more than one event's details, select See all samples below the chart. This will display up to 50 events.

Query your SPA data

Insights uses New Relic Query Language (NRQL), similar to SQL, to query your data.

  1. Go to insights.newrelic.com > Query.
  2. From the black Query command line, start to type a query.

The Query command line will automatically suggest valid queries as you type.

SPA query examples

Here are some examples of queries you can make of your SPA data. For a complete list of all BrowserInteraction and AjaxRequest attributes, see Browser default attributes for Insights.

Count route changes and page loads

To count the route changes and page loads in the past day:

SELECT count(*) FROM BrowserInteraction since 1 day ago
    
Average duration of route changes and page loads

To find the average duration of route changes and page loads in the past day:

SELECT average(duration) FROM BrowserInteraction since 1 day ago    
    
Slowest route changes

To find the 10 slowest route changes in the past day:

SELECT average(duration) FROM BrowserInteraction WHERE category = 'Route change' since 1 day ago FACET browserInteractionName   

To find the 10 most popular route changes in the last day:

SELECT count(*) FROM BrowserInteraction WHERE category = 'Route change' since 1 day ago FACET browserInteractionName
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:

SELECT count(*) FROM BrowserInteraction since 1 day ago FACET category TIMESERIES 1 hour
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:

SELECT average(duration) FROM BrowserInteraction 1 day ago FACET category TIMESERIES 1 hour
Create table using certain criteria

To create a data table of the average, minimum, and maximum Ajax counts for the 20 slowest route changes:

SELECT average(duration), average(ajaxCount), min(ajaxCount), max(ajaxCount) FROM BrowserInteraction WHERE category = 'Route change' since 1 day ago FACET browserInteractionName LIMIT 20

For more help

For assistance with New Relic Insights, join us in the New Relic Online Technical Community. Ask and answer questions, and learn more about New Relic Insights from fellow Insights users.

If you need additional help, get support at support.newrelic.com.