NewRelic

How to integrate NewRelic with Asayer and see backend errors alongside session replays.

1. Create Query Key

  1. Login to your NewRelic account.
  2. In the top left, select the INSIGHTS dashboard.
  3. In the INSIGHTS dashboard, go to "Manage Data" then select API Keys.
  4. Click on the + button of Query Keys.

NewRelic API Keys

  1. In the Notes put asayer.
  2. Copy the Account ID and the Key.
  3. Click on Save your notes.

NewRelic Query Key

2. Enable NewRelic in Asayer

Paste your Application ID and Key in Asayer dashboard under Preferences > Integrations.

NewRelic Integration in Asayer

3. Propagate asayerSessionId

To link a NewRelic event with the recorded user session, a unique id has to be propagated from your frontend to your backend on each request you want to track. This can be done using a custom HTTP header. In the below example, we use the fetch function to send that header.

const headers = {
Accept: 'application/json',
'Content-Type': 'application/json',
};
if (window.asayer && window.asayer.id()) {
headers['X-Session-Id'] = window.asayer.id(); // Inject asayer_session_id
}
fetch('www.your-backend.com', {
'GET',
headers,
});

In order for Asayer to associate a NewRelic log entry with the recorded user session, a unique id has to be propagated as a custom_parameter to each backend error you wish to track.

Below is an example in NewRelic's Python API.

newrelic.agent.add_custom_parameter("asayer_session_id", ASAYER_SESSION_ID)

The name of the tag asayer_session_id is case sensitive.