Sentry Release and Deploy Tracking: Linking Errors to Deploys for Regression Detection
Configure Sentry SDK release identifiers and CI/CD deploy events so errors group by release, regressions surface automatically, and release health metrics reflect your environments.
14 Sept 2025, 23:42 UTC

The Problem: Error Spikes After a Deploy
When a new build reaches production and the error rate climbs, the first question is whether the release introduced a regression or whether the spike is unrelated. Sentry can answer that only if your application reports a release identifier at initialization and your pipeline sends matching deploy events. Without both, errors sit in an undifferentiated stream, the Releases page stays empty, and release health metrics never populate.
Desired Outcome
By the end of this setup, every error event captured by the SDK carries a release tag, the Releases page lists each deploy with its environment and timestamp, and the Release Health dashboard shows error-free or crash-free rates for that environment. Sentry will also flag regressions automatically when an error appears for the first time in a given release after existing in earlier ones.
Prerequisites
- A Sentry project with its DSN.
- Sentry CLI installed in your CI/CD runner, or a server-side SDK integration capable of sending deploy events.
- A consistent version string for each build, such as a semantic version or Git commit SHA.
- Agreed-upon environment names (for example,
production,staging) used identically in SDK init and deploy commands.
Initialize the SDK with a Release Identifier
A release identifier is the version string you assign to a build. Pass it to the SDK at initialization so Sentry can group events by release. The exact option name varies slightly by SDK, but the concept is the same.
Sentry.init({
dsn: "https://[contact removed]/0",
release: "my-app@1.4.2",
environment: "production",
});
If your application is client-side, remember that the release string is visible to users. Avoid embedding internal build metadata that could expose infrastructure details.
Register Commits and Deploy Events in CI
Set Commits
Associating commits with a release helps Sentry suggest suspect commits when a regression appears. Run this in your CI job after the repository is checked out.
sentry-cli releases set-commits "my-app@1.4.2" --auto
- Where to run: CI pipeline, after checkout and before or after build.
- Permissions: A Sentry auth token with release management permissions.
- Placeholder: Replace
my-app@1.4.2with your release identifier. - Expected check: The release page in Sentry lists associated commits.
- Risk: If the release identifier does not match the SDK value exactly, commits attach to the wrong release or none at all.
Send the Deploy Event
A deploy event tells Sentry that a specific release is live in a specific environment. This populates the Releases page and starts release health tracking for that environment.
sentry-cli releases deploys "my-app@1.4.2" new -e production
- Where to run: CI/CD deploy step, after the release artifact is live.
- Permissions: Same auth token as above.
- Placeholder: Replace the release string and
productionwith your values. - Expected check: The deploy appears on the Releases page with the correct environment and timestamp.
- Risk: Frequent deploys without finalizing the release can leave incomplete records and skew regression detection. If your workflow creates many short-lived releases, finalize them explicitly.
sentry-cli releases finalize "my-app@1.4.2"
Verify the Connection in Sentry
After the next event flows through the SDK, open the issue details page in Sentry and confirm the release tag matches your identifier. Then trigger a controlled error after a deploy and check that Sentry attributes it to the correct release and marks it as a regression if it has appeared in earlier releases. Finally, open Release Health for the target environment and confirm that error-free or crash-free rates update as traffic arrives.
Expected Checks
| Check | How to verify |
|---|---|
| Release tag on events | Issue details page shows the release identifier |
| Commits linked | Releases page lists commits for the release |
| Deploy recorded | Releases page shows the deploy with environment and time |
| Regression flagged | New error in a release is marked as a regression |
| Health metrics update | Release Health dashboard shows rates for the environment |
Recovery Options and Limitations
If release identifiers are mismatched, the SDK continues sending events under the incorrect string until you redeploy with the corrected value. Sentry does not retroactively relabel existing events. If environment names are inconsistent, future deploys with standardized names will populate the correct view, but historical data remains fragmented across separate environment records.
You can delete a release in the Sentry UI if it was created in error, but this removes its deploy history and health aggregates and is destructive. Use it only when the release record is genuinely unwanted.
Release health counts depend on the events that actually reach Sentry. before-send callbacks that discard events, or aggressive sampling, will cause metrics to undercount errors. Review your SDK configuration if health rates look implausibly high.
Finally, CLI flags and dashboard layouts evolve. Verify current command syntax and UI locations against Sentry's current documentation before relying on this procedure in production.
0 replies
A thoughtful contribution can make all the difference. Be the first to share one.