Deploy Tracking

Airbrake has the ability to track your deploys.

Whenever you deploy a project to a particular RAILS_ENV, Airbrake will record the deploy and resolve all notices for that project and specified RAILS_ENV.
Any errors that reoccur will change from the resolved to the unresolved state and trigger a notification.
This ensures that you get notified if you have any exceptions that are still occurring after the deploy.

All existing notices matching the RAILS_ENV for a project will be resolved in bulk using this feature.

Deploy tracking with the API

You can track a deploy with the POST to the /v4/deploys api endpoint documented here:

You want to trigger a POST each time you deploy, specifying at least your PROJECT_ID, PROJECT_KEY and environment in the JSON data. If you provide the other keys this will enable us to build links in backtraces that link to your repository.

Example curl command

curl -X POST -H "Content-Type: application/json" -d '{"environment":"production","username":"john","repository":"","revision":"38748467ea579e7ae64f7815452307c9d05e05c5","version":"v2.0"}' ""

JSON post data description

You can post JSON data with the following keys. there are example

Key Example
environment production
username john
revision 38748467ea579e7ae64f7815452307c9d05e05c5
version v2.0


The API returns 201 Created status code on success.

Deploy tracking for a ruby app

Deploy tracking requires the latest airbrake notifier. Be sure you have the latest version installed from the github project. In addition, deploy tracking is only available for accounts on paid plans.


Once installed, your application will have a new rake task, which you call as...

To Mark all Errors as Resolved for the Production Environment
rake airbrake:deploy TO=production

To Mark all Errors as Resolved for a Specified Rails Environment, use the following format:

rake airbrake:deploy RAILS_ENV=<rails environment> TO=rails environment

For example:

rake airbrake:deploy RAILS_ENV=**development** TO=**development**

rake airbrake:deploy RAILS_ENV=staging TO=staging

But if you use capistrano, you should never have to run the rake command for the Production environment by hand. The Airbrake notifier also includes a capistrano recipe that runs after deploy:cleanup which automatically triggers that rake task.

You can see how many deploys you have for a project under the projects page, and you can view those individual deploys, plus all errors that happened while that deploy was active by drilling down further.

Airbrake Deploy Tracking

Deploy tracking also allows you to make use of GitHub integration

Usage - Engine Yard Cloud

To notify Airbrake of your deploys to EngineYard cloud, you can use the following deploy/after_restart.rb script:

The above notification script is a modified version of a script included in the Engine Yard Cloud, New Relic and Airbrake deploy notifications article by Jose Fernandez.

Read more about the deploy/*.rb deploy hook scripts on Engine Yard's documentation site.

Manual Deploy Notifification

The rake airbrake:deploy task and Capistrano hooks are intended for use in a Rails application. You can manually trigger a deploy on the command line using the Airbrake API and curl:

curl -d "api_key=API_KEY&deploy[rails_env]=ENVIRONMENT"

Where API_KEY is your project's API Key and ENVIRONMENT is the environment you're deploying to. There are some other settings that may be used along with the two above:

deploy[local_username]=USER   # username of the person doing the deploy
deploy[scm_repository]=URL    # URL of the repository, e.g. git://
deploy[scm_revision]=REVISION # Hash, number, tag, or other identifier showing what revision was deployed

Running that command will mark a deploy in Airbrake for the project specified.

Using Airbrake executable

You can also use the executable for deploy notifications:

$ airbrake deploy -k YOUR_API_KEY

For more information about the executable, please visit the Airbrake gem wiki pages.


If the notification of the deploy is not happening automatically when you do a capistrano deploy:

  • Ensure that your plan supports deploys. Which plans support depoys?
  • When Airbrake is installed as a gem, you need to add require 'airbrake/capistrano' to your deploy.rb

Heroku DeployHooks

To implement Deploy Hooks on Heroku/Cedar stack, please use one of the following:

heroku addons:add deployhooks:http \
&deploy[scm_repository]=GITHUB_URL" # e.g.
rake airbrake:heroku:add_deploy_notification

Be sure to provide the app name for the rake task if you have multiple Heroku apps configured. You can send it by specifying ENV["HEROKU_APP"].

Deploy Tracking not resolving errors for your env?

Deploy tracking environment names are case sensitive.
Please make sure that the string in your deploy code for RAILS_ENV matches exactly with the environment variable you initialized your notifier with.
If an error occurs with the environment "Production"
you would need to specify RAILS_ENV as "Production"
or no errors with the "Production" env will be resolved.