Configuring AppSignal
This guide will use therevision 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:Configurations per Language
Ruby
For Ruby applications we will load the Git revision from the config file. The shell command that we run in therevision configuration option is the same command we used previously to retrieve the hash of the current commit. 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
REVISIONfile in thecurrentfolder which contains the Git hash:git rev-parse --short HEAD > REVISION
REVISION file when using Rails:
revision configuration option details
Elixir
For Elixir applications we will load the Git revision in theconfig/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.
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.
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.
revision configuration option details
Front-end JavaScript
Because Front-end JavaScript applications run in-browser, it is not possible to call thegit executable command from your front-end application to get the current revision. There are two common approaches to pass the revision value to your front-end application:
Using build-time environment variables (recommended for decoupled front-ends)
Modern front-end build tools embed environment variables into your bundle at build time. You can pass the Git revision through one of these variables and reference it in your AppSignal config. The variable prefix and access pattern depend on your build tool. The example below uses Vite, which exposes environment variables prefixed withVITE_ through the import.meta.env object. Set the variable before building:
appsignal instance wherever you initialize your app. For example, in a Vue application’s main.js:
Using a back-end rendered HTML attribute
If your front-end is rendered by a back-end application (such as a Ruby or Elixir application), you can define therevision value in the HTML body as a data attribute:
revision configuration option details
Go
For Go applications, the revision is set on an OpenTelemetry resource attribute when OpenTelemetry is initialized. In the example below, we call thegit rev-parse command and set the output as the appsignal.config.revision resource attribute. The shell command that we run is the same command we used previously to retrieve the hash of the current commit.
appsignal.config.revision config option is required configuration, so it should already be set. Please consult the appsignal.config.revision config option for more information.
Java
For Java applications, set the revision using theOTEL_RESOURCE_ATTRIBUTES environment variable. We’ll use the same Git command as shown previously.
appsignal.config.revision config option is required configuration, so it should already be set. Please consult the appsignal.config.revision config option for more information.
PHP
For PHP applications, set the revision in your configuration to override the default. By default, AppSignal sets the revision using the same Git command shown in Automatically update the revision.appsignal.config.revision config option for more information.
Deploy
When finished configuring therevision 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!