Categories Performance Monitoring

Heroku Deployment Hook

AppNeta no longer blogs on DevOps topics like this one.

Feel free to enjoy it, and check out what we can do for monitoring end user experience of the apps you use to drive your business at www.appneta.com.

To help understand the correlation between system events and performance trends, TraceView provides the ability to log arbitrary events using it’s Annotations API. In this tutorial, we will demonstrate how we can leverage Heroku’s Deploy Hooks add-on to automatically log deployment annotations in TraceView every time you push new code to Heroku.

NOTE: This tutorial assumes that you are:

To begin, you’re going to need your TraceView Access (API) key. Grab this by navigating to the Organization Overview page (in the TraceView navigation menu: Settings => Overview). Please note that you must be a TraceView administrator to access this page in the application.

Next, let’s navigate to where our Heroku application repository lives on our local file system. For this example we’ll be using MegaURL, a URL amplifier:

$ cd /home/dan/dev/megaurl

From here, we can use the heroku CLI tool to provision the Deploy Hooks add-on:

$ heroku addons:add deployhooks:http \

Some important notes when constructing the --url parameter:

  • Replace herokuapp1234567 with your TraceView subdomain
  • Replace the key value with your TraceView Access key
  • Customize the message value to include more Heroku variables
  • URL encode any whitespace in your message

Now let’s create an empty commit and deploy to Heroku:

$ git commit --allow-empty -m "An empty commit"
$ git push heroku master
Fetching repository, done.
Counting objects: 1, done.
Writing objects: 100% (1/1), 189 bytes, done.
Total 1 (delta 0), reused 0 (delta 0)

-----> Ruby app detected
-----> Launching... done, v57
-----> Deploy hooks scheduled, check output in your logs
       http://megaurl.herokuapp.com deployed to Heroku

To git@heroku.com:megaurl.git
   648ade2..beaa724  master -> master

At the end of the log, you can see that Heroku has scheduled the the deploy hook. Thus, deployment annotations will now appear at the top of all your TraceView application performance visualizations:

And just click on the annotation to toggle it:

Looks like the overhead of deployment caused a short increase in server latency, but performance clearly levels out once the new dynos are fully up and running. Thus, I’m able to conclude that my “empty commit” code change has had no negative performance impact on the performance of my application.

Correlating application performance changes with deployments couldn’t be easier.

Dan Riti: "Full-stack developer with a passion for Python, Javascript and music with a lot of bass."