Grafana DataSource Plugin to connect with NewRelic APM.
Note: This is not official plugin from Grafana / NewRelic. For full support use official plugin from Grafana
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 My New Relic Account).
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 the following settings.
Service Type : Insights API
Query : Query in NRQL format.
Result Format : Timeseries / Table
When choosing Timeseries Result format, your query will be updated with the following.
-
SINCE ${options.range.from} UNTIL ${options.range.to}
will be appended to your query , if you dont have SINCE / UNTIL keyword in your query. This means, you dont need to specify any time filter in queries if you want to use the Grafana's timefilter. Still if you need to hardcode any time filter, you can still use SINCE / UNTIL in your queries. -
TIMESERIES AUTO
will be appended to your query, if you dont have TIMESERIES keyword in your query. This means, you dont need to specify TIMESERIES keyword in your query unless you want specific timeseries granularity.
When choosing Table Result format, your query will be updated with the following.
SINCE ${options.range.from} UNTIL ${options.range.to}
will be appended to your query , if you dont have SINCE / UNTIL keyword in your query. This means, you dont need to specify any time filter in queries if you want to use the Grafana's timefilter. Still if you need to hardcode any time filter, you can still use SINCE / UNTIL in your queries.
NOTE: If your query returns uniqueCount, make sure you are using "Table format" instead "Timeseries" to get accurate results.
Use the one of the following queries in the Query
field in the Variable edit view.
Name | Description |
---|---|
Insights(query) | Returns results for the query . |
Examples:
- Gets distinct list of app names:
Insights(SELECT uniques(appName) FROM Mobile)
-
This is not official plugin from Grafana / NewRelic. For full support use official plugin from Grafana
-
NewRelic API does have overload protection. If that happens, you’ll see an error 429 (“Too Many Requests”) in the API response. Read more details here
-
Differnet format of insights query results were tested. But still there can be formats unhandled. If you see such unhandled result format, Create a bug here and so we can fixt its.
NewRelic funnel can be represented in grafana as table or funnel like visualization using panels such as grafana vue html panel
Below example shows the query behind the funnel and its setup using vue html panel.
in NewRelic
in Grafana
NRQL
SELECT funnel(
session,
where requestUrl like '%/api_commerce/bag/v%/%/checkout' as 'Enter Checkout',
where requestUrl like '%/api_finance/paymentoptions/v%/paymentmethods%' as 'Payment',
where requestUrl like '%/api_commerce/order/v%/orders/createorder%' and httpResponseCode >= 200 and httpResponseCode < 300 as 'Orders'
)
FROM AjaxRequest where appId = '111111'
VUE HTML
<table style="width:100%">
<tr v-for="(row,index) in dataset[0].rows" v-bind:key="index" style="padding:20px;">
<td style="padding:10px;">{{row.session}}</td>
<td style="padding:10px 0px;"> {{row.value}}</td>
<td style="width:50%;padding:10px 0px;text-align:center;">
<div style="width:100%;background:red;">
<div v-bind:style="{ 'width': (Math.round(row.value / dataset[0].rows[0].value * 100)+'%') , 'background': 'green'}"> </div>
</div>
</td>
<td style="padding:10px 0px;text-align:center;">{{ Math.round(row.value / dataset[0].rows[0].value * 100) }}%</td>
</tr>
</table>
Synthetic user journey / healthecheck can be replicated in grafana using Discrete panel plugin as shown below
NRQL Query
SELECT ( filter(count(*),WHERE result = 'SUCCESS') / filter(count(*), WHERE result IN ('SUCCESS','FAILED')) * 100 ) as 'Success Rate' FROM SyntheticCheck WHERE monitorName like 'App Support%Checkout Journey' FACET monitorName TIMESERIES 10 minutes
Output in discrete panel
You can also represent the above output with regular graph panel . Example shown below
docker run --rm -it -p 3000:3000 -v "$(pwd)"/grafana-plugins:/var/lib/grafana/plugins --name=grafana grafana/grafana:7.5.12
yarn install
yarn build
# might need to restart docker container after rebuilding