5
Checklist New Relic Insights Best Practices Guide Tips and Tricks for Unlocking the Full Power of Event Data As software systems grow more complex, the teams building the next generation of websites, apps, and services need tools that can provide end- to-end visibility across the entire stack. New Relic provides these tools—offering the features (such as sub-second query responses on real-time data, dashboards with powerful charting, and flexible alerts) that are essential to building great products. Bundled into all New Relic solutions, Insights enables users to unlock the full power of the un-aggregated, highly dimensional event data collected by New Relic agents. By applying the tips and best practices detailed here, you can use New Relic Insights to build better performance into your systems with every release. Explore your data The data explorer feature within Insights offers rich, full-text search across thousands of metrics and events collected by New Relic agents on your applications and hosts. Use it to explore and chart not just standard New Relic metric and event data but also any custom metrics you’ve added via the Metric and Event Data tabs within the data explorer. (For example, if you were to use custom metrics to track messages sent and received on a Kafka queue, you could easily find and add those metrics to a dashboard alongside error rate or throughput trends.) From within metric explorer, you can change the scope of metrics using wildcards, facet your metrics by application host, and expose an API call for the metric via a single click. HOW TO DO IT (EVENT EXPLORER) 1. Go to insights.newrelic.com and select Data explorer > Events. 2. Select an Event type to explore. 3. Review the attribute names and values shown for the events matching your view. 4. Select attributes to group by and plot. (Note that the top of the page shows you the New Relic Query Language [NRQL] query for your chosen state; to use other visualizations or add the chart to a dashboard, click Run.) · On the NRQL-generated query, click Run. · Configure the chart options as needed. · To add individual charts to a dashboard: Give the chart a meaningful title to identify it in a dashboard. Select Add to a dashboard. HOW TO DO IT (METRIC EXPLORER) 1. Go to insights.newrelic.com and select Data explorer > Metrics. 1 2. Select the entity or application your metrics report under. (To select a metric for your chart, browse the top metrics or search for a metric name.) 3. View metric charts as you select them. 4. Configure the chart options. 5. Optional: To visit API Explorer (which is preset to the selected metric and time range), select Explore API. 6. To add individual charts to a dashboard, select Add to dashboard. 7. Give each chart a meaningful title to identify it on the target dashboard. Figure 1. Data explorer example. Try out NRQL queries Once you’ve explored some of the taxonomy of your data via data explorer, it’s time to start asking some direct questions of your data. You can do this via NRQL—a query language for making calls against the Insights event database. If you know SQL, you know NRQL. And if you don’t know SQL, no worries: We’ll use example queries to get you up and running quickly. 2

New Relic Insights Best Practices Guide · 2020-07-01 · New Relic Insights Best Practices Guide: Tips and Tricks for Unlocking the Full Power of Event Data 3 At its core, NRQL enables

  • Upload
    others

  • View
    11

  • Download
    0

Embed Size (px)

Citation preview

Page 1: New Relic Insights Best Practices Guide · 2020-07-01 · New Relic Insights Best Practices Guide: Tips and Tricks for Unlocking the Full Power of Event Data 3 At its core, NRQL enables

Checklist

New Relic Insights Best Practices GuideTips and Tricks for Unlocking the Full Power of Event Data

As software systems grow more complex, the teams building the next generation of websites, apps, and services need tools that can provide end-

to-end visibility across the entire stack. New Relic provides these tools—offering the features (such as sub-second query responses on real-time data,

dashboards with powerful charting, and flexible alerts) that are essential to building great products.

Bundled into all New Relic solutions, Insights enables users to unlock the full power of the un-aggregated, highly dimensional event data collected

by New Relic agents. By applying the tips and best practices detailed here, you can use New Relic Insights to build better performance into your

systems with every release.

Explore your data The data explorer feature within Insights offers rich, full-text search

across thousands of metrics and events collected by New Relic

agents on your applications and hosts. Use it to explore and chart

not just standard New Relic metric and event data but also any

custom metrics you’ve added via the Metric and Event Data tabs

within the data explorer. (For example, if you were to use custom

metrics to track messages sent and received on a Kafka queue, you

could easily find and add those metrics to a dashboard alongside

error rate or throughput trends.) From within metric explorer, you

can change the scope of metrics using wildcards, facet your

metrics by application host, and expose an API call for the metric

via a single click.

HOW TO DO IT (EVENT EXPLORER)

1. Go to insights.newrelic.com and select Data explorer > Events.

2. Select an Event type to explore.

3. Review the attribute names and values shown for the events matching your view.

4. Select attributes to group by and plot. (Note that the top of the page shows you the New Relic Query Language [NRQL] query for your chosen state; to use other visualizations or add the chart to a dashboard, click Run.)

· On the NRQL-generated query, click Run.

· Configure the chart options as needed.

· To add individual charts to a dashboard:

– Give the chart a meaningful title to identify it in a dashboard.

– Select Add to a dashboard.

HOW TO DO IT (METRIC EXPLORER)

1. Go to insights.newrelic.com and select Data explorer > Metrics.

1 2. Select the entity or application your metrics report under. (To select a metric for your chart, browse the top metrics or search for a metric name.)

3. View metric charts as you select them.

4. Configure the chart options.

5. Optional: To visit API Explorer (which is preset to the selected metric and time range), select Explore API.

6. To add individual charts to a dashboard, select Add to dashboard.

7. Give each chart a meaningful title to identify it on the target dashboard.

Figure 1. Data explorer example.

Try out NRQL queriesOnce you’ve explored some of the taxonomy of your data via data

explorer, it’s time to start asking some direct questions of your

data. You can do this via NRQL—a query language for making calls

against the Insights event database. If you know SQL, you know

NRQL. And if you don’t know SQL, no worries: We’ll use example

queries to get you up and running quickly.

2

Page 2: New Relic Insights Best Practices Guide · 2020-07-01 · New Relic Insights Best Practices Guide: Tips and Tricks for Unlocking the Full Power of Event Data 3 At its core, NRQL enables

New Relic Insights Best Practices Guide: Tips and Tricks for Unlocking the Full Power of Event Data

3

At its core, NRQL enables you to query data collected from your

application and transform it into dynamic charts. You can then

use that data to better understand how your application is used.

For example, during incident response, you can test multiple

hypotheses by asking and answering multiple questions in rapid

succession—down to the individual user or end point (thanks to the

un-aggregated, highly dimensional nature of New Relic event data).

HOW TO DO IT

• Use the command-line query tool that appears at the top of your dashboards and on the Query History page to build com-mands with SQL-style syntax. As you type, the auto-completion feature suggests attributes and flags syntax errors with a red underline. (For more information about NRQL syntax, see NRQL reference or read the introduction to NRQL).

• Here are some example NRQL queries to show you the art of the possible.

· Out-of-the-box performance:

– What is the distribution of response times for my app?

a. SELECT histogram(duration, width: 2,

buckets: 20) FROM Transaction WHERE

appName = ‘insert app name here’ SINCE

1 day ago

– What percent of time is spent in the application processing the request (outside of database processing)?

a. SELECT (1-(average(duration)-average

(databaseDuration))/average(duration))*100

AS ‘% of time in DB’ FROM Transaction

FACET name WHERE appName = ‘insert app

name here’

· Lightweight custom instrumentation to drill down to an individual user:

a. SELECT count(*) FROM MobileCrash WHERE

`authentication_email` = ‘exampleuser@

newrelic.com’

b. Authentication_email is a custom

attribute that’s been added to the

default MobileCrash event type with a

single line of code. (Find out more here.)

See more examples:

· Try out the tutorials on your Insights homepage.

· If you’re using the New Relic Mobile agent, try out these examples.

· Note that NRQL allows you to query your event data, not your metric data. You can chart metric data in Insights,

and many of the signals contained within the metric data have the same signal inside event data.

Figure 2. NRQL query bar.

Pin charts from other New Relic products Now that you’ve explored your data and asked some questions,

it’s time to learn how Insights can be integrated with charts from

other New Relic products. Using the add-to-Insights feature, you

can pin any New Relic chart to an Insights dashboard.

HOW TO DO IT

1. Mouse over the chart.

2. Click the Add to an Insights Dashboard button.

3. From the “Copy chart” dialog box:

· Select Copy to an existing dashboard (default) or Copy to a new dashboard.

· Edit the chart name as needed (maximum length: 255 characters).

· Click Copy. (Note: You can switch accounts from this dialog box to copy to different dashboards across accounts. You can also click the dashboard name in the green success bar to go the dashboard to which you added the chart.)

Figure 3. Copy chart dialog box.

Page 3: New Relic Insights Best Practices Guide · 2020-07-01 · New Relic Insights Best Practices Guide: Tips and Tricks for Unlocking the Full Power of Event Data 3 At its core, NRQL enables

New Relic Insights Best Practices Guide: Tips and Tricks for Unlocking the Full Power of Event Data

Create dashboard notes To make your dashboard more usable across your entire organi-

zation, use the dashboard notes feature to add context to any

dashboard. Have a chart you’d like to describe for others? Have

important links that go hand-in-hand with the dashboard (for

example a runbook)? Dashboard Notes allows you to add arbi-

trary text and images to your dashboard.

Add notes to dashboards to record or share custom information

about the dashboard. Because these notes use markdown syntax, it

is easy to add elements such as headings, images, links, and so on.

HOW TO DO IT

· At the top of the dashboard, select Add Dashboard Note.

Figure 4. Use the Add Dashboard Note button in the upper-right section of the Insights toolbar to add dashboard notes.

Designate dashboards as favoritesGet fast access to key dashboards by designating them as favorites.

HOW TO DO IT:

· To make a dashboard a favorite, click the star icon. (Favorite dashboards appear at the top of the dashboards list.)

· To remove a dashboard from your favorites, click the star icon again.

Figure 5. Assign a dashboard “favorite” status by clicking the Star icon on the top right corner of a dashboard in the All Dashboards section of Insights.

Apply a filter to a dashboard Insights event data makes it fast to drill down into specifics. All you

have to do to change the data presented is input text into a search

box. For example, anyone can visit a dashboard and input a user’s

email address to access data un-aggregated for that user.

HOW TO DO IT:

1. On the dashboard, select Edit.

2. Then select Filter disabled or click the blue gear icon.

3. Select Enable filter.

4. From the Event types drop-down menu, select one or more Event types.

5. From the Select attribute drop-down menu, select one or more attributes to restrict filtering to specific attributes.

6. Select Filter enabled or click the blue gear icon again to close the Filter menu.

7. To save your changes to the dashboard, select Done editing.

Figure 6. Drill down to important data facets with ease by going to insights.newrelic.com > (selected dashboard) > Edit: Enable filtering on a dashboard.

Build a data app Do you want to present a bunch of dashboards as a whole?

Are you thinking about sharing information beyond your DevOps

teams? Data apps can help you do so.

Designed to let users create self-service analytics reports that

even non-technical users can employ to answer questions about

performance, customers, feature usage, and more, data apps let

business users click through preset drill-downs and modify their

filters in real time via basic searches. As collections of linked

dashboards that create curated, application-like experiences, data

apps work on any attributes available in Insights.

HOW TO DO IT:

1. Go to insights.newrelic.com > Data apps > Create a data app.

2. Specify an Icon, Title, URL, Description, and Permissions for your app.

3. Select Create to save your new data app.

4. After creating your data app, Insights automatically redirects you to a new dashboard. You can add widgets to this dashboard using standard NRQL queries.

5. You can also create additional dashboards by selecting + Add from the data app navigation bar, or by copying an existing dashboard into your data app:

· From your data app dashboard, select Edit, then select Configure data app.

· From the Copy dropdown menu, choose a dashboard. (Dashboard copies are independent of the original dash-board—meaning changes to the original dashboard do not affect the copy, and editing or deleting the copied dashboard does not affect the original.)

4

5

6

7

Page 4: New Relic Insights Best Practices Guide · 2020-07-01 · New Relic Insights Best Practices Guide: Tips and Tricks for Unlocking the Full Power of Event Data 3 At its core, NRQL enables

New Relic Insights Best Practices Guide: Tips and Tricks for Unlocking the Full Power of Event Data

Figure 7. Data app example.

Link facets across dashboards within a data appFACET linking is a powerful way to build dashboards to tell a deep

story around specific filters. For example, you can use the FACET

clause in NRQL to break out your data by any string attribute. Use

the LIMIT clause to specify how many facets appear (the default

is 10). For more complex grouping, use FACET CASES.

Figure 9 shows how you can “facet” by company name, and sort

by the most active free trials. The NRQL would look something like

this: SELECT count(*) FROM PageView FACET company.

By using FACET linking, a user can jump to details of an indi-

vidual company on a prebuilt dashboard showing specifics for

that company.

HOW TO DO IT:

1. Go to insights.newrelic.com > Data apps > (select a data app).

2. Select the dashboard containing the widget you want to link from; then select Edit.

3. From the widget you want to link, select the link insights widget link icon.png icon.

4. Select the target dashboard from the list.

Figure 8. FACET linking allows you to connect multiple dashboards and filter the linked dashboard to show only relevant metrics.

Add a custom attribute and/or event via a New Relic agentAll New Relic agents report default event data right out of the

box. For example, each time a Mobile event occurs, more than 35

attributes are added, providing a wealth of ways to slice and dice

your data. This allows you to troubleshoot faster, understand better,

and focus on creating value rather than putting out fires.

Eventually, however, you will probably want to add custom attri-

butes to your event data—for example, a unique user id attribute

that will let you see performance data on an individual user. With

just a few lines of code, you can add custom attributes to your

event data to enhance your ability to dashboard and filter your

data along with other methods depending on the language.

Since the approach you use will be specific to the agent you’re

employing, we’ve provided a couple of examples below. Please

view the New Relic docs for specifics on the agent you’re using.

HOW TO DO IT (FOR JAVA VIA AGENT API; YOU CAN ALSO USE AN XML APPROACH)

1. To collect custom attributes via API, call the relevant methods.

2. For each method you want to record an attribute, call addCustomParameter.

3. Optional: Include or exclude certain attributes with attributes.include and attributes.exclude. For example, to record a variable named userId, include the following code in the

parent method: NewRelic.addCustomParameter(“user-

Id”, userId).

HOW TO DO IT (FOR AGENT API VIA JAVA APM AGENT)

1. Custom event collection is enabled by default in Java agent version 3.13.0 or higher. To send custom events, simply call the relevant API. For example:

· Map<String, Object> eventAttributes = new

HashMap<String, Object>();NewRelic.getA-

gent().getInsights().recordCustomEvent(‘My-

CustomEvent’, eventAttributes);

2. In the above example, the first argument defines the name of your event type, and the second argument is a map with the attributes for your custom event.

3. Ensure you limit the number of unique event type names you create, and do not generate these names dynamically. For restrictions on event type names, see Limits and restricted characters and Reserved words.

4. You can change the maximum number of events recorded by the Java agent via a configuration parameter in newrelic.yml:

Simply add custom_insights_events.max_samples_

stored: to your configuration file.

8

9

Page 5: New Relic Insights Best Practices Guide · 2020-07-01 · New Relic Insights Best Practices Guide: Tips and Tricks for Unlocking the Full Power of Event Data 3 At its core, NRQL enables

New Relic Insights Best Practices Guide: Tips and Tricks for Unlocking the Full Power of Event Data

© Copyright 2017, New Relic, Inc. All rights reserved. All trademarks, trade names, service marks and logos referenced herein belong to their respective companies. 11.2017

5. Specify the maximum number of events to record per minute as an integer. For example, if you want to send less than the

default of 10,000 events, use the following: custom_in-

sights_events.max_samples_stored: 5000

6. To disable custom events, add custom_insights_events.

enabled: false to newrelic.yml.

Add a custom event Insights end point You can also enhance the information you report about you appli-

cations and systems by creating a custom event—via either a New

Relic agent API or the Insights API. If you chose the latter, you can

send information from your system without adding a New Relic

agent to it. You get all the benefits of our agent’s deep instrumen-

tation in other parts of your stack in places where we don’t have

an agent or you don’t want to add one. Keep in mind that Insights

only supports event insertion via POST. Follow the instructions

to insert an event into your New Relic Insights account.

HOW TO DO IT:

1. Go to the Manage Data section of Insights.

2. Click the API Keys tab.

3. Register an Insights API Insert key.

4. Generate JSON for the event by instrumenting your application, querying an API, or some other method.

5. Submit the JSON to the Insights HTTPS end point using cURL in a POST request. (More info)

Want more user tips? · Obtain an introduction to Insights at New Relic University.

· Read the Documentation.

· Visit the New Relic Insights Community Forum.

Be sure to check out New Relic API Explorer By taking advantage of New Relic API Explorer (available at https://

api.newrelic.com), Admin users and those with the API Key can:

· Browse available API end points.

· Interact with the API within a user interface (the API Explorer).

· View a live source of documentation.

· Obtain cURL commands for API actions.

· Share configured API calls with colleagues by copy and pasting API Explorer URLs.

10