New Relic Facet: A Comprehensive Guide to NRQL and More

Author

Reads 1.2K

Woman in focus working on software development remotely on laptop indoors.
Credit: pexels.com, Woman in focus working on software development remotely on laptop indoors.

New Relic Facet is a powerful tool that helps you understand your application's performance. It's a query language called NRQL that allows you to write custom queries to analyze your data.

With NRQL, you can create custom facets to analyze your application's performance. For example, you can use NRQL to find out which transactions are taking the longest to complete.

New Relic Facet also allows you to create custom charts and dashboards to visualize your data. This makes it easier to identify trends and patterns in your application's performance.

By using New Relic Facet, you can get a deeper understanding of your application's performance and make data-driven decisions to improve it.

Setting Up New Relic Facet

To set up a New Relic Facet, you'll need to have a New Relic account and a New Relic license. New Relic offers a free tier, so you can start with that if you're new to the platform.

Credit: youtube.com, Creating Log Parsing Rules in New Relic

A New Relic Facet is a way to break down your application's performance data into smaller, more manageable chunks. This allows you to easily identify and troubleshoot issues.

To create a Facet, you'll need to navigate to the New Relic UI and click on the "Settings" icon. From there, select "Facets" and then click on the "Create Facet" button.

New Relic Facets can be based on a variety of attributes, including user ID, browser type, and location. This allows you to create a Facet that specifically targets the performance issues you're experiencing.

Once you've created a Facet, you can use it to drill down into your application's performance data and identify specific areas for improvement. This can be a huge time-saver and help you get to the root of any issues.

Working with Data

Querying metric data can be complex, so it's essential to understand the two types of metric data: dimensional metrics and metric timeslice data. Dimensional metrics are reported by the Metric API and some of New Relic's solutions, while metric timeslice data is the original metric data type reported by APM, mobile monitoring, and browser monitoring.

Credit: youtube.com, Exploring Your Data Using NRQL

To query dimensional metrics effectively, use the Metric API and follow the guidelines provided. For metric timeslice data, consider the memory protection limits that may prevent large queries from being executed.

If you're dealing with APM errors, keep in mind that the apdex() function only accounts for execution time and doesn't consider APM errors when calculating the Apdex score.

Query Metric Data

Query metric data can be complex, but with the right approach, you can get the insights you need. There are two types of metric data: dimensional metrics and metric timeslice data.

Dimensional metrics are reported by the Metric API and some of our solutions that use that API, such as Dropwizard integration or Micrometer integration. Metric timeslice data, on the other hand, is our original metric data type reported by our APM, mobile monitoring, and browser monitoring.

The Apdex score returned by the apdex() function is based only on execution time, not accounting for APM errors. This means that if a transaction includes an error but completes in Apdex T or less, it will still be rated satisfying.

Credit: youtube.com, Query metrics in New Relic using PromQL

To query metric data effectively, use if() to perform if-then-else control flow operations throughout your query. This will help you navigate complex queries and get the results you need.

Memory protection limits may prevent very large queries from being executed, depending on the data set and query complexity. Be mindful of this when crafting your queries to avoid errors.

Here's a summary of the two types of metric data:

Adding Application-Specific Parameters to Transaction Data

Adding Application-Specific Parameters to Transaction Data can be a challenge when trying to answer specific customer support questions.

The New Relic PHP Agent API provides functions for manipulating data stored in Insights and other New Relic tools.

You can create a function to inject data about the user, such as in a WordPress-based application, which would be inside a plugin.

This function can be easily called at every request, allowing you to pass application-specific parameters to Insights.

The application used as an example in this tutorial is a WordPress-powered e-commerce site, but the instrumentation is straightforward and can be applied to any type of application.

The goal is to drill into a given user's data, which isn't possible with just the default transaction data.

Customization

Credit: youtube.com, Template Variables: Build Dynamic New Relic Dashboards Pt1

Customization is a key feature of New Relic APM, allowing you to tailor its functionality to your specific needs. This is achieved through the use of custom attributes, which can be used to track business-critical data.

New Relic's custom attributes enable you to track data that's relevant to your business, such as user IDs, order IDs, or any other custom data that's important to you. These attributes can then be used to filter and group your data, providing a more accurate picture of your application's performance.

By leveraging custom attributes, you can create custom dashboards that show you exactly what you need to see, when you need to see it. This level of customization helps you stay focused on the most critical aspects of your application's performance.

Optional Clauses

Optional clauses give you even more control over your charts. You can use the AS clause to label attributes, aggregators, or math functions with a string delimited by single quotes.

Turned-on Monitor Displaying Text
Credit: pexels.com, Turned-on Monitor Displaying Text

The label will be used in the resulting chart, making it easy to identify specific data points. Note that AS clause labels won't be displayed in time series charts if you use a FACET clause.

The COMPARE WITH clause is another powerful tool for customization. It allows you to compare values for two different time ranges.

To use COMPARE WITH, you need to specify a time range with SINCE or UNTIL. The time specified by COMPARE WITH is relative to the time specified by SINCE or UNTIL.

For example, comparing yesterday with the day before is as simple as using SINCE 1 day ago COMPARE WITH 1 day ago. The time range for COMPARE WITH is always the same as that specified by SINCE or UNTIL.

Custom Attributes

Custom Attributes are key-value pairs that can be reported with each transaction, allowing you to track specific data points relevant to your business.

This feature is incredibly powerful, and it's what really made Insights shine. By using Custom Attributes, you can gain valuable insights into your business operations, such as the amount of restaurants requested per area, which can be a game-changer for your business.

Credit: youtube.com, CDGC Attributes Customization and Relationships Customization

For example, you can track orders per platform and country in real-time, giving you a much clearer picture of your sales performance than traditional analytics tools like Google Analytics. This level of detail can help you make informed decisions and optimize your business strategy.

Custom Attributes can also help you identify and troubleshoot issues, such as the reason for unsuccessful logins or payment charge-back rates per payment provider. This information can be used to improve the user experience and reduce losses.

Some specific examples of Custom Attributes in action include:

  • Amount of restaurants requested per area
  • Orders per platform and country
  • Reason for unsuccessful logins
  • Payment charge-back rates per payment provider
  • Age of currently processed message
  • Usage of technical fallback

Widgets and Dashboards

Adding widgets to your New Relic dashboard is a great way to visualize important data about your application's performance.

You can start by writing an NRQL query to collect the information you want to see, such as a breakdown of web browsers used by your visitors.

To add a widget, you'll need to drag and drop it onto the dashboard canvas, and then resize it by dragging from the blue triangle in the bottom right corner.

Add First Dashboard Widget

Credit: youtube.com, Dashboards - Adding Widgets

Adding your first dashboard widget is a crucial step in creating a useful dashboard. Start by writing an NRQL query to collect the information you want to display.

Ask yourself what you want to know about the application's performance, such as what web browsers are used by visitors. You can then write a query to collect this information.

To store the query on the dashboard, follow the steps outlined in the previous section. This will save you the trouble of running the query manually each time you want to know its results.

You can resize the widget by dragging from the blue triangle in the box's bottom right corner, or move it around the canvas by dragging and dropping.

Add Customer Support Widget

This query groups the transactions by the signed-in user's email address and counts the ones with errorType set. You'll likely receive an empty list, but that's okay. It's a starting point for your widget.

Give the widget a name and add it to your Overview dashboard. The results will show the number of transactions with errors for each user.

Frequently Asked Questions

What is the New Relic facet?

New Relic's FACET feature allows you to categorize and group data by specific attributes, such as device type, for in-depth analysis and insights. By using FACET, you can gain a clearer understanding of your data and make data-driven decisions.

Tiffany Kozey

Junior Writer

Tiffany Kozey is a versatile writer with a passion for exploring the intersection of technology and everyday life. With a keen eye for detail and a knack for simplifying complex concepts, she has established herself as a go-to expert on topics like Microsoft Cloud Syncing. Her articles have been widely read and appreciated for their clarity, insight, and practical advice.

Love What You Read? Stay Updated!

Join our community for insights, tips, and more.