• Log in

Explore your data using NRQL

15 min

lab

This procedure is part of a lab that teaches you how to monitor your application with New Relic.

Each procedure in the lab builds upon the last, so make sure you've completed the last procedure, instrument your application with our browser agent, before starting this one.

With your app reporting data to New Relic, you want to understand the collected data and get insights into your app. For example, you want to know how many users are active on your site. For that, you explore your data using NRQL, New Relic's query language; gather it; and visualize it in interactive charts.

In this procedure, you explore your data in New Relic. Specifically, you:

  • View your page views
  • Count active sessions
  • View your transactions
  • Count total transactions
  • View your slowest transactions
  • Count your transactions with different response codes

Query your data

Use NRQL to explore and retrieve detailed New Relic data and get insights into your application.

Tip

NRQL is New Relic's SQL-like query language. Read our documentation to know more about what it is and when to use it.

View your pageviews

Step 1 of 3

Navigate to New Relic and sign in with your account. On the top navigation bar, click Query your data.

Arrow pointing to Query your data

This opens an interactive Query builder to explore your data.

Step 2 of 3

Click NRQL to use a custom query.

Arrow pointing to NRQL

Step 3 of 3

Execute the following query to view PageView records for your app.

SELECT * FROM PageView WHERE appName='food-me'

Click Run to see results.

view all your pageviews

Here, you observe all the pageviews for your app.

Count active sessions

Use the following query to count your active sessions.

FROM PageView SELECT count(session) WHERE appName='food-me'

Here, you see the number of active sessions.

count active sessions

View your transactions

Use the following query to view all your transactions.

SELECT * FROM Transaction WHERE appName='food-me'

Here, you see all your transactions for food-me app.

view all your transactions

Count total transactions

Use the following query to count your total transactions.

SELECT count(*) FROM Transaction WHERE appName='food-me'

Here, you see the total number of transactions for your food-me app.

count total transactions

View slowest transactions

Execute the following query to view your slowest transactions.

SELECT max(duration) FROM Transaction Where appName='food-me' FACET name

Here, you see your slowest transactions.

view your slowest transactions

The chart is hard to see in this format. You can choose to present your results in different formats such as table, billboard, or pie chart.

Change the chart type to Pie.

change chart type

Now, you see your slowest transaction in the form of a pie chart.

slowest transactions in pie chart

Count your transactions with different response codes

Use the following query to view all your transactions with different response codes.

SELECT count(*) FROM Transaction WHERE http.statusCode!='200' FACET http.statusCode

transactions with different response codes

You've now seen your application's performance data. Next, you collect custom business data from your application.

lab

This procedure is part of a lab that teaches you how to monitor your application with New Relic. Now that you've explored your application's performance related data, collect custom business data from your application.

Copyright © 2022 New Relic Inc.

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