Skip to content

Commit f655cee

Browse files
committed
🐛 add transition
1 parent fdd98c7 commit f655cee

File tree

4 files changed

+41
-0
lines changed

4 files changed

+41
-0
lines changed

packages/rum-core/src/domain/assembly.ts

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -92,6 +92,11 @@ export function startRumAssembly(
9292
...VIEW_MODIFIABLE_FIELD_PATHS,
9393
...ROOT_MODIFIABLE_FIELD_PATHS,
9494
},
95+
[RumEventType.TRANSITION]: {
96+
...USER_CUSTOMIZABLE_FIELD_PATHS,
97+
...VIEW_MODIFIABLE_FIELD_PATHS,
98+
...ROOT_MODIFIABLE_FIELD_PATHS,
99+
},
95100
}
96101
const eventRateLimiters = {
97102
[RumEventType.ERROR]: createEventRateLimiter(

packages/rum-core/src/domain/event/eventCollection.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,8 @@ const allowedEventTypes = [
2020
RumEventType.LONG_TASK,
2121
RumEventType.RESOURCE,
2222
RumEventType.STREAM,
23+
RumEventType.STREAM,
24+
RumEventType.TRANSITION,
2325
RumEventType.VITAL,
2426
] as const
2527

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

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,7 @@ export const RumEventType = {
2929
RESOURCE: 'resource',
3030
VITAL: 'vital',
3131
STREAM: 'stream',
32+
TRANSITION: 'transition',
3233
} as const
3334

3435
export type RumEventType = (typeof RumEventType)[keyof typeof RumEventType]
@@ -398,6 +399,23 @@ export interface RawRumStreamEvent {
398399
}
399400
}
400401

402+
export interface RawRumTransitionEvent {
403+
date: TimeStamp
404+
type: typeof RumEventType.TRANSITION
405+
stream: {
406+
id: string
407+
}
408+
transition: {
409+
type: string
410+
id?: string
411+
timestamp?: number
412+
buffer_starvation_duration?: number
413+
media_start_delay?: number
414+
error_code?: number
415+
duration?: number
416+
}
417+
}
418+
401419
export type RawRumEvent =
402420
| RawRumErrorEvent
403421
| RawRumResourceEvent
@@ -407,3 +425,4 @@ export type RawRumEvent =
407425
| RawRumActionEvent
408426
| RawRumVitalEvent
409427
| RawRumStreamEvent
428+
| RawRumTransitionEvent

packages/rum-core/test/fixtures.ts

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -143,6 +143,21 @@ export function createRawRumEvent(type: RumEventType, overrides?: Context): RawR
143143
},
144144
overrides
145145
)
146+
case RumEventType.TRANSITION:
147+
return combine(
148+
{
149+
type,
150+
date: 0 as TimeStamp,
151+
stream: {
152+
id: generateUUID(),
153+
},
154+
transition: {
155+
id: generateUUID(),
156+
type: 'MEDIA_PLAYER_PLAY',
157+
}
158+
},
159+
overrides
160+
)
146161
}
147162
}
148163

0 commit comments

Comments
 (0)