Skip to content

Commit

Permalink
feat: send snapshot library
Browse files Browse the repository at this point in the history
  • Loading branch information
pauldambra committed Dec 8, 2024
1 parent 26e8ddd commit 3b5aa4d
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 0 deletions.
14 changes: 14 additions & 0 deletions src/__tests__/extensions/replay/sessionrecording.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -858,6 +858,7 @@ describe('SessionRecording', () => {
],
$session_id: sessionId,
$window_id: 'windowId',
$snapshot_library: 'web/ver/v0.0.1/script_name/recorder',
},
{
_url: 'https://test.com/s/',
Expand Down Expand Up @@ -893,6 +894,7 @@ describe('SessionRecording', () => {
{ type: 3, data: { source: 1 } },
{ type: 3, data: { source: 2 } },
],
$snapshot_library: 'web/ver/v0.0.1/script_name/recorder',
},
{
_url: 'https://test.com/s/',
Expand Down Expand Up @@ -973,6 +975,7 @@ describe('SessionRecording', () => {
$window_id: 'windowId',
$snapshot_data: [{ data: { source: 1 }, emit: 1, type: 3 }],
$snapshot_bytes: 39,
$snapshot_library: 'web/ver/v0.0.1/script_name/recorder',
},
{
_url: 'https://test.com/s/',
Expand Down Expand Up @@ -1580,6 +1583,7 @@ describe('SessionRecording', () => {
$session_id: firstSessionId,
$snapshot_bytes: 186,
$window_id: expect.any(String),
$snapshot_library: 'web/ver/v0.0.1/script_name/recorder',
},
{
_batchKey: 'recordings',
Expand Down Expand Up @@ -1670,6 +1674,7 @@ describe('SessionRecording', () => {
$session_id: firstSessionId,
$snapshot_bytes: 186,
$window_id: expect.any(String),
$snapshot_library: 'web/ver/v0.0.1/script_name/recorder',
},
{
_batchKey: 'recordings',
Expand All @@ -1696,6 +1701,7 @@ describe('SessionRecording', () => {
$session_id: firstSessionId,
$snapshot_bytes: 186,
$window_id: expect.any(String),
$snapshot_library: 'web/ver/v0.0.1/script_name/recorder',
},
{
_batchKey: 'recordings',
Expand Down Expand Up @@ -2116,6 +2122,7 @@ describe('SessionRecording', () => {
$session_id: sessionId,
$snapshot_bytes: expect.any(Number),
$window_id: 'windowId',
$snapshot_library: 'web/ver/v0.0.1/script_name/recorder',
},
captureOptions
)
Expand All @@ -2137,6 +2144,7 @@ describe('SessionRecording', () => {
$session_id: sessionId,
$snapshot_bytes: expect.any(Number),
$window_id: 'windowId',
$snapshot_library: 'web/ver/v0.0.1/script_name/recorder',
},
captureOptions
)
Expand Down Expand Up @@ -2166,6 +2174,7 @@ describe('SessionRecording', () => {
$session_id: sessionId,
$snapshot_bytes: expect.any(Number),
$window_id: 'windowId',
$snapshot_library: 'web/ver/v0.0.1/script_name/recorder',
},
captureOptions
)
Expand Down Expand Up @@ -2196,6 +2205,7 @@ describe('SessionRecording', () => {
$session_id: sessionId,
$snapshot_bytes: expect.any(Number),
$window_id: 'windowId',
$snapshot_library: 'web/ver/v0.0.1/script_name/recorder',
},
captureOptions
)
Expand All @@ -2215,6 +2225,7 @@ describe('SessionRecording', () => {
$session_id: sessionId,
$snapshot_bytes: 86,
$window_id: 'windowId',
$snapshot_library: 'web/ver/v0.0.1/script_name/recorder',
},
captureOptions
)
Expand All @@ -2239,6 +2250,7 @@ describe('SessionRecording', () => {
$session_id: sessionId,
$snapshot_bytes: 58,
$window_id: 'windowId',
$snapshot_library: 'web/ver/v0.0.1/script_name/recorder',
},
captureOptions
)
Expand All @@ -2262,6 +2274,7 @@ describe('SessionRecording', () => {
$session_id: sessionId,
$snapshot_bytes: 69,
$window_id: 'windowId',
$snapshot_library: 'web/ver/v0.0.1/script_name/recorder',
},
captureOptions
)
Expand Down Expand Up @@ -2308,6 +2321,7 @@ describe('SessionRecording', () => {
{ type: 3, data: { source: 1 } },
{ type: 3, data: { source: 2 } },
],
$snapshot_library: 'web/ver/v0.0.1/script_name/recorder',
},
expect.any(Object)
)
Expand Down
2 changes: 2 additions & 0 deletions src/extensions/replay/sessionrecording.ts
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,7 @@ import { MutationRateLimiter } from './mutation-rate-limiter'
import { gzipSync, strFromU8, strToU8 } from 'fflate'
import { clampToRange } from '../../utils/number-utils'
import { includes } from '../../utils'
import Config from '../../config'

const LOGGER_PREFIX = '[SessionRecording]'
const logger = createLogger(LOGGER_PREFIX)
Expand Down Expand Up @@ -1185,6 +1186,7 @@ export class SessionRecording {
$snapshot_data: snapshotBuffer.data,
$session_id: snapshotBuffer.sessionId,
$window_id: snapshotBuffer.windowId,
$snapshot_library: `web/ver/${Config.LIB_VERSION}/script_name/${this.scriptName}`,
})
})
}
Expand Down

0 comments on commit 3b5aa4d

Please sign in to comment.