New Relic Data Source
This is a Grafana data source for showing metrics from the New Relic APM (application performance monitoring).
After installing New Relic plugin, go to Datasources in the menu, click on the Add datasource button and then choose New Relic from Type dropdown and fill in a name for the data source (for example New Relic). Add your New Relic's REST API key, which you can generate from INTEGRATIONS -> API keys page in your New Relic
account settings. For using Insights, specify your Insights API key (Insights -> Manage Data -> API keys -> Query Keys) and Accounty ID (get it from page URL:
https://insights.newrelic.com/accounts/<your_account_id>/manage/api_keys or from query example on the API keys page).
Query editor has two modes. A first one allows querying New Relic APM via New Relic REST API. Second one supports New Relic Insights and provides query editor for New Relic Query Language (NRQL).
New Relic Insights
Select Insights in Service field. You'll see input field for NRQL query. Start to type and use autocomplete.
For more information about advanced queries - visit <u><a href='https://docs.newrelic.com/docs/insights/nrql-new-relic-query-language/nrql-resources/nrql-syntax-components-functions'>NRQL docs</a></u>.
Macros and template variables
In order to improve experience when writing NRQL queries, editor supports macros which are converting into real values when query is invoked. There's a list supported macros:
$__timeFilteris converting into
SINCE <from> UNTIL <to>clause based on dahboard's time range.
Editor also support template variables that are available for use in the query via $variable_name or [[variable_name]].
For hints on how to use macros and template variables - refer to help section in the editor.
New Relic APM
Select New Relic in Service field. Query editor is very simple, just select metric source type (Application, Server or Plugin are supported), select needed app, server or component (plugin), then choose metric and value.
New Relic plugin supports advanced alias patterns and special variables.
Default alias is
$__nr_metric: $__nr_metric_value, but you can rewrite it using these variables:
|$__nr_metric||Metric name||CPU/User time|
Combine plain text with variables to set desired alias, for example:
Server: $__nr_server Metric: $__nr_metric.
New Relic data source supports template variables. You can fetch different type of data for using as template variable values. First, you can get list of available applications, servers or plugins:
applications or applications/[nameFilter] - list of applications components or components/[nameFilter] - list of components (plugins)
[nameFilter] is optional name filter.
Also, you can pull list of available metrics from particular application, server or component. Use these formats:
servers/62535318/metrics/. It isn't so useful to write id's of your apps or servers, so better to
combine these endpoints with first type of variables, for example:
Variable Query $app applications $appMetrics applications/$app/metrics
By this way you can choose application and get list of metrics in
NRQL queries can be defined in the
Query field to be used as a template variable when working with the New Relic datasource.
SELECT uniques(entityAndInterface) FROM NetworkSample
Multi-value variables support
You can set your variable as multi-value. These variables are supported in Metric and Value fields. So you can select several metrics using one query.
Annotations allow to get alerts and deployments events from New Relic and display it on graphs.
Getting alert events
Select your New Relic data source and set additional filters. Without any filters set all events will be returned. If you want to filter events by Entity ID, better to use template variables because in this case you can select entity name instead of ID. For example, to filter events for particular application create a variable $app which retrieves a list of apps and use it as Entity ID filter.
Application ID is required field.