Skip to content

Commit

Permalink
Fix for priority of contexts and add tracker
Browse files Browse the repository at this point in the history
  • Loading branch information
cy-moi committed Aug 28, 2024
1 parent eee15cf commit 9534087
Show file tree
Hide file tree
Showing 4 changed files with 5 additions and 6 deletions.
1 change: 1 addition & 0 deletions packages/core/src/domain/context/contextConstants.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,5 @@ export const enum CustomerDataType {
FeatureFlag,
User,
GlobalContext,
View,
}
3 changes: 3 additions & 0 deletions packages/rum-core/src/boot/rumPublicApi.ts
Original file line number Diff line number Diff line change
Expand Up @@ -426,6 +426,9 @@ export function makeRumPublicApi(
(options: ViewOptions): void
} = monitor((options?: string | ViewOptions) => {
const sanitizedOptions = typeof options === 'object' ? options : { name: options }
if (sanitizedOptions.context) {
customerDataTrackerManager.getOrCreateTracker(CustomerDataType.View).updateCustomerData(sanitizedOptions.context)
}
strategy.startView(sanitizedOptions)
addTelemetryUsage({ feature: 'start-view' })
})
Expand Down
6 changes: 1 addition & 5 deletions packages/rum-core/src/domain/assembly.ts
Original file line number Diff line number Diff line change
Expand Up @@ -184,11 +184,7 @@ export function startRumAssembly(
}

const serverRumEvent = combine(rumContext as RumContext & Context, rawRumEvent) as RumEvent & Context
serverRumEvent.context = combine(
commonContext.context,
customerContext,
serverRumEvent.type !== 'view' ? viewContext.customerContext : undefined
)
serverRumEvent.context = combine(commonContext.context, viewContext.customerContext, customerContext)

if (!('has_replay' in serverRumEvent.session)) {
;(serverRumEvent.session as Mutable<RumEvent['session']>).has_replay = commonContext.hasReplay
Expand Down
1 change: 0 additions & 1 deletion packages/rum-core/src/domain/view/viewCollection.ts
Original file line number Diff line number Diff line change
Expand Up @@ -128,7 +128,6 @@ function processViewUpdate(
}

return {
customerContext: view.context,
rawRumEvent: viewEvent,
startTime: view.startClocks.relative,
domainContext: {
Expand Down

0 comments on commit 9534087

Please sign in to comment.