Migrating from The SendGrid for New Relic Plugin

Starting Wednesday June 16, 2021, New Relic will no longer support or maintain plugins.

After June 16, 2021, you will no longer be able to access visualizations of your email statistics without changes to your New Relic dashboard. To make these changes, follow the guide on this page.

If you do not utilize New Relic to see email statistics, then there is no action needed from you.

The following guide will not work for customers using New Relic’s High Security Mode. If you are, or believe you may be, using New Relic's High Security Mode, please contact the New Relic support team for assistance.

The legacy SendGrid for New Relic plugin provided the following four charts.

  • Deliveries: This shows Average aggregations for Requests, Drops, Deferrals, Delivered.
  • Engagement: This shows Average aggregations for Unsubscribes, Clicks, Unique Opens and Opens.
  • Compliance: This shows Average aggregations for Bounces, Spamreports and Blocked.
  • Percentage: Shows percentages for various stats.

You can follow the instructions in this document to build each chart without relying on the plugin. The quickest way to construct your dashboards is by importing them using our prebuilt queries, which you'll find in the "Import prebuilt dashboards" section. You can also build your dashboards manually by following the steps in the "Build your dashboards manually" section.

Because we make it possible to view stats for Subusers, there are separate prebuilt dashboards and instructions to create dashboards with or without Subuser support.

Legacy plugin view

OldPluginView.jpg

Import prebuilt dashboards

You can import one of the Twilio SendGrid prebuilt dashboards after specifying your New Relic AccountID in the template. For more information about working with dashboards, please see the New Relic Dashboards documentation.

To retrieve your New Relic Account ID

  1. Navigate to Manage your plan in your New Relic account settings as shown below.

FindAccountNumber.jpg

Depending on your organization structure in New Relic, you may find your AccountID in different ways. See the New Relic documentation if you are unable to locate your ID.

Importing dashboards

The two prebuilt JSON files below allow you to import a dashboard with or without support for Subuser statistics. The process for importing a dashboard is the same when using either file.

To import the prebuilt dashboard

  1. Locate the "accountId" field in the JSON file you selected and replace its value with your AccountID.
  2. From your New Relic dashboards page, select Import a dashboard.
  3. Paste the dashboard JSON from the linked file above, and the dashboard will be created.

ImportDashboard.jpg

Once imported, a dashboard without Subusers will look like the following screenshot. Make sure you select a date range for which you know statistics will be available.

StandardDashboardViewWithoutSubusers.jpg

A dashboard with support for Subusers will provide multiple views. The main, or parent, account for a dashboard with Subusers will look like the following screenshot.

To view the main dashboard

  1. Click on TwilioSendgrid.
  2. Select a date range for which you know statistics will be available.

SubuserDashboard_SelectMainUser.jpg

To view a specific Subuser's stats

  1. Click on the Subuser.
  2. Select a date range for which you know statistics will be available.

SubuserDashboard_SelectSubuser.jpg

Build your dashboards manually

If the prebuilt templates don't work as you expect, you can build your dashboards from scratch.

Add data to a dashboard

The following sections of this guide assumes you have already created a New Relic dashboard. For help creating a dashboard, see the New Relic dashboard documentation.

To add data to your dashboard

  1. Click the Add to your Dashboard (+) button.

AddToDashboard.jpg

  1. A page menu will load with options to add to your dashboard. Select Add a chart. This option will allow you to add a query.

AddAChart.jpg

  1. Select NRQL.

SelectNRQL.jpg

  1. You will now be able to add an NRQL query to visualize your SendGrid statistics. The following query displays all stats for Deliveries using an average aggregate function.
FROM Metric SELECT average(newrelic.timeslice.value)
  WHERE appName = 'Twilio SendGrid' AND metricTimesliceName NOT LIKE '%Percent'
  WITH METRIC_FORMAT 'Custom/TwilioSendGrid/Deliveries/{Stat}'
  TIMESERIES FACET Stat

You can use any of the NRQL aggregate functions you like. The legacy SendGrid for New Relic plugin showed Average.

  1. Click Run. This will run the query and retrieve the specified statistics.
  2. Name the chart "Deliveries."
  3. Click Save.

CreateChartWithNRQLAndSave.jpg

You can now select a timeline to view your stats.

SelectTimeline.jpg

Now that we know how to add a chart with a query, most of the charts are similar except a few that are covered in the next section.

Add charts without Subusers

The following queries will allow you to visualize your Deliveries, Engagement, Compliance, and Percentage data. For more information about working with the Twilio SendGrid Stats API, see our API reference.

To add these queries to your dashboard, follow the process outlined in the previous "Add data to a dashboard" section.

DELIVERIES

FROM Metric SELECT average(newrelic.timeslice.value)
 WHERE appName = 'Twilio SendGrid' AND metricTimesliceName NOT LIKE '%Percent'
 WITH METRIC_FORMAT 'Custom/TwilioSendGrid/Deliveries/{Stat}'
 TIMESERIES FACET Stat

ENGAGEMENT

FROM Metric SELECT average(newrelic.timeslice.value)
 WHERE appName = 'Twilio SendGrid' AND metricTimesliceName NOT LIKE '%Percent'
 WITH METRIC_FORMAT 'Custom/TwilioSendGrid/Engagement/{Stat}'
 TIMESERIES FACET Stat

COMPLIANCE

FROM Metric SELECT average(newrelic.timeslice.value)
 WHERE appName = 'Twilio SendGrid' AND metricTimesliceName NOT LIKE '%Percent'
 WITH METRIC_FORMAT 'Custom/TwilioSendGrid/Compliance/{Stat}'
 TIMESERIES FACET Stat

PERCENTAGE

A percentage is not a TIMESERIES and must be viewed as a table or bar. Be sure to set up your percentage appropriately when selecting a Chart type.

FROM Metric SELECT average(newrelic.timeslice.value)
 WHERE appName = 'Twilio SendGrid' AND StatPercent LIKE '%Percent'
 WITH METRIC_FORMAT 'Custom/TwilioSendGrid/{Categories}/{StatPercent}'
 FACET Categories, StatPercent

PercentageChartForNonSubuser.jpg

Add charts with Subuser support

The following queries allow you to build charts with Subuser support. Before using these queries, you must first add a User Widget. This Users Widget is needed to view statistics for either the main account (under TwilioSendgrid) or one of the Subusers. The widget queries and pulls all Users.

To add the Users Widget

  1. Add the following NRQL query to your dashboard.
FROM Metric SELECT MIN(newrelic.timeslice.value) as MIN
 WHERE appName = 'Twilio SendGrid'
 WITH METRIC_FORMAT 'Custom/{AllUsers}/{Categories}'
 FACET AllUsers
  1. Set the Chart type to Table.

AllUsersWidgetAsTable.jpg

With the Users Widget in place, you can add the following queries to visualize your Deliveries, Engagement, Compliance, and Percentage data for your main account and any Subuser. For more information about working with the Twilio SendGrid Stats API, see our API reference.

To add these queries to your dashboard, follow the process outlined in the previous "Add data to a dashboard" section.

DELIVERIES WITH SUBUSERS

FROM Metric SELECT average(newrelic.timeslice.value)
 WHERE appName = 'Twilio SendGrid' AND metricTimesliceName NOT LIKE '%Percent'
 WITH METRIC_FORMAT 'Custom/{AllUsers}/Deliveries/{Stat}'
 TIMESERIES FACET AllUsers, Stat

ENGAGEMENT WITH SUBUSERS

FROM Metric SELECT average(newrelic.timeslice.value)
 WHERE appName = 'Twilio SendGrid' AND metricTimesliceName NOT LIKE '%Percent'
 WITH METRIC_FORMAT 'Custom/{AllUsers}/Engagement/{Stat}'
 TIMESERIES FACET AllUsers, Stat

COMPLIANCE WITH SUBUSERS

FROM Metric SELECT average(newrelic.timeslice.value)
 WHERE appName = 'Twilio SendGrid' AND metricTimesliceName NOT LIKE '%Percent'
 WITH METRIC_FORMAT 'Custom/{AllUsers}/Compliance/{Stat}'
 TIMESERIES FACET AllUsers, Stat

PERCENTAGE WITH SUBUSERS

A percentage is not a TIMESERIES and must be viewed as a table or bar. Be sure to set up your percentage appropriately when selecting a Chart type.

FROM Metric SELECT average(newrelic.timeslice.value)
 WHERE appName = 'Twilio SendGrid' AND StatPercent LIKE '%Percent'
 WITH METRIC_FORMAT 'Custom/{AllUsers}/{Categories}/{StatPercent}'
 FACET AllUsers, StatPercent

PercentageChartWithSubuser (1).jpg

View all custom metrics

It is also possible to view all custom metrics using New Relic.

To view all custom metrics available

  1. Click New Relic One at the top left corner and navigate to APM.
  2. Click Twilio SendGrid to load the "Explorer view."

ViewCustomMetrics_Step1.jpg

  1. From the left navigation, scroll down all the way and expand More views.
  2. Click on Metrics Explorer and select the appropriate timeline to view the custom metrics. You can now search and browse specific custom metrics.

ViewCustomMetrics_Step2 (1).jpg

Troubleshooting

  • Make sure you select a time range containing some expected stats, or else nothing will populate.
  • Sometimes New Relic dashboards error. Refreshing the dashboard usually fixes the problem.
  • Stats captured from the legacy SendGrid for New Relic plugin will not be visible when using the new integration.

Additional resources

FAQ

What is the purpose of the Min column in the Users widget?

You can ignore the Min column. When creating a query to retrieve all Subusers along with the main parent user, we used an aggregate function, which is required to build the dashboard. However, the value of this function is not needed, and it is not possible to delete the aggregate function. For this reason, you can safely ignore the Min column.

Can I view my Twilio Sendgrid stats without using the New Relic integration?

You can use Twilio Sendgrid APIs to retrieve the raw stats numbers. For more information about working with the Twilio SendGrid Stats API, see our API reference.

Why don't I see any Stats on my dashboard?

Make sure you have selected an appropriate time range in which you expect some Stats.

Who do I contact for help related to NRQL or building a dashboard?

Though we have provided guidelines here, for any questions or issues related to NRQL or building Dashboards, please refer to the linked New Relic documentation or contact their support team.

Need some help?

We all do sometimes; code is hard. Get help now from our support team, or lean on the wisdom of the crowd browsing the SendGrid tag on Stack Overflow.