Rollbar

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

1. Create Project Access Tokens

  1. Login to your Rollbar account.
  2. Select your project from the dropdown (top left).
  3. Go to Settings > Project Access Tokens.
  4. Click on Create new access tokens.

Rollbar Project Access Tokens

  1. In the Scope select read; in name put asayer; and leave the Rate Limit to default.
  2. Copy your new token.

Rollbar Active Token

2. Enable Rollbar in Asayer

Paste your Access Token in Asayer dashboard under Preferences > Integrations.

Rollbar Integration in Asayer

3. Propagate asayerSessionId

To link a Rollbar 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 Rollbar log entry with the recorded user session, a unique id has to be propagated as an extra_data to each backend error you wish to track.

Below is an example in Rollbar's Python API.

rollbar.report_message("A LOG ENTRY", level='error', extra_data={"asayerSessionId": ASAYER_SESSION_ID})
# or if you are catching the exceptions
rollbar.report_exc_info(sys.exc_info(), level='error', extra_data={"asayerSessionId": str(ASAYER_SESSION_ID)})

The name of the tag asayerSessionId is case sensitive;