Your data. Anywhere you go.

New Relic for iOS or Android


Download on the App Store    Android App on Google play


New Relic Insights App for iOS


Download on the App Store


Learn more

Close icon

Fundamentals Certification Tip of the Week, 2 of 5

certification
tipoftheweek

#1

New Relic University’s Fundamentals Certification; ‘Get Certified, Get Socks’.


If you were not directed to this post from the ‘Get Certified, Get Socks’ post, I recommend you take a look at that for some more context before continuing on this thread.

The Fundamentals Certification is difficult, there are a total of over 180 possible questions covering every area of New Relic, you get a random selection of 20 questions for each test you take. It’s impossible to know what will come up in your test, but it’s good to be as prepared as possible. To that end, we are posting weekly Tips of the week, that are geared towards a specific sub-section of the Fundamentals Certification.

The Tip of the Week this week will be aimed at the All Things Insights. With that we will be covering a high level intro to New Relic Insights, we’ll look at some helpful queries. We’ll look at how to get data into Insights.



Intro:

New Relic Insights is the place to go to ask questions of your data. Insights ties in all of your accounts data in one place, query-able with a SQL like language; NRQL - New Relic Query Language.

We’ll start by looking at the basic structure of data in Insights, and the structure of an Insights query.

Understanding the data already in Insights.

To build out effective NRQL queries, and build your dashboards with those queries, it’s really important to understand how Insights lays interprets data, and the options we have in our queries.

Data Structure

Insights data is stored in tables, known as events. An example of that below;

Timestamp Result Duration ID Location
24 Jan 11:18:25 SUCCESS 92 f1284bea-f39c-4337-8653-2f0efc10d873 AWS_US_EAST_2
24 Jan 11:18:23 FAILED 806 2b959f56-31c6-418b-b58e-795d3ef0508e AWS_AP_SOUTHEAST_2
SELECT * FROM SyntheticCheck LIMIT 2

Note - this is a sample of some data from my Synthetics monitors, using the query below;


What we are looking at there is a standard relational table. Each column is known as an attribute, the rows match up to the value of each attribute within the table, which is known as an event

Looking at that data, we can run multiple queries to pick out certain things.

For example;

SELECT count(*) FROM SyntheticCheck WHERE location = 'AWS_US_EAST_2'

This query will return a number, which relates to my account’s total number of synthetics checks run from the specified location.

SELECT percentage(count(*), where result = 'SUCCESS') FROM SyntheticCheck 

This query will give me a percentage of Synthetics monitors that ran successfully.

So as you can see, this is quite similar to SQL

Ok, that covers the way data is laid out in our NRDB (New Relic Database), query-able with NRQL, next we should dig into what options are available to you in your queries.

Query Structure

So far we’ve looked at some simple queries, they are a great place to start when building out any more complex queries.

So; let’s look at the basic requirements:

  • SELECT = REQUIRED = The Select Statement specifies what portion of a data type you want to query.

  • function = Aggregator functions allow you to filter the data your query will return.

  • attribute = Attributes are the columns in your table, see the Data Structure section above.

  • FROM = REQUIRED = this tells Insights which table to look in for your selected attributes.

  • EventType = The table your data lives in. In the examples in the Data Structure section, that EventType, or data table, is SyntheticCheck

  • WHERE = Where allows you to make your query more granular, by adding in your own filters.

  • SINCE = The Since clause is optional. Here you can specify a time period, in different ways. You have the option of DAYS AGO, WEEKS AGO, MONTHS AGO, THIS WEEK, THIS MONTH, THIS QUARTER, THIS YEAR, etc…

    • When SINCE is not specified, the query will default to the last 60 minutes ending now.
  • LIMIT = Limit restricts the number of rows returned in your results set. In our example in the Data Structures section, we have a Limit of 2, this is can be set up to a maximum of 2000. Certain queries will use a default of either 10, or 100, depending on the aggregator function used.

For far more detail than we can squeeze in to a Community Post, check out the NRQL Syntax Docs.

Hopefully now you’ll know what kind of data New Relic can read and have a better idea of how you can query that data. Next up we’ll look into adding in custom data.


Sending data to Insights:

So you know how data is held in Insights, and you know how to query that data, now you want to add in your own data… how do you do it?

It’s a multi-faceted question, and the answer really depends on the type of data you are looking to send.

By default New Relic’s agents and tools send a lot of really useful data. So as a first step, I recommend you review the New Relic Data Dictionary, make sure that the data you need is absolutely not there already.

If it’s not there, and the data you require exists in a place you have New Relic monitoring already (APM, Browser, Synthetics, Mobile, Infrastructure, etc…), we can use those tools to forward data to New Relic, either as a custom event (so a new table of data), or a custom attribute (a new column in an existing table).

You should read the docs on how to send custom data to Insights from within New Relic tooling.

What if the data you need is not available to other New Relic tools?

That’s where the Event API comes in to play. Allowing you to send a JSON payload of your data to our API endpoint, ingesting it into Insights making it fully query-able for you.

The example JSON payload we have is:

[
   {
      "eventType":"Purchase",
      "account":3,
      "amount":259.54
   },
   {
      "eventType":"Purchase",
      "account":5,
      "amount":12309,
      "product":"Super expensive thing"
   }
]

Here we are defining the table the data belongs to: Purchase, and the attributes listed in that table, such as Account, Amount, Product.

Compressing that data & forwarding it to the Insert API endpoint, allows us to then go into Insights, where we can query that data, which returns as:

Query:

SELECT * FROM Purchase 

Dashboards

We’ve got our data in New Relic now, we know how to query it. Awesome! That’s the most important part covered. But then the question comes up on how do we best visualise this data?

Dashboards allow you to keep groupings of your query result charts together.

Below is an example I use when troubleshooting my Synthetics monitor failures;

There I can correlate the percentage failure rates with the slow resources, the domains hit most by my synthetics monitors, etc… further down the dashboard I have detail around monitor failures & what the failure messages are.

Your dashboards can be as unique and specific as you need them to be, targeting the data you need to target, this is just an example. I have linked to some additional dashboards at the bottom of this post.



Consider yourself an Insights Expert yet? If not that’s totally ok! There’s a lot to get the hang of in Insights. But we’re here to help!

There are a number of helpful resources in the Explorers Hub, Docs, and the Learn library.

Check out the below resources;


The final note for this post then, is a recommendation to look at Insights, try some queries, experiment with what’s possible, and take what you learn into 2 things. 1) your dashboards. Build out dashboards that give you and your teams the most useful data. & 2) the NRU Fundamentals Certification. There are plenty of questions in the certification on Insights, and hopefully now you have a better idea of what Insights is, and how to query that data. :smiley:

Get yourself certified to claim your New Relic Socks! :socks:

New Relic University’s Fundamentals Certification; ‘Get Certified, Get Socks’.


New Relic Fundamentals Certification: Get Certified, Get Socks