Deploy Metadata

Every time Potions deploys your app, it injects the commit SHA that was deployed into your app's environment as POTIONS_COMMIT_SHA.

Error trackers and APM tools use this value to group errors and performance data by deploy. Instead of "errors started around 3pm," you get "errors started with this deploy," along with a link to the exact commit.

The Variable

Variable Value
POTIONS_COMMIT_SHA The full 40-character commit SHA of the deploy currently running

It's injected at deploy time rather than stored as one of your app's variables, so you won't see it listed on the Environment tab. It's available to your running app, to iex console sessions, and to scheduled tasks.

Wiring It Up

Every tool names this concept differently, so you map POTIONS_COMMIT_SHA to whatever yours calls it. Add the line for your tool, alongside whatever config you already have:

This must go in config/runtime.exs, the only config file evaluated on your server at boot. Every other config file is evaluated when your release is built, on the build server, where this variable doesn't exist.

# config/runtime.exs
import Config

if config_env() == :prod do
  # AppSignal: opens a deploy marker and tags incoming data when this changes
  config :appsignal, :config, revision: System.get_env("POTIONS_COMMIT_SHA")

  # Sentry: drives regression detection and "first seen in release"
  config :sentry, release: System.get_env("POTIONS_COMMIT_SHA")

  # Honeybadger
  config :honeybadger, revision: System.get_env("POTIONS_COMMIT_SHA")

  # Bugsnag
  config :bugsnag, app_version: System.get_env("POTIONS_COMMIT_SHA")
end

Using OpenTelemetry? Report it as the service.version resource attribute instead.

Using It In Your Own Code

The commit SHA is useful outside of error tracking. A version endpoint, a footer, or a field on a health check payload all make it easier to confirm what is actually running:

defmodule MyAppWeb.VersionController do
  use MyAppWeb, :controller

  def show(conn, _params) do
    json(conn, %{commit: System.get_env("POTIONS_COMMIT_SHA")})
  end
end