Releases & Health

A release is a version of your code that is deployed to an environment. When you give Sentry information about your releases, you can:

  • Determine issues and regressions introduced in a new release
  • Predict which commit caused an issue and who is likely responsible
  • Resolve issues by including the issue number in your commit message
  • Receive email notifications when your code gets deployed

Additionally, releases are used for applying source maps to minified JavaScript to view original, untransformed source code.

Bind the Version

Include a release ID (often called a "version") when you configure your client SDK. This ID is commonly a git SHA or a custom version number.

The release name cannot:

  • contain newlines, tabulator characters, forward slashes(/) or back slashes(\)
  • be (in their entirety) period (.), double period (..), or space ( )
  • exceed 200 characters
Copied
Sentry.init({
  release: "my-project-name@2.3.12",
});

A common way to do this with would be to use the process.env.npm_package_version like so:

Copied
Sentry.init({
  release: "my-project-name@" + process.env.npm_package_version,
});

How you make the version available to your code is up to you. For example, you could use an environment variable that is set during the build process.

This tags each event with the release value. We recommend that you tell Sentry about a new release before deploying it, as this will unlock a few more features as discussed in our documentation about releases. But if you don’t, Sentry will automatically create a release entity in the system the first time it sees an event with that release ID.

After configuring your SDK, you can install a repository integration or manually supply Sentry with your own commit metadata. Read our documentation about setting up releases for further information about integrations, associating commits, and telling Sentry when deploying releases.

Release Health

Monitor the health of releases by observing user adoption, usage of the application, percentage of crashes, and session data. Release health will provide insight into the impact of crashes and bugs as it relates to user experience, and reveal trends with each new issue through the release details, graphs, and filters.

The SDK will automatically manage the start and end of the sessions when the SDK is initialized.

Release health on the server side is tracked in two different modes:

  • Single sessions that represent a node process; for example, a CLI application. In single sessions mode, the SDK creates a session for every node process. A session is started on init of the SDK, and ends when the process is exited.
  • Session aggregates represent requests. In session aggregates mode, sessions will be recorded differently and will represent the lifetime of requests. For the SDK to be able to capture request mode sessions, you must enable the requestHandler of the express middleware.
Copied
// The request handler must be the first middleware on the app
app.use(Sentry.Handlers.requestHandler());

The SDK automatically determines which mode Release Health will operate in. By default, the SDK runs in single sessions mode. However, if the requestHandler express middleware is enabled, Release Health is automatically toggled to session aggregates mode. If the requestHandler express middleware is not enabled, session aggregates mode will not be enabled and sessions will represent the health of the web server application process if, for example, a web server application is being run.

We mark the session as crashed if an unhandled error reached our errorHandler middleware.

We mark the session as an error if the SDK captures an event that contains an exception (this includes manually captured exceptions).

By default, the JavaScript SDKs are sending sessions, to disable this toggle the flag autoSessionTracking to false:

Copied
Sentry.init({
  autoSessionTracking: false // default: true
});
Help improve this content
Our documentation is open source and available on GitHub. Your contributions are welcome, whether fixing a typo (drat!) to suggesting an update ("yeah, this would be better").