New Relic
The New Relic channel records each deployment as a deployment marker in New Relic APM, so you can line up a code change with the performance data around it.
This page is for the lead or DevOps engineer who sends deployment markers to New Relic. It covers the setup steps, every variable the channel reads and how the channel finds the New Relic application.
Setup
To set up New Relic notifications:
- Create a New Relic User API
Key
(format:
NRAK-XXXXXXXXXXXXXXXXXXXXXX). - Turn the channel on in each environment where New Relic APM is
configured, such as production and staging. In that environment's
hosting variables, set
NEWRELIC_ENABLEDorVORTEX_NOTIFY_NEWRELIC_ENABLEDtotrue:- Leave both variables unset everywhere else, so other environments make no API calls.
- Any non-empty value turns the channel on, including
falseand0. - When both variables are set,
VORTEX_NOTIFY_NEWRELIC_ENABLEDwins.
- Add
VORTEX_NOTIFY_NEWRELIC_USER_KEYto your hosting provider's environment variables. WhenVORTEX_NOTIFY_NEWRELIC_USER_KEYis unset, the channel usesNEWRELIC_USER_KEY. - Add
newrelicto the comma-separatedVORTEX_NOTIFY_CHANNELSlist in your.envfile, for exampleVORTEX_NOTIFY_CHANNELS=email,newrelic.
Confirm that the next deployment of a branch in
VORTEX_NOTIFY_NEWRELIC_BRANCHES recorded a marker. The deployment output
on your hosting platform shows
Created a deployment notification for application, then
[ OK ] Finished New Relic notification. The marker appears on the
application's charts in New Relic.
Environment variables
See the Notifications overview for the router, what a failed
channel stops, the shared VORTEX_NOTIFY_* variables and the Location
column. The following table lists the variables that the New Relic channel
reads:
| Variable | Required | Default | Location | Description |
|---|---|---|---|---|
VORTEX_NOTIFY_NEWRELIC_ENABLED | Yes, unless NEWRELIC_ENABLED is set | NEWRELIC_ENABLED | Hosting | Turns the channel on; any non-empty value counts |
VORTEX_NOTIFY_NEWRELIC_USER_KEY | Yes, unless NEWRELIC_USER_KEY is set | NEWRELIC_USER_KEY | Hosting | New Relic User API Key |
VORTEX_NOTIFY_NEWRELIC_PROJECT | No | VORTEX_NOTIFY_PROJECT | .env | Project name |
VORTEX_NOTIFY_NEWRELIC_APP_NAME | No | <project>-<label> | .env | Application name as it appears in New Relic |
VORTEX_NOTIFY_NEWRELIC_APPID | No | Looked up by application name | .env | Application ID |
VORTEX_NOTIFY_NEWRELIC_DESCRIPTION | No | Default template | .env | Deployment description |
VORTEX_NOTIFY_NEWRELIC_CHANGELOG | No | Value of VORTEX_NOTIFY_NEWRELIC_DESCRIPTION | .env | Deployment changelog |
VORTEX_NOTIFY_NEWRELIC_USER | No | Deployment robot | .env | User performing deployment |
VORTEX_NOTIFY_NEWRELIC_REVISION | No | VORTEX_NOTIFY_NEWRELIC_SHA, or <label>-<date>-<time> when the SHA is empty | Hosting | Deployment revision |
VORTEX_NOTIFY_NEWRELIC_ENDPOINT | No | https://api.newrelic.com/v2 | .env | API endpoint |
VORTEX_NOTIFY_NEWRELIC_BRANCHES | No | main,master,develop | .env | Exact branch names to record (comma-separated); empty falls back to the default |
VORTEX_NOTIFY_NEWRELIC_LABEL | No | VORTEX_NOTIFY_LABEL | Hosting | Deployment label |
VORTEX_NOTIFY_NEWRELIC_SHA | No | VORTEX_NOTIFY_SHA | Hosting | Commit SHA used as the revision |
VORTEX_NOTIFY_NEWRELIC_ENVIRONMENT_URL | No | VORTEX_NOTIFY_ENVIRONMENT_URL | Hosting | Environment URL |
VORTEX_NOTIFY_NEWRELIC_LOGIN_URL | No | VORTEX_NOTIFY_LOGIN_URL | Hosting | Login URL |
VORTEX_NOTIFY_NEWRELIC_EVENT | No | VORTEX_NOTIFY_EVENT, then post_deployment | Hosting | Deployment event; pre_deployment records nothing |
The default application name joins VORTEX_NOTIFY_NEWRELIC_PROJECT and
VORTEX_NOTIFY_NEWRELIC_LABEL with a hyphen. These default to the project
name and the deployment label, so a main deployment of your_site looks
for your_site-main.
When VORTEX_NOTIFY_NEWRELIC_APPID is empty, the channel looks the
application up by name. If no application matches, the channel skips the
notification and passes, so an environment without APM records nothing. An
explicit numeric ID skips that lookup, so an ID that matches no application
fails the channel.
The channel fails when New Relic answers the marker request with any status
other than HTTP 201. It skips pre_deployment without an error, like
every channel except Slack and GitHub.
An empty VORTEX_NOTIFY_NEWRELIC_BRANCHES falls back to the default list,
so list every branch that should record a marker.
Example
The following screenshot shows a deployment marker on a New Relic chart, with its time, user and revision:
