Skip to content

Commit

Permalink
Merge bb31a9d in staging-43
Browse files Browse the repository at this point in the history
Co-authored-by: Bastien Caudan <[email protected]>
  • Loading branch information
dd-mergequeue[bot] and bcaudan authored Oct 25, 2023
2 parents 526515f + bb31a9d commit 9e34d3d
Show file tree
Hide file tree
Showing 8 changed files with 60 additions and 10 deletions.
4 changes: 2 additions & 2 deletions packages/rum-core/src/domain/assembly.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand All @@ -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,
Expand Down
22 changes: 22 additions & 0 deletions packages/rum-core/src/domain/view/viewCollection.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down Expand Up @@ -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)
})
})
3 changes: 3 additions & 0 deletions packages/rum-core/src/domain/view/viewCollection.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down
3 changes: 3 additions & 0 deletions packages/rum-core/src/rawRumEvent.types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -119,6 +119,9 @@ export interface RawRumViewEvent {
document_version: number
replay_stats?: ReplayStats
page_states?: PageStateServerEntry[]
configuration: {
start_session_replay_recording_manually: boolean
}
}
}

Expand Down
10 changes: 10 additions & 0 deletions packages/rum-core/src/rumEvent.types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -856,6 +856,16 @@ export type RumViewEvent = CommonProperties & {
segments_total_raw_size?: number
[k: string]: unknown
}
/**
* Subset of the SDK configuration options in use during its execution
*/
readonly configuration?: {
/**
* Whether session replay recording configured to start manually
*/
readonly start_session_replay_recording_manually?: boolean
[k: string]: unknown
}
[k: string]: unknown
}
/**
Expand Down
3 changes: 3 additions & 0 deletions packages/rum-core/test/fixtures.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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: {
Expand Down
23 changes: 16 additions & 7 deletions packages/rum/src/types/sessionReplay.ts
Original file line number Diff line number Diff line change
Expand Up @@ -48,13 +48,22 @@ export type BrowserRecord =
/**
* Browser-specific. Schema of a Record type which contains the full snapshot of a screen.
*/
export type BrowserFullSnapshotRecord = CommonRecordSchema & {
export type BrowserFullSnapshotRecord = WebviewSupportedCommonRecordSchema & {
/**
* The type of this Record.
*/
readonly type: 2
data: BrowserNode
}
/**
* Schema of common properties for a Record event type that is supported by webviews.
*/
export type WebviewSupportedCommonRecordSchema = CommonRecordSchema & {
/**
* Defines the unique ID of the nested replay environment that generated this record.
*/
readonly nestedEnvId?: number
}
/**
* Serialized node contained by this Record.
*/
Expand All @@ -68,7 +77,7 @@ export type SerializedNode = DocumentNode | DocumentFragmentNode | DocumentTypeN
/**
* Browser-specific. Schema of a Record type which contains mutations of a screen.
*/
export type BrowserIncrementalSnapshotRecord = CommonRecordSchema & {
export type BrowserIncrementalSnapshotRecord = WebviewSupportedCommonRecordSchema & {
/**
* The type of this Record.
*/
Expand Down Expand Up @@ -237,7 +246,7 @@ export type PointerInteractionData = {
/**
* Schema of a Record which contains the screen properties.
*/
export type MetaRecord = CommonRecordSchema & {
export type MetaRecord = WebviewSupportedCommonRecordSchema & {
/**
* The type of this Record.
*/
Expand All @@ -263,7 +272,7 @@ export type MetaRecord = CommonRecordSchema & {
/**
* Schema of a Record type which contains focus information.
*/
export type FocusRecord = CommonRecordSchema & {
export type FocusRecord = WebviewSupportedCommonRecordSchema & {
/**
* The type of this Record.
*/
Expand All @@ -278,7 +287,7 @@ export type FocusRecord = CommonRecordSchema & {
/**
* Schema of a Record which signifies that view lifecycle ended.
*/
export type ViewEndRecord = CommonRecordSchema & {
export type ViewEndRecord = WebviewSupportedCommonRecordSchema & {
/**
* The type of this Record.
*/
Expand All @@ -287,7 +296,7 @@ export type ViewEndRecord = CommonRecordSchema & {
/**
* Schema of a Record which signifies that the viewport properties have changed.
*/
export type VisualViewportRecord = CommonRecordSchema & {
export type VisualViewportRecord = WebviewSupportedCommonRecordSchema & {
data: {
height: number
offsetLeft: number
Expand All @@ -305,7 +314,7 @@ export type VisualViewportRecord = CommonRecordSchema & {
/**
* Schema of a Record which signifies a collection of frustration signals.
*/
export type FrustrationRecord = CommonRecordSchema & {
export type FrustrationRecord = WebviewSupportedCommonRecordSchema & {
/**
* The type of this Record.
*/
Expand Down
2 changes: 1 addition & 1 deletion rum-events-format
Submodule rum-events-format updated 26 files
+16 −7 lib/cjs/generated/browserSessionReplay.d.ts
+49 −6 lib/cjs/generated/mobileSessionReplay.d.ts
+10 −0 lib/cjs/generated/rum.d.ts
+52 −9 lib/cjs/generated/sessionReplay.d.ts
+16 −7 lib/esm/generated/browserSessionReplay.d.ts
+49 −6 lib/esm/generated/mobileSessionReplay.d.ts
+10 −0 lib/esm/generated/rum.d.ts
+52 −9 lib/esm/generated/sessionReplay.d.ts
+2 −1 samples/rum-events/view.json
+1 −0 samples/session-replay/mobile/record/full-snapshot-record.json
+1 −0 samples/session-replay/mobile/record/incremental-snapshot-record.json
+12 −0 schemas/rum/view-schema.json
+1 −1 schemas/session-replay/browser/frustration-record-schema.json
+1 −1 schemas/session-replay/browser/full-snapshot-record-schema.json
+1 −1 schemas/session-replay/browser/incremental-snapshot-record-schema.json
+21 −0 schemas/session-replay/common/_webview-supported-common-record-schema.json
+1 −1 schemas/session-replay/common/focus-record-schema.json
+1 −1 schemas/session-replay/common/meta-record-schema.json
+1 −1 schemas/session-replay/common/view-end-record-schema.json
+1 −1 schemas/session-replay/common/visual-viewport-record-schema.json
+5 −0 schemas/session-replay/mobile/image-wireframe-schema.json
+5 −0 schemas/session-replay/mobile/image-wireframe-update-schema.json
+28 −0 schemas/session-replay/mobile/webview-wireframe-schema.json
+28 −0 schemas/session-replay/mobile/webview-wireframe-update-schema.json
+3 −0 schemas/session-replay/mobile/wireframe-schema.json
+3 −0 schemas/session-replay/mobile/wireframe-update-mutation-schema.json

0 comments on commit 9e34d3d

Please sign in to comment.