Documentation navigation

Reporting deploys to track improvements

Every time an app gets deployed, changes that affect the app start running. By tracking deploys in AppSignal, error incidents and performance measurements are grouped per deploy. They will also allow for AppSignal.com to link directly from an error backtrace to the line of code in your app for that version of the app.

In this guide we will track deploys in AppSignal using deploy markers, configure an application to report these deploy markers.

🔍 Read more in-depth information about deploy markers and what they're used for.

Configuring AppSignal

To report deploys to AppSignal we will use deploy markers. In this guide we will focus on the revision config option method of reporting deploy markers. (Other methods may be available, more details about why we prefer this method can be found on the deploy markers page.)

The revision config option is configured differently per integration language. See the list of integrations below for the one your app uses.

Heroku apps using the "Dyno Metadata" labs feature will automatically report deploys.

Automatically update the revision

We recommend fetching the revision config option value from the SCM (Git/SVN/other) system dynamically on start or on deploy. This way the value doesn't have to be manually updated per deploy. If a Git SHA (or other SCM revision value) is used it will also be compatible with error backtrace links.

An example for Git:

1
2
git log --pretty=format:'%h' -n 1
# Will output the current commit's short SHA

We will use the Git example in the integration examples below.

Ruby

In the Ruby integration we will load the Git revision in the config/appsignal.yml config file. By using ERB we call the git log command and set the output as the revision config option.

1
2
3
4
# Example: config/appsignal.yml
production:
  revision: "<%= `git log --pretty=format:'%h' -n 1` %>"
  # Other config

Ruby revision configuration option details

Elixir

In the Elixir integration we will load the Git revision in the config/appsignal.exs config file (your file location may differ). In this .exs command we call the git log command with Elixir and set the output as the revision config option.

1
2
3
4
5
# Example: config/appsignal.exs
{revision, _exitcode} = System.cmd("git", ["log", "--pretty=format:%h", "-n 1"])
config :appsignal, :config,
  revision: revision
  # Other config

Elixir revision configuration option details

Node.js

In the Node.js integration load the Git revision in the app's config file. In this .js command we call the git log command with Node.js and set the output as the revision config option.

1
2
3
4
5
6
7
// Example: appsignal.js
var childProcess = require("child_process");
var REVISION = childProcess.execSync("git log --pretty=format:'%h' -n 1").toString();
const appsignal = new Appsignal({
  revision: REVISION
  // Other config
})

Node.js revision configuration option details

JavaScript

In the front-end JavaScript integration it's not possible to call the git executable, because the integration runs in the browser. Instead, set the "revision" value from the back-end app—such as a Rails or Phoenix app—into the HTML body as a property. Then load that property in the JavaScript config file.

1
2
<body data-app-revision="REVISION VALUE">
  <!-- Rest of the HTML -->
1
2
3
4
5
6
// Example: appsignal.js
const body = document.querySelector("body");
const appsignal = new Appsignal({
  revision: body.dataset.appRevision
  // Other config
});

JavaScript revision configuration option details

Deploy

After the app has been configured with the revision option, commit your changes and deploy the app. When the app starts/restarts, AppSignal will create a deploy in the deploys section for your app.

Are deploys not being reported or incorrectly? Contact us and we will help you out!

Next steps


We'd like to set cookies, read why.