diff --git a/packages/rum-core/src/domain/assembly.spec.ts b/packages/rum-core/src/domain/assembly.spec.ts index d3f8960d18..ffbc02b6cc 100644 --- a/packages/rum-core/src/domain/assembly.spec.ts +++ b/packages/rum-core/src/domain/assembly.spec.ts @@ -712,7 +712,7 @@ describe('rum assembly', () => { it('should include the configured sample rates', () => { const { lifeCycle } = setupBuilder.build() notifyRawRumEvent(lifeCycle, { - rawRumEvent: createRawRumEvent(RumEventType.VIEW), + rawRumEvent: createRawRumEvent(RumEventType.ACTION), }) expect(serverRumEvents[0]._dd.configuration).toEqual({ session_replay_sample_rate: 0, @@ -728,7 +728,7 @@ describe('rum assembly', () => { }) .build() notifyRawRumEvent(lifeCycle, { - rawRumEvent: createRawRumEvent(RumEventType.VIEW), + rawRumEvent: createRawRumEvent(RumEventType.ACTION), }) expect(serverRumEvents[0]._dd.configuration).toEqual({ session_sample_rate: 1.234, diff --git a/packages/rum-core/src/domain/view/viewCollection.spec.ts b/packages/rum-core/src/domain/view/viewCollection.spec.ts index 44e917236c..bcd85ec41c 100644 --- a/packages/rum-core/src/domain/view/viewCollection.spec.ts +++ b/packages/rum-core/src/domain/view/viewCollection.spec.ts @@ -116,6 +116,9 @@ describe('viewCollection', () => { { start: 0 as ServerDuration, state: PageState.ACTIVE }, { start: 10 as ServerDuration, state: PageState.PASSIVE }, ], + configuration: { + start_session_replay_recording_manually: jasmine.any(Boolean), + }, }, date: jasmine.any(Number), type: RumEventType.VIEW, @@ -228,4 +231,23 @@ describe('viewCollection', () => { expect(rawRumViewEvent.display?.scroll).toBeUndefined() }) + + it('should include configuration.start_session_replay_recording_manually value', () => { + let { lifeCycle, rawRumEvents } = setupBuilder + .withConfiguration({ startSessionReplayRecordingManually: false }) + .build() + lifeCycle.notify(LifeCycleEventType.VIEW_UPDATED, VIEW) + expect( + (rawRumEvents[rawRumEvents.length - 1].rawRumEvent as RawRumViewEvent)._dd.configuration + .start_session_replay_recording_manually + ).toBe(false) + ;({ lifeCycle, rawRumEvents } = setupBuilder + .withConfiguration({ startSessionReplayRecordingManually: true }) + .build()) + lifeCycle.notify(LifeCycleEventType.VIEW_UPDATED, VIEW) + expect( + (rawRumEvents[rawRumEvents.length - 1].rawRumEvent as RawRumViewEvent)._dd.configuration + .start_session_replay_recording_manually + ).toBe(true) + }) }) diff --git a/packages/rum-core/src/domain/view/viewCollection.ts b/packages/rum-core/src/domain/view/viewCollection.ts index cf4eff404a..192600c399 100644 --- a/packages/rum-core/src/domain/view/viewCollection.ts +++ b/packages/rum-core/src/domain/view/viewCollection.ts @@ -55,6 +55,9 @@ function processViewUpdate( document_version: view.documentVersion, replay_stats: replayStats, page_states: pageStates, + configuration: { + start_session_replay_recording_manually: configuration.startSessionReplayRecordingManually, + }, }, date: view.startClocks.timeStamp, type: RumEventType.VIEW, diff --git a/packages/rum-core/src/rawRumEvent.types.ts b/packages/rum-core/src/rawRumEvent.types.ts index 8b94d968b9..8290e99a43 100644 --- a/packages/rum-core/src/rawRumEvent.types.ts +++ b/packages/rum-core/src/rawRumEvent.types.ts @@ -119,6 +119,9 @@ export interface RawRumViewEvent { document_version: number replay_stats?: ReplayStats page_states?: PageStateServerEntry[] + configuration: { + start_session_replay_recording_manually: boolean + } } } diff --git a/packages/rum-core/test/fixtures.ts b/packages/rum-core/test/fixtures.ts index 864995618a..76a26db043 100644 --- a/packages/rum-core/test/fixtures.ts +++ b/packages/rum-core/test/fixtures.ts @@ -93,6 +93,9 @@ export function createRawRumEvent(type: RumEventType, overrides?: Context): RawR type, _dd: { document_version: 0, + configuration: { + start_session_replay_recording_manually: false, + }, }, date: 0 as TimeStamp, view: {