# Releases and release health

> Tag errors and sessions with a release, record commits and deploys, and track crash-free sessions and users, ANR rate, adoption, regressions and suspect commits per release.

Source: https://apphelm.dev/docs/release-health

A **release** is the version of your app or service that produced an event, such as `web@2.4.1` or `2.4.1+87`. When your SDK sends a release with every error and session, AppHelm can tell you which release introduced an issue, which one brought a fixed issue back, how many sessions ended in a crash, and which commits are likely to blame.

Releases belong to a product. A release exists as soon as AppHelm sees it on an event or session, or when you create it from CI. Open **Reliability → Issues → Releases** to see them.

## Set the release in your SDK

Set `release` (and `environment`) when you create the client. Use the same string everywhere a build reports, including the source map and symbol uploads for it.

Next.js:
```tsx
// The browser part of a Next.js app: pass the release to the provider.
<ApphelmNextProvider options={{ key: "ahl_pub_…", workspaceId: "org_…", productId: "prd_…", release: process.env.NEXT_PUBLIC_RELEASE, environment: "production", releaseHealth: true }} />
```

React:
```tsx
<ApphelmProvider options={{ key: "ahl_pub_…", workspaceId: "org_…", productId: "prd_…", release: "web@2.4.1", environment: "production", releaseHealth: true }}>
```

JavaScript (browser):
```js
const analytics = createBrowserSdk({ key: "ahl_pub_…", workspaceId: "org_…", productId: "prd_…", release: "web@2.4.1", environment: "production", releaseHealth: true });
```

React Native / Expo:
```ts
const mobile = createReactNativeSdk({ apiKey: "ahl_pub_…", workspaceId: "org_…", productId: "prd_…", release: "shop@2.4.1+87", environment: "production" });
// Sessions are on by default (enableAutoSessionTracking).
```

iOS (Swift):
```swift
let apphelm = ApphelmClient(options: ApphelmOptions(apiKey: "ahl_pub_…", workspaceId: "org_…", productId: "prd_…", release: "shop@2.4.1+87", environment: "production"))
// Sessions need a release; without one none are sent.
```

Android (Kotlin):
```kotlin
Apphelm.setup(this, ApphelmConfig("ahl_pub_…", "org_…", "prd_…").apply {
    environment = "production" // release defaults to "versionName+versionCode", e.g. "2.4.1+87"
})
```

Flutter:
```dart
await Apphelm.setup(ApphelmConfig(apiKey: 'ahl_pub_…', workspaceId: 'org_…', productId: 'prd_…', release: 'shop@2.4.1+87', environment: 'production'));
```

Node.js:
```ts
const apphelm = new Apphelm({ apiKey: process.env.APPHELM_API_KEY!, workspaceId: "org_…", productId: "prd_…", release: process.env.RELEASE, environment: "production" });
```

Python:
```python
apphelm.init(api_key=os.environ["APPHELM_API_KEY"], workspace_id="org_…", product_id="prd_…",
             release=os.environ["RELEASE"], environment="production", release_health="request")
```

Java / Kotlin (JVM):
```kotlin
val apphelm = ApphelmClient(ApphelmOptions(apiKey = System.getenv("APPHELM_API_KEY"), workspaceId = "org_…", productId = "prd_…",
    release = System.getenv("RELEASE"), environment = "production", sessionMode = SessionMode.REQUEST))
```

Go:
```go
client, err := apphelm.New(apphelm.Config{APIKey: os.Getenv("APPHELM_API_KEY"), WorkspaceID: "org_…", ProductID: "prd_…",
	Release: os.Getenv("RELEASE"), Environment: "production", SessionMode: apphelm.SessionModeRequest})
```

Ruby:
```ruby
Apphelm.init(api_key: ENV["APPHELM_API_KEY"], workspace_id: "org_…", product_id: "prd_…",
             release: ENV["GIT_SHA"], environment: "production", release_health: :request)
```

PHP:
```php
$apphelm = new Client(apiKey: getenv('APPHELM_API_KEY'), workspaceId: 'org_…', productId: 'prd_…',
    release: getenv('APPHELM_RELEASE'), environment: 'production', sessionMode: 'request');
```

.NET (C#):
```csharp
builder.Services.AddApphelm(o => { o.Release = Environment.GetEnvironmentVariable("RELEASE"); o.Environment = "production"; o.SessionMode = SessionMode.Request; });
```

Rust:
```rust
let options = Options::new(key).workspace_id("org_…").product_id("prd_…").release(env!("CARGO_PKG_VERSION")).release_health(SessionMode::Request);
```

Elixir:
```elixir
config :apphelm, api_key: System.get_env("APPHELM_API_KEY"), workspace_id: "org_…", product_id: "prd_…",
  release: "my_app@1.4.0", environment: "production", session_mode: :request
```

A release is 1 to 120 characters, without control characters or leading or trailing spaces; an environment is up to 40 characters. The Android SDK fills the release in for you (`versionName+versionCode`, with `build` set to the version code), and the Laravel config reads `APPHELM_RELEASE` and takes the environment from `APP_ENV`. Elsewhere, pass it in yourself.

> **Name releases so they sort:** When both releases parse as semantic versions (`2.4.1`, `shop@2.4.1+87`), AppHelm orders them by version; otherwise by when it first saw each one. Ordering decides which release counts as "newer" for regressions. `apphelm releases propose-version` prints a commit SHA from your CI environment (or `git rev-parse HEAD`) if you'd rather use SHAs.

## Sessions

Release health counts **sessions**: one run of your app, one page load, or one request on a server. An SDK sends a `$session` when a session starts, and the errors in that session carry its id, so AppHelm knows how the session ended. Sessions need a `release`; without one nothing is counted.

| Platform | When a session starts and ends | Options (default) |
| --- | --- | --- |
| Browser | One per page load in a tab (reloads in the same tab are one session) | `releaseHealth` (**off**), plus `release`, error capture and analytics consent |
| React Native | At start, and when the app returns after the interval in the background | `enableAutoSessionTracking` (on), `sessionTrackingIntervalMillis` (30,000). `startSession()`, `endSession()` |
| iOS | On foreground; ends after the interval in the background. One per launch on macOS | `enableAutoSessionTracking` (on), `sessionTrackingIntervalSeconds` (30). `startSession()`, `endSession()` |
| Android | When the process comes to the foreground; ends after the timeout in the background | `startSessions` (on), `sessionTimeoutMs` (30,000) |
| Flutter | At launch, and on return after the interval | `enableAutoSessionTracking` (on), `sessionTrackingInterval` (30 s). `startSession()`, `endSession()` |
| Kotlin JVM | Process or request mode for servers; or call `appForegrounded()` / `appBackgrounded()` for an app | `sessionMode` (off): `SessionMode.PROCESS` or `REQUEST` |
| Python | `"process"`: one per process; `"request"`: one per request in the framework integrations | `release_health` (off). `capture_session(…)` |
| Ruby | `:process` or `:request` (Rack and Rails) | `release_health:` (off) |
| Go | Process, or per request through `client.Middleware` | `SessionMode` (off): `SessionModeProcess`, `SessionModeRequest` |
| PHP | `'process'` or `'request'` | `sessionMode` / `session_mode` (off). `startSession()` |
| .NET | Process, or per request through `UseApphelm` | `SessionMode` (`Off`): `Process`, `Request`. `StartSession()` |
| Rust | Process, or per request through `ApphelmLayer` | `.release_health(SessionMode::Process \| Request)` (off) |
| Elixir | Process, or per request through `Apphelm.Plug` | `session_mode:` (off): `:process`, `:request` |
| Node | Not supported | — |

Request mode sends one extra event per request, so it counts against your event allowance. Process mode suits workers, CLIs and daemons.

An exception that carries a session id and a release also opens or updates that session, even if its `$session` event never arrived.

### Session statuses

Each session ends in exactly one status. A session only moves **up** this list: a milder signal later in the same session never lowers it.

| Status | Meaning | What causes it |
| --- | --- | --- |
| `ok` | Healthy | No error reached AppHelm from the session |
| `errored` | At least one handled error | `captureException` and other handled errors (messages don't count) |
| `unhandled` | An unhandled error the app lived through | In the browser, an error that reached the page's global handlers |
| `abnormal` | Killed in a way that isn't a crash | An ANR on Android, a fatal app hang on iOS |
| `crashed` | An unhandled error that ended the app, or a native crash | Uncaught exceptions on mobile and servers, crash reports, watchdog terminations |

Any unhandled exception outside the browser marks its session crashed, including a non-fatal unhandled error in React Native. ANRs and fatal app hangs also record why they were abnormal: `anr_foreground` or `anr_background`. See [Crashes, ANRs and app hangs](https://apphelm.dev/docs/mobile-crashes#how-crashes-show-up).

## How the rates are computed

All figures cover sessions that **started** in the chosen window (1 to 90 days, 14 by default), optionally in one environment. Users are counted by a hash of the user id (or the device's distinct id); sessions without one don't count toward user figures.

| Figure | Formula | Shown when |
| --- | --- | --- |
| Crash-free sessions | 1 − crashed sessions ÷ all sessions | At least 10 sessions |
| Crash-free users | 1 − users with a crashed session ÷ all users | At least 10 users |
| Unhandled rate | Unhandled sessions ÷ all sessions (and the same for users) | At least 10 sessions (users) |
| ANR rate | Users with an abnormal session marked `anr_foreground` or `anr_background` ÷ all users | At least 10 users |
| Foreground ANR rate | The same, counting `anr_foreground` only | At least 10 users |
| Adoption | This release's sessions ÷ all of the product's sessions in the window (and the same for users) | Always |

Rates are percentages with two decimals. **Crash-free rates count crashed sessions only**: errored, unhandled and abnormal sessions are shown beside them, not as crashes. Sentry's "errored" figure equals AppHelm's errored plus unhandled.

## The Releases tab

**Reliability → Issues → Releases** lists up to 50 releases, newest first, for 24 hours or 7, 14, 30 or 90 days, with an environment filter. Each row shows adoption, crash-free sessions and users, sessions, new issues, regressed issues and when it was deployed.

Open a release for:

- Adoption, crash-free sessions ("x of y crashed") and crash-free users.
- Abnormal, unhandled and errored sessions, and the ANR rate when there are ANRs.
- A session outcomes table (sessions, share and users per status) and sessions per day.
- A breakdown by environment, when there is more than one.
- Deploys, new issues and regressed issues (25 each, by events), commits, and links to the previous and next release.

**Compare two releases** shows each figure side by side, the change in percentage points, sessions per day for both, and the issues seen in the newer release but not the older one.

## Create releases, commits and deploys from CI

You don't have to create releases: the first event or session creates one. Create them from CI when you want commits, deploy times and a release date on record.

### With the AppHelm CLI

```bash
export APPHELM_API_KEY=ahl_live_…   # a server key with events:write
export APPHELM_PRODUCT_ID=prd_…

VERSION=$(apphelm releases propose-version)
apphelm releases new "$VERSION" --ref main --url https://github.com/acme/shop/releases/tag/v2.4.1
apphelm releases set-commits "$VERSION" --auto --count 50
apphelm releases finalize "$VERSION"
apphelm deploys new --release "$VERSION" --env production --url https://ci.example.com/runs/812
```

| Command | Does |
| --- | --- |
| `releases new <version> [--ref] [--url] [--finalize]` | Creates the release (or updates the fields you pass) |
| `releases finalize <version> [--released <ISO time>]` | Sets the release date (default now) |
| `releases set-commits <version> --auto [--count 20]` | Records the last `--count` commits (1–1,000) from `git log` |
| `releases set-commits <version> --commit <sha>[,<sha>…]` | Records the commits you name |
| `releases list [--query] [--status open\|archived\|all] [--limit 25] [--json]` | Lists releases with their health |
| `releases info <version> [--json]` | One release |
| `releases archive <version>`, `releases restore <version>` | Archives or restores it |
| `releases delete <version>` | Deletes it, if nothing refers to it |
| `releases propose-version [--json]` | Prints a version from CI variables (`GITHUB_SHA`, `CI_COMMIT_SHA` and others) or `git rev-parse HEAD`. Needs no key |
| `deploys new --release <v> --env <environment> [--url] [--name]` | Records a deploy. The commit SHA comes from `APPHELM_COMMIT_SHA`, `GITHUB_SHA`, `CF_PAGES_COMMIT_SHA` or `VERCEL_GIT_COMMIT_SHA` |
| `deploys list --release <v>` | The release's deploys (needs `issues:read`) |

Every command except `propose-version` needs `--product` or `APPHELM_PRODUCT_ID`.

### With the API

```bash
curl -X POST https://apphelm.dev/api/v1/releases \
  -H "Authorization: Bearer $APPHELM_API_KEY" -H "Content-Type: application/json" \
  --data '{"productId":"prd_…","version":"web@2.4.1","ref":"main","dateReleased":"now","commits":[{"id":"3f2a9c1e…","message":"Fix checkout total","author_name":"Ada"}]}'

curl -X POST https://apphelm.dev/api/v1/deploys \
  -H "Authorization: Bearer $APPHELM_API_KEY" -H "Content-Type: application/json" \
  --data '{"productId":"prd_…","release":"web@2.4.1","environment":"production","commitSha":"3f2a9c1"}'
```

| Method | Path | Scope | Notes |
| --- | --- | --- | --- |
| `GET` | `/api/v1/releases` | `issues:read` | `productId`, `days` (1–90), `environment`, `q`, `status` (`open`, `archived`, `all`), `limit`, `cursor` |
| `POST` | `/api/v1/releases` | `events:write` | `version` (required), `ref`, `url` (https), `dateReleased` (ISO or `"now"`), `commits` (up to 1,000). `201` when created, `200` when it existed |
| `GET` | `/api/v1/releases/{version}` | `issues:read` | URL-encode the version. Health, deploys, commits; `commits=false` skips the commit lookup |
| `PATCH` | `/api/v1/releases/{version}` | `events:write` | `dateReleased`, `ref`, `url`, `commits` (replaces the list), `status: "archived"` or `"open"` |
| `DELETE` | `/api/v1/releases/{version}?productId=` | `events:write` | `409 release_in_use` when events still name it |
| `POST` | `/api/v1/deploys` | `events:write` | `release` (required), `environment` (default `production`), `commitSha` (7–40 hex), `url`, `deployedAt` (the last 30 days to 1 day ahead), `note` |

Commits keep the SHA, the first line of the message (scrubbed, 200 characters), the author's name and the time; never the author's email, and not the changed files. A deploy is recorded once per release and environment: sending it again answers `200` with `replayed: true` and keeps the first commit. Up to 20 deploys per product an hour are accepted. Full schemas are in the [API reference](https://apphelm.dev/docs/api).

### With sentry-cli

```bash
export SENTRY_URL=https://apphelm.dev SENTRY_AUTH_TOKEN=ahl_live_… SENTRY_ORG=any SENTRY_PROJECT=prd_…
sentry-cli releases new 2.4.1
sentry-cli releases set-commits 2.4.1 --auto
sentry-cli releases finalize 2.4.1
sentry-cli deploys new --release 2.4.1 -e production
```

`releases new`, `finalize`, `set-commits`, `list`, `archive`, `restore` and `delete`, and `deploys new`, work. AppHelm lists no repositories to sentry-cli, so `set-commits --auto` reads your local git log. A sentry-cli deploy takes the release's last recorded commit as its SHA, so run `set-commits` first. `SENTRY_PROJECT` can also be the product's project number or slug.

### Finalize, archive and delete

- **Finalize** only records the release date. It doesn't change how sessions or errors are counted.
- **Archive** hides a release from `GET /api/v1/releases`, `apphelm releases list` and sentry-cli's list. Its events, issues, sessions and deploys are untouched, and it still appears in the Releases tab. **Restore** brings it back. Archiving a release AppHelm doesn't know is a `404`.
- **Delete** removes the release, its deploys and recorded commits, but only when no issue, error event, session or transaction names it (`409 release_in_use` otherwise, with what refers to it). Source maps and symbols for it expire on their own.

## Suspect commits

When an issue first appears (or regresses) in a release, AppHelm can point at the commits that most likely caused it. Open the issue: suspect commits load with it.

They need:

1. **A GitHub connection** for the workspace, under Roadmap evidence → Project trackers (up to 3 repositories are tried).
2. **Deploys with commit SHAs**: one for the issue's release, and an earlier deploy of a different commit to the same environment.
3. **A stack that names your own files**: source-mapped, retraced or symbolicated where needed.

AppHelm asks GitHub for the commits between the two deploys (up to 100), keeps those that changed a file in the top five in-app frames, and shows up to 10, most matching files first, then newest. Each shows the SHA, author, message, files and a link; the author can be suggested as the assignee. Results are cached per issue, and each workspace makes at most 60 GitHub lookups an hour.

The commit list on a release uses the same comparison. Commits sent with `set-commits` are kept on the release record, but suspect commits and the release's commit list come from GitHub, not from them.

| Shown instead | Why | What to do |
| --- | --- | --- |
| `no_release` | The issue's events carry no release | Set `release` in the SDK |
| `no_deploy`, `no_commit` | No deploy for that release, or one without a SHA | Record deploys with `commitSha` (or the CI variables the CLI reads) |
| `no_previous_deploy` | Nothing earlier to compare with in that environment | It appears from the second deploy on |
| `no_integration` | No GitHub connection | Connect GitHub under Roadmap evidence → Project trackers |
| `no_files` | The stack names no files of yours | Upload source maps or symbols |

## Regressions

A **regression** is a resolved issue that comes back.

- An issue resolved plainly reopens on its next event.
- An issue resolved **in next release** reopens only for an event from a release newer than the one it was resolved in: by version when both releases parse as semantic versions, otherwise by when AppHelm first saw each release. A release AppHelm has never seen counts as newer.

On reopening, AppHelm records when it regressed and in which release and environment. The Releases tab counts it as a regressed issue of that release, and an [alert rule](https://apphelm.dev/docs/alerts) on regressions can notify you. Resolve in next release from the issue, with `apphelm issues resolve <id> --in-next-release`, or with `POST /api/v1/issues/{id}` and `{"status":"resolved","inNextRelease":true}`; see [Errors and issues](https://apphelm.dev/docs/errors#statuses).

## Alert on release health

A [metric alert](https://apphelm.dev/docs/alerts) on **Crash-free sessions** (`crash_free_rate`) fires when the product's crash-free rate over a window (5 to 1,440 minutes) goes below your threshold. It is product-wide (optionally per environment), not per release, and needs at least 10 sessions in the window. There are no alerts on crash-free users, ANR rate or adoption yet.

## Limits and retention

| What | Limit |
| --- | --- |
| Window | 1 to 90 days |
| Releases listed | 50 in the tab |
| Issues per list | 25 new and 25 regressed |
| Commits shown | 100 per release |
| Recorded commits | 1,000 per release (300 kept when they exceed 400 KB) |
| Deploys | One per release and environment; 20 per product an hour |
| Sessions kept | Your plan's capture retention |

Not supported today: server-side session aggregates from Sentry SDKs (they are dropped), sessions from the Node SDK, a browser session timeout or manual browser session calls, session duration, and `dist` (release health ignores it).

## Best practices

- **One release string per build**, shared by the SDK, source map and symbol uploads, and deploys.
- **Record deploys with their commit SHA** from CI. That one step gives you deploy markers and suspect commits.
- **Use "resolve in next release"** for fixes that ship in a build, so old builds still in use don't reopen the issue.
- **Turn on sessions on servers deliberately**: process mode is cheap; request mode costs an event per request.
- **Wait for 10 sessions or users** before reading a rate; below that AppHelm withholds it.

## Troubleshooting

| Symptom | Likely cause | What to do |
| --- | --- | --- |
| A release shows no sessions | No `release`, or sessions are off | Set `release`; turn on `releaseHealth` in the browser or a session mode on servers |
| Rates show as blank | Fewer than 10 sessions or users | Wait for more traffic, or widen the window |
| Crash-free users is blank but sessions has a value | Sessions carry no user hash | Identify users, or check that the SDK sends a distinct id |
| Browser errors don't lower crash-free sessions | Browser errors are `unhandled`, not crashes | Expected; see the unhandled rate |
| An ANR doesn't lower crash-free sessions | ANRs are `abnormal` | Expected; see the ANR rate |
| A resolved issue reopened for an old build | It was resolved plainly | Resolve it in next release |
| An archived release still shows in the tab | Archiving only hides it from lists in the API and CLI | Expected today |
| No suspect commits | See the table in [Suspect commits](#suspect-commits) | Follow the reason shown |
| `409 release_in_use` on delete | Issues, events or sessions still name it | Archive it instead |
