Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

✨ [RUM-1016] allow to change "view.name" #2396

Merged
merged 3 commits into from
Sep 7, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 16 additions & 2 deletions packages/rum-core/src/domain/assembly.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -79,8 +79,8 @@ describe('rum assembly', () => {

describe('beforeSend', () => {
describe('fields modification', () => {
describe('sensitive fields', () => {
it('should allow modification on sensitive field', () => {
describe('modifiable fields', () => {
it('should allow modification', () => {
const { lifeCycle } = setupBuilder
.withConfiguration({
beforeSend: (event) => (event.view.url = 'modified'),
Expand All @@ -93,6 +93,20 @@ describe('rum assembly', () => {

expect(serverRumEvents[0].view.url).toBe('modified')
})

it('should allow addition', () => {
const { lifeCycle } = setupBuilder
.withConfiguration({
beforeSend: (event) => (event.view.name = 'added'),
})
.build()

notifyRawRumEvent(lifeCycle, {
rawRumEvent: createRawRumEvent(RumEventType.LONG_TASK, { view: { url: '/path?foo=bar' } }),
})

expect(serverRumEvents[0].view.name).toBe('added')
})
})

describe('context field', () => {
Expand Down
1 change: 1 addition & 0 deletions packages/rum-core/src/domain/assembly.ts
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,7 @@ const enum SessionType {
}

const VIEW_MODIFIABLE_FIELD_PATHS: ModifiableFieldPaths = {
'view.name': 'string',
'view.url': 'string',
'view.referrer': 'string',
}
Expand Down