Reporting deploys to track improvements
How your application functions can change with each new deployment. When tracking your deploys with AppSignal, error incidents and performance measurements are grouped per deployment, so you can easily see what impacts your deployment has had on your application's performance and error rate. AppSignal can take you from an error backtrace to the line of code from which a specific error originated, and this help
This guide will show you how to track deploys in AppSignal using deploy markers.
Configuring AppSignal
This guide will use the revision
config option method of reporting deploy markers. You can read about alternative approaches to this in our Deploy Markers documentation.
The revision
config option is configured differently per integration language. See the list of integrations below for the one your app uses.
Note that AppSignal will automatically report a deploy when using platforms such as Heroku or Render, or deployment orchestrators such as Kamal.
Automatically Update the Revision
We recommend dynamically fetching the revision config option value from the source control management used for your project (such as Git or SVN) on start or deploy. This way, the value doesn't have to be manually updated per deploy. If a Git commit hash is used, it will also be compatible with error backtrace links.
Below is an example of how you would do this using Git:
We'll continue to use Git for all integration examples in this documentation.
Configurations per Language
Ruby
For Ruby applications we will load the Git revision in the config/appsignal.yml
config file. The config file is interpreted as an ERB (Embedded Ruby) template, which allows us to run arbitrary code in it.
The shell command that we run in the revision
configuration option in ERB is the same command we used previously to retrieve the hash of the current commit. Using ERB, we call the git rev-parse
command and set the output as the revision
config option, as shown in the example below:
Using Ruby deploy gems
If you use a deployment tool like Capistrano or Hatchbox that excludes the .git
folder from getting deployed:
- Modify the deploy process to run a command that creates a
REVISION
file in thecurrent
folder which contains the Git hash:git rev-parse --short HEAD > REVISION
When using a Platform-as-a-Service provider, the provider might create this file for you, or expose the revision as an environment variable that you can read from the configuration file. If you are unsure if this applies to you, check with your provider or get in touch, we may know the answer.
Below is an example of how to read the Git hash from a REVISION
file when using Rails
:
Read more about Ruby revision
configuration option details
Elixir
For Elixir applications we will load the Git revision in the config/appsignal.exs
config file (your file location may differ).
In the example config/appsignal.exs
file below, we call the git rev-parse
command with Elixir and set the output as the revision
config option.
Read more about Elixir revision
configuration option details
Node.js
For Node.js applications, the Git revision is loaded in the app's config file.
In the below .js
snippet we call the git rev-parse
command with Node.js and set the output as the revision
config option.
Read more about Node.js revision
configuration option details
Python
For Python applications, the Git revision is loaded in the application's __appsignal__.py
config file.
In the example below, we call the git rev-parse
command with Python and set the output as the revision
config option. The shell command that we run is the same command we used previously to retrieve the hash of the current commit.
Read more about the Python revision
configuration option details
JavaScript
Because Front-end JavaScript applications run in-browser, it is not possible to call the git
executable command from your front-end application to get the current revision
. Instead you need to define the revision
value in the HTML body as a property using your back-end application (such as a Ruby or Elixir application), like in the example below:
We can then retrieve this value in the JavaScript, like below:
Read more about JavaScript revision
configuration option details
Deploy
When finished configuring the revision
option, commit your changes and deploy your application. When the app starts/restarts, AppSignal will create a deploy in the deploys section for your app.
That's it! You've successfully configured your application to notify AppSignal of deploys! Your application's data will be tracked alongside the appropriate deployment, helping level up your ability to analyze your application's performance.
Are deploys not being reported or incorrectly? Contact us and we will help you out!