Notify New Relic of Jenkins Deploys

I’m a fan of Jenkins as a build server, and on one particular project we’ve also started using New Relic (I haven’t figured out how to blog fun things about New Relic without sharing graphs of client applications which doesn’t seem like a cool thing to do). New Relic has a feature where you can notify it when you do a deployment, and it shows on the graphs a line marking when that happened, which is super useful for correlating performance changes with code changes.

new-relic-deploy


To set this up with New Relic is really simple as it’s just a webhook with some data attached, but I found a Jenkins plugin for New Relic Deployment and since we deploy via Jenkins and use that to notify our slack channels etc, it seemed a natural place to add it.

The instructions are in the plugin and if you don’t have deployments set up for New Relic then clicking on the “Deployments” tab takes you to some surprisingly helpful help content. One thing that was really missing for me (I am mostly writing this post so I remember this) is that it didn’t include information about which revision was deployed. We aren’t using tags (yet!) for deployment so this could be really handy, and it was easy to set up.

I’m using git, so my Jenkins already has the GIT plugin installed (probably yours does too, but it’s worth checking). This makes a bunch of variables available to git. When you configure the New Relic in your Jenkins task, you can add some fields: in the Revision field add ${GIT_COMMIT} and this will include the commit identifier as a field, which shows in the list of deployments in your New Relic interface.

I love integrating my tools and this is a neat trick that I hope will help us to get a sense of which changes are causing which performance improvements (hopefully only improvements!) and help us to understand the evolution of our deployed-often application.

Leave a Reply

Please use [code] and [/code] around any source code you wish to share.

This site uses Akismet to reduce spam. Learn how your comment data is processed.