Syntax
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
Browser Pro or Pro+SPA agent (v1016 or higher)
If you're using npm to install the browser agent, you must enable the
jserrors
feature when instantiating theBrowserAgent
class. In thefeatures
array, add the following:import { JSErrors } from '@newrelic/browser-agent/features/jserrors';const options = {info: { ... },loader_config: { ... },init: { ... },features: [JSErrors]}For more information, see the npm browser installation documentation.
Description
In , 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 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 browser monitoring 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, browser monitoring does not require any additional information to identify your release. For example, some frontend 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 |
---|---|
string | Required. A short description of the component; for example, the name of a project, application, file, or library. |
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 The
|
Examples
Current short SHA
newrelic.addRelease('checkout page', 'a818994')
Semantic versioning
newrelic.addRelease('jquery.min.js', 'v3.1.1')