addRelease

newrelic.addRelease(string $release_name, string $release_id)
Adds a unique name and ID to identify releases with multiple JavaScript bundles on the same page.

Requirements

Agent version nr-1016 or higher.

Description

In New Relic Browser, a release is a way to tag errors with information about what version of your application is currently running. This is useful for sites where shared components are owned by different teams, or multiple applications are deployed independently but run on the same page.

Modern web applications have many interconnecting parts, so an application may have multiple releases (with different names) associated with the same page load. For example, you can use releases to:

  • See differences between errors from an old cached version of your app and errors coming from a new version.
  • Identify problems found during A/B testing, slow rollouts, feature flags, and other advanced deployment methods.
  • Determine which version of a New Relic Browser source map to use.

If the URL for your JavaScript is not unique, you must specify a release name and identifier with this API call to the Browser agent. This information is also required when publishing source maps to the storage service. This API adds an ID for New Relic Browser to identify releases with multiple JavaScript bundles on the same page.

If the URL for your app's JavaScript bundle is unique each time you deploy your code, New Relic Browser does not require any additional information to identify your release. For example, some front end deployment tools use the Jenkins build number or git commit sha in the filename of the deployed code. These are enough to uniquely determine the release that caused the error.

As soon as possible after your page loads, call newrelic.addRelease(). All errors that the Browser agent sees will be associated with that version of the JavaScript code.

Parameters

Parameter Description

$release_name

string

Required. A short description of the component; for example, the name of a project, application, file, or library.

$release_id

string

Required. The ID or version of this release; for example, a version number, build number from your CI environment, GitHub SHA, GUID, or a hash of the contents. Since New Relic converts this value into a string, you can also use null or undefined if necessary.

The $release_name and $release_id combination must be unique; for example:

  • 'signup', '2.4.0'
  • 'signup', '2.4.1'

However, you can use the same version for different components; for example:

  • 'signup', '2.4.0'
  • 'logout', '2.4.0'

Example(s)

Current short SHA

newrelic.addRelease('checkout page', 'a818994')

Semantic versioning

newrelic.addRelease('jquery.min.js', 'v3.1.1')

For more help

Recommendations for learning more: