New Relic
How to integrate New Relic with OpenReplay and see backend errors alongside session recordings.
1. Create Query Key
Section titled 1. Create Query Key- Login to your New Relic account.
- In the top left, select the INSIGHTS dashboard.
- In the INSIGHTS dashboard, go to “Manage Data” then select API Keys.
- Click on the + button of Query Keys.
- In the Notes put
openreplay
. - Copy the
Account ID
and theKey
. - Click on Save your notes.
2. Enable NewRelic in OpenReplay
Section titled 2. Enable NewRelic in OpenReplayPaste your Application ID
and Key
in OpenReplay dashboard under ‘Preferences > Integration’.
3. Propagate openReplaySessionToken
Section titled 3. Propagate openReplaySessionTokenTo link a New Relic event with the recorded user session, a unique token 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 (tracker.getSessionToken()) { // or window.OpenReplay instead of tracker if you're using the snippet
headers['X-OpenReplay-SessionToken'] = tracker.getSessionToken(); // Inject openReplaySessionToken
}
fetch('www.your-backend.com', {
'GET',
headers,
});
In order for OpenReplay to associate a New Relic log entry with the recorded user session, a unique token 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("openReplaySessionToken", OPENREPLAY_SESSION_TOKEN)
The name of the tag openReplaySessionToken
is case sensitive.
Have questions?
Section titled Have questions?If you encounter any issues, connect to our Slack and get help from our community.