Skip to content
Upstate Docs
Log in Open Upstate

Operate with confidence

Mark deploys in your error tracker

Upstate does not integrate with error trackers and holds none of your error-tracker credentials. Your tracker already knows how to mark a deploy, so use its own tooling and keep the version identical to the one in your Upstate deployment receipt. Then "which deploy introduced this error?" and "did that deploy verify?" can be answered side by side.

Two different facts

FactWho records itWhat it means
Version introducedYour error tracker's deploy markerA release or deploy with this version and environment was announced. Errors first seen after it are candidates for that version.
Rollout independently verifiedThe Upstate receiptUpstate checked what appeared on the hosts and whether required health signals stayed ready.

A deploy marker is not evidence that the rollout succeeded, and a receipt that is not Verified does not mean the version caused no errors. A partial or failed rollout can still serve traffic from the new version and introduce errors, so mark every deploy you start, not only the ones that verify. Use the receipt to judge the rollout and the tracker to judge the code.

Use one version and one environment

Pick the full commit SHA as the version everywhere. Kamal's KAMAL_VERSION is the full version being deployed, which is the commit SHA in a default Kamal setup (confirm this for your project). Use the same environment name your tracker's SDK reports, for example production, and the same destination you give Kamal with -d.

  • Sentry: the release must match the release your SDK sets, and the deploy environment must match the environment the SDK reports. Otherwise events are not attributed to the release.
  • Honeybadger: the revision should match the revision your notifier reports, and the environment must match the notifier's environment.
  • AppSignal: see below. The revision is normally detected, not posted.

AppSignal

Recent AppSignal Ruby releases detect the revision from KAMAL_VERSION (alongside HEROKU_SLUG_COMMIT, RENDER_GIT_COMMIT and CONTAINER_VERSION) when no REVISION file takes precedence, according to the AppSignal Ruby changelog. Support depends on your SDK and version, so check the changelog for the SDK you run. If your SDK does not detect it, set the revision config option explicitly to the same SHA. A placeholder REVISION file committed to source control can override detection.

There is nothing to post from a Kamal hook for AppSignal when detection works. Check in AppSignal that the deploy shows the SHA you expect.

Honeybadger

Honeybadger records a deploy from its deployments API, the CLI, or its GitHub Action. See Tracking deployments and the deployment API. The API takes the project API key, environment, revision, and optionally repository and local_username.

Sentry

Create a release with the commit SHA as its version, then create a deploy for it in the environment. The Sentry CLI does this with sentry release deploy <org/version> <environment> (CLI reference), and the REST API has Create a Deploy (POST /api/0/organizations/{org}/releases/{version}/deploys/). Authenticate with a Sentry auth token that is limited to release management.

One Kamal post-deploy hook

Kamal hooks run on the machine that runs kamal deploy and receive environment variables such as KAMAL_VERSION and KAMAL_DESTINATION (Kamal hooks). Upstate's managed hooks create the receipt from the same deploy, so the receipt and the marker share the version Kamal supplied.

Add a .kamal/hooks/post-deploy script. If Upstate already manages this hook in your repository, add your lines to it rather than replacing it, and keep a copy of the original.

#!/bin/sh
# Mark this deploy in the error tracker. A tracker outage must not fail the deploy.
ENVIRONMENT="${KAMAL_DESTINATION:-production}"

# Honeybadger: use the project API key from your own secret store.
curl -sS https://api.honeybadger.io/v1/deploys \
  -H "X-API-Key: ${HONEYBADGER_API_KEY}" \
  -H "Content-Type: application/json" \
  -d "{\"deploy\":{\"environment\":\"${ENVIRONMENT}\",\"revision\":\"${KAMAL_VERSION}\",\"local_username\":\"${KAMAL_PERFORMER}\"}}" \
  || echo "Honeybadger deploy marker failed" >&2

# Sentry: SENTRY_AUTH_TOKEN, and your organization slug in SENTRY_ORG.
# sentry release create "${SENTRY_ORG}/${KAMAL_VERSION}" || true
# sentry release deploy "${SENTRY_ORG}/${KAMAL_VERSION}" "${ENVIRONMENT}" || true

exit 0

Make it executable with chmod +x .kamal/hooks/post-deploy. Use one block, not both, unless you run both trackers. Keep tokens in your secret store or the deploying machine's environment, never in the repository. Replace HONEYBADGER_API_KEY, SENTRY_AUTH_TOKEN and SENTRY_ORG with your own values. The script ends with exit 0 so a tracker problem does not turn a good deploy into a failed one.

If the tracker's environment is not your Kamal destination name (for example, destination staging but the SDK reports stage), set ENVIRONMENT explicitly.

Check that they line up

  1. Run a deploy and open its receipt with upstate receipt or from the project in Upstate.
  2. Open the same deploy in your tracker and compare the version and environment character by character.
  3. If they differ, fix the hook or the SDK setting before relying on either for incident review.