From 31e2eb889d8b0e3dd95206def5091efb222dac26 Mon Sep 17 00:00:00 2001 From: Dmytro Shvaika Date: Tue, 7 Oct 2025 16:19:49 +0300 Subject: [PATCH 1/3] feat: update browser README --- packages/session-recorder-browser/README.md | 80 ++++++++++++++++++--- packages/session-recorder-node/README.md | 1 - 2 files changed, 71 insertions(+), 10 deletions(-) diff --git a/packages/session-recorder-browser/README.md b/packages/session-recorder-browser/README.md index 21d8750..54d5f7a 100644 --- a/packages/session-recorder-browser/README.md +++ b/packages/session-recorder-browser/README.md @@ -50,6 +50,10 @@ yarn add @multiplayer-app/session-recorder-browser @opentelemetry/api ### Quick start +Use the following code below to initialize and run the session recorder. + +### Initialize + ```javascript import SessionRecorder from '@multiplayer-app/session-recorder-browser' @@ -71,15 +75,6 @@ SessionRecorder.setSessionAttributes({ userId: '12345', userName: 'John Doe' }) - -// optionally control via API (widget is enabled by default) -// if you're not using widget (see: `showWidget: true/false`) -// then you can programatically control the session recorder -// by using the methods below -SessionRecorder.start() -SessionRecorder.pause() -SessionRecorder.resume() -SessionRecorder.stop('Finished session') // optional: pass reason for stopping the session ``` ### Advanced config @@ -210,12 +205,79 @@ SessionRecorder.init({ headersToExclude: ['authorization', 'cookie'] } }) +``` + +### Manual session recording + +Below is an example showing how to create a session recording in `MANUAL` mode. Manual session recordings stream and save all the data between calling `start` and `stop`. +```javascript // add any key value pairs which should be associated with a session SessionRecorder.setSessionAttributes({ userId: '12345', userName: 'John Doe' }) +// optionally control via API (widget is enabled by default) +// if you're not using widget (see: `showWidget: true/false`) +// then you can programatically control the session recorder +// by using the methods below +SessionRecorder.start() +SessionRecorder.pause() +SessionRecorder.resume() +SessionRecorder.stop('Finished session') // optional: pass reason for stopping the session +``` + +### Continuous session recording + +Below is an example showing how to create a session in `CONTINUOUS` mode. Continuous session recordings **stream** all the data received between calling `start` and `stop` - +but only **save** a rolling window data (90 seconds by default) when: + +- an exception or error occurs; +- when `save` is called; or +- programmatically, when the auto-save attribute is attached to a span. + +```javascript +// add any key value pairs which should be associated with a session +SessionRecorder.setSessionAttributes({ + userId: '12345', + userName: 'John Doe' +}) +// optionally control via API (widget is enabled by default) +// if you're not using widget (see: `showWidget: true/false`) +// then you can programatically control the session recorder +// by using the methods below +SessionRecorder.start() + +// do something here + +SessionRecorder.save() + +// do something here + +SessionRecorder.save() + +SessionRecorder.stop('Finished session') // optional: pass reason for stopping the session +``` + +Continuous session recordings may also be saved from within any service or component involved in a trace by adding the attributes below to a span: + +```javascript +import { trace, context } from "@opentelemetry/api" +import SessionRecorder from "@multiplayer-app/session-recorder-node" + +const activeContext = context.active() + +const activeSpan = trace.getSpan(activeContext) + +activeSpan.setAttribute( + SessionRecorder.ATTR_MULTIPLAYER_CONTINUOUS_SESSION_AUTO_SAVE, + true +) +activeSpan.setAttribute( + SessionRecorder.ATTR_MULTIPLAYER_CONTINUOUS_SESSION_AUTO_SAVE_REASON, + "Some reason" +) + ``` ### Framework notes diff --git a/packages/session-recorder-node/README.md b/packages/session-recorder-node/README.md index 5f6e982..4e8bc5c 100644 --- a/packages/session-recorder-node/README.md +++ b/packages/session-recorder-node/README.md @@ -244,7 +244,6 @@ but only **save** a rolling window data (90 seconds by default) when: ```javascript - await sessionRecorder.start( SessionType.CONTINUOUS, { From cb638638f7719a84e7909f40ebac3c3fd1a90572 Mon Sep 17 00:00:00 2001 From: Dmytro Shvaika Date: Tue, 7 Oct 2025 16:20:52 +0300 Subject: [PATCH 2/3] fix: typo in README --- packages/session-recorder-browser/README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/session-recorder-browser/README.md b/packages/session-recorder-browser/README.md index 54d5f7a..5302694 100644 --- a/packages/session-recorder-browser/README.md +++ b/packages/session-recorder-browser/README.md @@ -263,7 +263,7 @@ Continuous session recordings may also be saved from within any service or compo ```javascript import { trace, context } from "@opentelemetry/api" -import SessionRecorder from "@multiplayer-app/session-recorder-node" +import SessionRecorder from "@multiplayer-app/debugger-browser" const activeContext = context.active() From 451b9440b105c7cd4fda287a91b11196f204e0a8 Mon Sep 17 00:00:00 2001 From: Dmytro Shvaika Date: Tue, 7 Oct 2025 16:26:17 +0300 Subject: [PATCH 3/3] fix: typo in README --- packages/session-recorder-browser/README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/session-recorder-browser/README.md b/packages/session-recorder-browser/README.md index 5302694..193b9e5 100644 --- a/packages/session-recorder-browser/README.md +++ b/packages/session-recorder-browser/README.md @@ -246,7 +246,7 @@ SessionRecorder.setSessionAttributes({ // if you're not using widget (see: `showWidget: true/false`) // then you can programatically control the session recorder // by using the methods below -SessionRecorder.start() +SessionRecorder.start(SessionType.CONTINUOUS) // do something here