New Relic Netlify Plugin
Monitor your Netlify build process and Jamstack application performance with New Relic, without the need for lengthy manual set up.
Built for developers who want to know how their deploys are impacting site performance for users, the New Relic Plugin for Netlify enables you to:
- Automatically install the New Relic browser agent and notify New Relic each time a build event occurs in Netlify. Get critical insights via Real User Monitoring (RUM) into the performance of your Jamstack application.
- Understand how each deploy impacts your site’s performance metrics in production.
- Measure Google Core Web vitals on your site like Largest Contentful Paint, First Input Delay, and Cumulative Layout shift.
- Quickly discover and fix errors before they impact your users.
- Explore your data using our custom-built dashboards and receive alerts/notifications when there’s an issue with your Netlify site. Installing the New Relic Netlify Plugin
Installation
To install the plugin, log into your New Relic account (or sign up for a free account), then create a New Relic ingest license key and a New Relic browser ingest license key.
UI Installation
UI installation is the quickest way to start using the plugin, and does not require any modifications to your project's code.
- Navigate to the Netlify plugin directory, search for New Relic, and select install and then choose which of your Netlify sites will use the plugin
- Go to your site settings > build and deploy > environment and set the following environment variables:
- NEWRELIC_ACCOUNT_ID: Your New Relic Account ID
- NEWRELIC_INGEST_LICENSE_KEY: A New Relic ingest license key
- NEWRELIC_BROWSER_LICENSE_KEY: A New Relic browser ingest license key
- NEWRELIC_APP_ID: Your New Relic Browser App ID
- ENABLE_BROWSER_MONITORING: Set this to true
File-based Installation
Alternatively, to install with file-based installation, add the following lines to your netlify.toml
files:
package = "@newrelic/netlify-plugin"
[plugins.inputs]
newrelicAccountId = "123456"
newrelicLicenseKey = "12345678901234567890"
newrelicBrowserLicenseKey = "ABCD-0987654321"
newrelicAppId = "123456789"
enableBrowserMonitoring = true
Replace the values for newrelicAccountId
, newrelicLicenseKey
, newrelicBrowserLicenseKey
, and newrelicAppId
with your New Relic Account ID, the ingest and browser ingest license key you, and your New Relic Browser App ID.
Install the Netlify quickstart
To get the most out of your Netlify integration you should also install the New Relic Netlify quickstart. You can find more information on the quickstart page on New Relic I/O.
Settings
The plugin allows for customisation of the following settings via environment variables or your netlify.toml
.
netlify.toml key |
Environment variable name | Description | Required for | Default value |
---|---|---|---|---|
failBuildOnPluginError | FAIL_BUILD_ON_PLUGIN_ERROR | Fail the whole build if the plugin has an error | true | |
newrelicAccountId | NEWRELIC_ACCOUNT_ID | New Relic Account ID | event tracking & browser monitoring | undefined |
newrelicLicenseKey | NEWRELIC_INGEST_LICENSE_KEY | New Relic Ingest License Key | event tracking | undefined |
newrelicBrowserLicenseKey | NEWRELIC_BROWSER_LICENSE_KEY | New Relic Ingest License Key | event tracking | undefined |
newrelicAppId | NEWRELIC_APP_ID | New Relic APM App ID | browser monitoring | undefined |
recordEventsForPreviews | RECORD_EVENTS_FOR_PREVIEWS | Set this to true if you want to record events for deploy previews | false | |
skipEvent.onPreBuild | SKIP_PRE_BUILD_EVENT | Set this to true to skip recording onPreBuild custom events | false | |
skipEvent.onBuild | SKIP_BUILD_EVENT | Set this to true to skip recording onBuild custom events | false | |
skipEvent.onPostBuild | SKIP_POST_BUILD_EVENT | Set this to true to skip recording onPostBuild custom events | false | |
skipEvent.onSuccess | SKIP_SUCCESS_EVENT | Set this to true to skip recording onSuccess custom events | false | |
skipEvent.onError | SKIP_ERROR_EVENT | Set this to true to skip recording onError custom events | false | |
skipEvent.onEnd | SKIP_END_EVENT | Set this to true to skip recording onEnd custom events | false | |
enableBrowserMonitoring | ENABLE_BROWSER_MONITORING | Attempt to inject the browser monitor script tag into any HTML pages | false | |
enableBrowserMonitoringForPreviews | ENABLE_BROWSER_MONITORING_FOR_PREVIEWS | Set this to true if you want to enable browser monitoring for deploy previews | false | |
distributedTracingEnabled | DISTRIBUTED_TRACING_ENABLED | Enable distributed tracing for browser requests | true | |
cookiesEnabled | COOKIES_ENABLED | Enable cookies for browser monitoring | true | |
htmlInjectionConcurrency | HTML_INJECTION_CONCURRENCY | Number of concurrently pending promises to use when injecting browser agent | 5 | |
revisionTemplate | REVISION_TEMPLATE | Deploy marker revision and release version id structure (EJS string) | <% if(git.commits[0].message){ % ><%= git.commits[0].message.slice(0,25) % >-<% } % ><%= process.env.CONTEXT % >-<%= process.env.COMMIT_REF.slice(0, 7) % >-<%= process.env.DEPLOY_ID.slice(-6) % >-<%= process.env.BUILD_ID.slice(-6) % > |
Support
The plugin is part of New Relic experimental. The project is being developed in the open and we welcome all feedback and contributions.
Please raise an issue or contact us via the New Relic Explorers Hub.
Contributing
We encourage your contributions to improve the New Relic Netlify Plugin!
Keep in mind when you submit your pull request, you'll need to sign the CLA via the click-through using CLA-Assistant. You only have to sign the CLA one time per project.
If you have any questions, or to execute our corporate CLA, required if your contribution is on behalf of a company, please drop us an email at opensource@newrelic.com.
A note about vulnerabilities
As noted in our security policy, New Relic is committed to the privacy and security of our customers and their data. We believe that providing coordinated disclosure by security researchers and engaging with the security community are important means to achieve our security goals.
If you believe you have found a security vulnerability in this project or any of New Relic's products or websites, we welcome and greatly appreciate you reporting it to New Relic through HackerOne.
License
The New Relic Netlify plugin is licensed under the Apache 2.0 License.