SumoLogic
How to integrate SumoLogic with OpenReplay and see backend errors alongside session recordings.
1. Create a new Access ID and Access Key
- Login to your SumoLogic account.
- Go to the Access Keys page.
- Click on + Add Access Key.
- In the name put "openreplay" and click on Create Key.
- Copy the new
Access ID
andAccess Key
as we need them for our integration. - Click on Done.
For more information about creating an Access ID and Access Key, please refer to this documentation.
2. Enable SumoLogic in OpenReplay
Put your Access ID
and Access Key
in OpenReplay dashboard under 'Preferences > Integration'.
3. Propagate openReplaySessionToken
To link a SumoLogic 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 snippetheaders['X-OpenReplay-SessionToken'] = tracker.getSessionToken(); // Inject openReplaySessionToken}fetch('www.your-backend.com', {'GET',headers,});
In order for OpenReplay to associate a SumoLogic message with the recorded user session, a unique token has to be propagated as part of each backend error you wish to track.
Below is an example in Python using Monkey Patching.
import sysimport traceback#...old_tb = traceback.print_exceptionold_f = sys.stdoutold_e = sys.stderrOPENREPLAY_SESSION_TOKEN = Noneclass F:def write(self, x):if OPENREPLAY_SESSION_TOKEN is not None and x != '\n':old_f.write(f"[openReplaySessionToken={OPENREPLAY_SESSION_TOKEN}] {x}")else:old_f.write(x)def flush(self):passdef tb_print_exception(etype, value, tb, limit=None, file=None, chain=True):if OPENREPLAY_SESSION_TOKEN is not None:value = type(value)(f"[openReplaySessionToken={OPENREPLAY_SESSION_TOKEN}] " + str(value))old_tb(etype, value, tb, limit, file, chain)traceback.print_exception = tb_print_exceptionsys.stderr = F()
The name of the tag openReplaySessionToken
is case sensitive.
Troubleshooting
If you encounter any issues, connect to our Slack and get help from our community.