Skip to content

Commit 5609f85

Browse files
committed
✨ add support for remote_configuration_id in view events
1 parent 741883d commit 5609f85

4 files changed

Lines changed: 27 additions & 0 deletions

File tree

packages/browser-rum-core/src/domain/configuration/configuration.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -397,6 +397,7 @@ export interface RumConfiguration extends Configuration {
397397
profilingSampleRate: number
398398
propagateTraceBaggage: boolean
399399
allowedGraphQlUrls: GraphQlUrlOption[]
400+
remoteConfigurationId: string | undefined
400401
}
401402

402403
export function validateAndBuildRumConfiguration(
@@ -474,6 +475,7 @@ export function validateAndBuildRumConfiguration(
474475
profilingSampleRate: initConfiguration.profilingSampleRate ?? 0,
475476
propagateTraceBaggage: initConfiguration.propagateTraceBaggage !== false,
476477
allowedGraphQlUrls,
478+
remoteConfigurationId: getRemoteConfigurationId(initConfiguration),
477479
...baseConfiguration,
478480
}
479481
}

packages/browser-rum-core/src/domain/view/viewCollection.spec.ts

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -113,6 +113,7 @@ describe('viewCollection', () => {
113113
replay_stats: undefined,
114114
configuration: {
115115
start_session_replay_recording_manually: jasmine.any(Boolean),
116+
remote_configuration_id: undefined,
116117
},
117118
cls: undefined,
118119
},
@@ -240,6 +241,28 @@ describe('viewCollection', () => {
240241
})
241242
})
242243

244+
describe('with configuration.remote_configuration_id', () => {
245+
it('should include the remote configuration id when configured', () => {
246+
setupViewCollection({ remoteConfigurationId: 'foo' })
247+
lifeCycle.notify(LifeCycleEventType.VIEW_UPDATED, VIEW)
248+
249+
expect(
250+
(rawRumEvents[rawRumEvents.length - 1].rawRumEvent as RawRumViewEvent)._dd.configuration
251+
.remote_configuration_id
252+
).toBe('foo')
253+
})
254+
255+
it('should be undefined when remote configuration is not used', () => {
256+
setupViewCollection({ remoteConfigurationId: undefined })
257+
lifeCycle.notify(LifeCycleEventType.VIEW_UPDATED, VIEW)
258+
259+
expect(
260+
(rawRumEvents[rawRumEvents.length - 1].rawRumEvent as RawRumViewEvent)._dd.configuration
261+
.remote_configuration_id
262+
).toBeUndefined()
263+
})
264+
})
265+
243266
describe('assembly hook', () => {
244267
it('should add view properties from the history', () => {
245268
setupViewCollection({ trackViewsManually: true }, VIEW)

packages/browser-rum-core/src/domain/view/viewCollection.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -90,6 +90,7 @@ function processViewUpdate(
9090
: undefined,
9191
configuration: {
9292
start_session_replay_recording_manually: configuration.startSessionReplayRecordingManually,
93+
remote_configuration_id: configuration.remoteConfigurationId,
9394
},
9495
},
9596
date: view.startClocks.timeStamp,

packages/browser-rum-core/src/rawRumEvent.types.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -170,6 +170,7 @@ export interface RawRumViewEvent {
170170
}
171171
configuration: {
172172
start_session_replay_recording_manually: boolean
173+
remote_configuration_id?: string
173174
}
174175
}
175176
device?: {

0 commit comments

Comments
 (0)