• /
  • EnglishEspañol日本語한국어Português
  • ログイン今すぐ開始

addRelease

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

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

$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'

Examples

Current short SHA

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

Semantic versioning

newrelic.addRelease('jquery.min.js', 'v3.1.1')
Copyright © 2024 New Relic株式会社。

This site is protected by reCAPTCHA and the Google Privacy Policy and Terms of Service apply.