@multiplayer-app/session-recorder-node
Version:
Multiplayer Fullstack Session Recorder for Node.js
99 lines (72 loc) • 3.27 kB
Markdown
The Multiplayer **Session Recorder** is a powerful tool that offers deep session replays with insights spanning frontend screens, platform traces, metrics, and logs. It helps your team pinpoint and resolve bugs faster by providing a complete picture of your backend system architecture. No more wasted hours combing through APM data; the Multiplayer Session Recorder does it all in one place.
- **Reduced Inefficiencies**: Effortlessly capture the exact steps to reproduce an issue along with backend data in one click. No more hunting through scattered documentation, APM data, logs, or traces.
- **Faster Cross-Team Alignment**: Engineers can share session links containing all relevant information, eliminating the need for long tickets or clarifying issues through back-and-forth communication.
- **Uninterrupted Deep Work**: All system information—from architecture diagrams to API designs—is consolidated in one place. Minimize context switching and stay focused on what matters.
You can install the Session Recorder using npm or yarn:
```bash
npm install @multiplayer-app/session-recorder-node @multiplayer-app/session-recorder-opentelemetry
yarn add @multiplayer-app/session-recorder-node @multiplayer-app/session-recorder-opentelemetry
```
To initialize the Session Recorder in your application, follow the steps below.
```javascript
import SessionRecorder from '@multiplayer-app/session-recorder-node'
// Multiplayer trace id generator which is used during opentelemetry initialization
import { idGenerator } from './opentelemetry'
```
Use the following code to initialize the session recorder with your application details:
```javascript
SessionRecorder.init(
'{YOUR_API_KEY}',
idGenerator,
{
resourceAttributes: {
serviceName: '{YOUR_APPLICATION_NAME}'
version: '{YOUR_APPLICATION_VERSION}',
environment: '{YOUR_APPLICATION_ENVIRONMENT}',
}
}
)
```
Replace the placeholders with your application’s version, name, environment, and API key.
This library relies on the following packages:
- **[OpenTelemetry](https://opentelemetry.io/)**: Used to capture backend traces, metrics, and logs that integrate seamlessly with the session replays for comprehensive debugging.
```javascript
import SessionRecorder from '@multiplayer-app/session-recorder-node'
import { SessionType } from '@multiplayer-app/session-recorder-opentelemetry'
// Session recorder trace id generator which is used during opentelemetry initialization
import { idGenerator } from './opentelemetry'
SessionRecorder.init(
'{YOUR_API_KEY}',
idGenerator,
{
resourceAttributes: {
serviceName: '{YOUR_APPLICATION_NAME}'
version: '{YOUR_APPLICATION_VERSION}',
environment: '{YOUR_APPLICATION_ENVIRONMENT}',
}
}
)
// ...
await SessionRecorder.start(
SessionType.PLAIN,
{
name: 'This is test session',
sessionAttributes: {
accountId: '687e2c0d3ec8ef6053e9dc97',
accountName: 'Acme Corporation'
}
}
)
// do something here
await SessionRecorder.stop()
```