Plugins 〉New Relic

Data Source
grafana
Enterprise

New Relic

  • Overview
  • Installation
  • Change log
  • Related content

New Relic data source for Grafana

The New Relic data source plugin allows you to query and visualize New Relic APM (Application Performance Monitoring) and Insights from within Grafana.

Requirements

The New Relic data source has the following requirements:

Known limitations

  • Ad-hoc filters are not currently supported.
  • NRQL queries with multiple FACET fields are not supported.
  • NRQL queries with COMPARE WITH operator are not supported.
  • Currently only APM (Application Performance Monitoring) and Insights are supported.

Install the New Relic data source plugin

To install the data source, refer to Installation.

Get an API key and account ID from New Relic

You will need your personal API key/user API key, refer to New Relic API Key. You will also need your account ID from New Relic, refer to Account ID.

Configure the data source in Grafana

Add a data source by filling in the following fields:

Field namesDescriptions
NameEnter a name for this particular New Relic data source.
Personal API Key / User API keyTo find your New Relic API key, refer to Get an API key and account ID from New Relic.Enter a name for this particular New Relic data source.
Account IDEnter your New Relic Account ID. To find your New Relic Account ID, refer to Get an API key and account ID from New Relic.
RegionEnter your region hosting your service.

Configure the data source with provisioning

Data sources can be configured with Grafana's provisioning system. You can read more about how it works and all the settings you can set for data sources on Provisioning Grafana.

Here is an example for provisioning this data source

apiVersion: 1

datasources:

  • name: NewRelic type: grafana-newrelic-datasource access: proxy editable: true enabled: true secureJsonData: accountId: 1111111 personalApiKey: Personal API Key version: 1

Query the data source

The service can be Metrics, Data Explorer or NRQL Editor. To learn more about NRQL Editor/Insights, refer to Insights.

Metrics

If you do not find an option in these dropdown boxes you can still select the option by selecting Create: (your text).

Field namesDescriptions
SourceSelect the source type either Application or Plugins and then start typing in the dropdown box to find your source.
MetricSelect the metric namespace you wish to view from the expanding lists.
ValueEnter the metric value you want returned.
Alias ByYou can combine plain text with the following variables: $__nr_metric is the metric name e.g. CPU/User time. $__nr_metric_value is the metric value e.g. average_value.

Data Explorer - BETA

Data explorer allows you to query New Relic Insights data without writing raw NRQL.

Once you switch to Data Explorer mode, the query editor will be pre-configured with a default query. You can make your own data explorer query by customizing the following fields:

Field namesDescriptions
FromUse this field to specify the data type you wish to query. If this field is updated, the remaining part of the query will be reset to default.
SelectYou can specify one or more aggregation. in the SELECT section. This can be also used to perform arithmetic operation over two aggregated fields. Optionally, Each item in the SELECT can be filtered using NRQL FILTER queries.
Where(optional) Specify the raw condition of NRQL filter. Example appName = 'something' AND serverName in ('server1','server2') AND city in (${cities:singlequote}). This field accepts grafana variables.
Facet(optional) Use this field to separate and group your results by attribute values. Use FACET BY CASES to break out your data by more complex conditions than possible with FACET
Time Filter(optional) Configure this field to filter the data based on time range. Select Dashboard time to filter the data based on Grafana's selected time range. By default, Grafana's time range is used.
FormatThis can be one of TimeSeries or Table. The default is TimeSeries. If TimeSeries is chosen, then the TIMESERIES keyword is added to the query and your data will be in time series format broken out by a specified period of time. If the Table is chosen, then data will not be aggregated by time. Use Table mode, in case if you want a summary.
Interval(optional) When selecting the timeseries format above, you can optionally configure the interval of your time series aggregation.
Slide By(optional) When selecting timeseries format and custom interval, optionally use slide by field to specify the sliding time window range.

You can preview the NRQL query based on your options in the Preview section. If you want to further customize the query, you can switch to the raw NRQL editor by clicking Switch to NRQL Editor.

Read more about NRQL syntax in the New Relic documentation page.

NRQL editor (Insights)

For a New Relic Query Language intro, refer to Introduction to NRQL.

Code completion will be displayed once typing begins. To select a completion option, highlight the desired option with the arrow keys and press Tab to select.

The editor supports the time filter NRQL macro. This will use your Grafana dashboard's time range in the query by interpolating $__timeFilter to SINCE <from> UNTIL <to> .

Example:

SELECT average(value) FROM $event_template_variable $__timeFilter TIMESERIES

Synthetics Queries

New Relic Synthetics data can be queried from the SyntheticCheck and SyntheticRequest tables using NRQL Editor/Insights.

For example, the query below returns the count of all requests by response status.

SELECT count(*) FROM SyntheticRequest FACET responseStatus $__timeFilter

The query below returns the success rate of all the monitors.

SELECT (
    filter(count(*),WHERE result = 'SUCCESS')
    / filter(count(*), WHERE result IN ('SUCCESS','FAILED'))
    * 100
) as 'Success Rate' FROM SyntheticCheck
FACET monitorName $__timeFilter TIMESERIES

For more details about the Synthetic monitoring querying, refer to Events reported by synthetic monitoring

Templates and variables

To add a new New Relic query variable, refer to Add a query variable. Use your New Relic data source as your data source for the following available queries.

EndpointsDescription
applicationsList of available application ids
applicationNamesList of available applications names
applications/{application_id}/metricsList of available metrics for an application
componentsList of available components
components/{component_id}/metricsList of available metrics for a component

New Relic query can return relative endpoints (excluding file extensions). For more information, refer to New Relic REST API

After creating a variable you can use it in your New Relic queries by using variable syntax. For more information refer to Variable syntax. For more information about variables, refer to Templates and variables.

Import a dashboard for New Relic

Follow these instructions for importing a dashboard.

Imported dashboards can be found in Configuration > Data Sources > select your New Relic data source > select the Dashboards tab to see available pre-made dashboards.

Get the most out of the plugin

For more information, visit the docs on plugin installation.

Change Log

[2.2.4] - 2021-11-03

  • For insights queries that have already been written, do not overwrite those queries with the default query.
  • Fixed an migration issue where application variable filter is not migrated from v1

[2.2.3] - 2021-09-28

  • Allow filter by application name when performing application id list variable query.

[2.2.2] - 2021-09-06

  • Application Names variable query

[2.2.1] - 2021-08-09

  • Template variables not migrated properly from v1.4
  • Queries not migrated properly from v1.4

[2.2.0] - 2021-07-12

  • Beta: Data Explorer feature. This allows you to query any New Relic data without writing NRQL.
  • BREAKING: Removed client side query caching in favour of Grafana 8 Query Caching

[2.1.4] - 2021-07-09

  • Bug fix: 1.4 Compatibility with source which was introduced in 2.x

[2.1.2] - 2021-06-14

  • Bug fix: Fixed a bug where some NRQL queries return duplicate rows
  • Bug fix: Fixed a bug where annotations doesn't show up for deployments
  • Bug fix: Fixed a bug where template variables in metrics query doesn't work
  • Bug fix: Fixed a bug where insights type suggestions not applied when pressed enter
  • In Insights editor, now ctrl+s key runs the query

[2.1.1] - 2021-04-12

  • Chore: Update SDK

[2.1.0] - 2021-03-25

  • Replace Metric Select dropdown with Cascader
  • Remove deprecated admin key from Config Editor
  • Fix interpolate template variables for metric values
  • Allow custom label to be created for metric values
  • Return error for Insights query and health check with invalid credentials

[2.0.19] - 2021-02-10

  • NRQL Queries fail against metric table
  • Aliases no longer work
  • Value field not a multi-select, and when selecting '--remove--' the value stays as the actively selected item
  • Health check succeeds even if one of the API Keys is bad
  • New Relic: support for Insights query when query length > 4k characters

[2.0.18] - 2020-12-14

  • Changed the metric selector to only show results when the user starts typing

[2.0.17] - 2020-12-14

  • Updated config editor to allow empty Admin API keys now that the Admin API key and Personal API key have merged

[2.0.16] - 2020-11-19

  • Fixed insights query change event sending a string instead of a query object

[2.0.15] - 2020-11-17

  • Fixed issue where an unnecessary query was being ran whenever the datasource was selected
  • Added the ability to "Remove" or "Reset" the "metric" selection dropdown
  • Changed the default query method to "metricData" from "sourceList"

[2.0.14] - 2020-11-17

  • Fixed issue where unnecessary queries were being sent before the form was completely filled out
  • Fixed issue where metrics were not displaying

[2.0.13] - 2020-11-09

  • Fixed issue where querying many applications causes performance issues

[2.0.12] - 2020-11-06

  • Fix issue where errors were not being logged

[2.0.11] - 2020-11-04

  • Fix caching issue

[2.0.10] - 2020-11-04

  • Client side caching experimental/temporary feature

[2.0.9] - 2020-11-02

  • Fixed issue with parsing the datasource settings

[2.0.8] - 2020-11-02

  • Removed application list in healthcheck
  • Upgraded newrelic-client-go to v0.47.3
  • Updated framing logic

[2.0.7] - 2020-07-23

  • Fix for additional time range bug

[2.0.6] - 2020-07-23

  • Fix for metric data time range
  • Fix for hide/show data in query editor

[2.0.5] - 2020-07-21

  • Fix compatibility issues with previous single values:
  • metric, value are now metrics and values (arrays) to support multi-value template variables

[2.0.4] - 2020-07-14

  • Fix multi-value template variables in insights queries

[2.0.3] - 2020-06-10

  • Fix template variables with insights queries

[2.0.2] - 2020-06-02

  • fix release process

[2.0.1] - 2020-06-01

  • Fix for query editor not releasing the cursor
  • Better handling in queries for null return values

[2.0.0] - 2020-05-18

New Features

  • Works with Grafana 7+
  • Supports alerting
  • Alias now supports "$__nr_metric" and "$__nr_metric_value"
  • NRQL supported in template variables

Breaking Changes

  • Authentication switched to using "admin key" and "personal key"

[1.4.0] - 2020-03-27

  • Update components to fix insight query bug

[1.3.0] - 2019-04-18

  • Upgrade of Slate component to make the plugin compatible with Grafana 6.4. Breaking change so is not backward compatible with previous versions of Grafana

[1.2.0] - 2019-04-18

  • Multi-value variables support
  • Query editor styles in Grafana 6
  • Panel refresh on search field blur
  • Queries with percentiles

[1.1.0] - 2019-03-27

  • Support queries with percentiles
  • Queries with FACET keyword and without TIMESERIES
  • Plugin tries to pull metric list from APM in Insights mode

[1.0.0] - 2018-09-25

  • Support for annotations for Insights API
  • Improved NRQL query editor with intellisense

[0.4.1] - 2018-08-02

  • Support queries without TIMESERIES

[0.4.0] - 2018-08-01

  • Support for NewRelic Insights API
  • NRQL query editor with intellisense

[0.3.4] - 2018-03-29

  • Able to get application deployments as annotation

[0.3.3] - 2018-03-05

  • Replace variables in metric find query

[0.3.2] - 2017-11-13

  • Optional name filters for apps/servers/plugins in template variable editor
  • Filter apps/servers/plugins by name on the NewRelic side (add filter param to API calls)
  • Template variable rendering in selection dropdown

[0.2.1] - 2017-05-22

  • Add data source (with default name New Relic) automatically when configure app
  • JSON.parse error when using variable with single value selected as metric

[0.2.0] - 2017-05-17

  • Initial release