Skip to content

Commit 4391415

Browse files
Add transition event type
1 parent fa3fa32 commit 4391415

File tree

1 file changed

+140
-38
lines changed

1 file changed

+140
-38
lines changed

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

Lines changed: 140 additions & 38 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@
88
*/
99
export type RumEvent =
1010
| RumActionEvent
11+
| RumTransitionEvent
1112
| RumErrorEvent
1213
| RumLongTaskEvent
1314
| RumResourceEvent
@@ -166,6 +167,60 @@ export type RumActionEvent = CommonProperties &
166167
}
167168
[k: string]: unknown
168169
}
170+
/**
171+
* Schema of all properties of an Transition event
172+
*/
173+
export type RumTransitionEvent = CommonProperties & {
174+
/**
175+
* RUM event type
176+
*/
177+
readonly type: 'transition'
178+
/**
179+
* Stream properties
180+
*/
181+
readonly stream: {
182+
/**
183+
* UUID of the stream
184+
*/
185+
readonly id: string
186+
[k: string]: unknown
187+
}
188+
/**
189+
* Transition properties
190+
*/
191+
readonly transition: {
192+
/**
193+
* Type of the transition
194+
*/
195+
readonly type: string
196+
/**
197+
* UUID of the transition
198+
*/
199+
readonly id?: string
200+
/**
201+
* The player's current timestamp in milliseconds
202+
*/
203+
readonly timestamp?: number
204+
/**
205+
* Buffer starvation duration, the amount of time spent rebuffering in milliseconds
206+
*/
207+
readonly buffer_starvation_duration?: number
208+
/**
209+
* Media start delay, the amount of time spent loading before playing in milliseconds
210+
*/
211+
readonly media_start_delay?: number
212+
/**
213+
* Error code, as reported by the player
214+
*/
215+
readonly error_code?: number
216+
/**
217+
* Duration of the event in milliseconds
218+
*/
219+
readonly duration?: number
220+
[k: string]: unknown
221+
}
222+
[k: string]: unknown
223+
}
169224
/**
170225
* Schema of all properties of an Error event
171226
*/
@@ -1233,44 +1288,7 @@ export type RumVitalEvent = CommonProperties &
12331288
* RUM event type
12341289
*/
12351290
readonly type: 'vital'
1236-
/**
1237-
* Vital properties
1238-
*/
1239-
readonly vital: {
1240-
/**
1241-
* Type of the vital
1242-
*/
1243-
readonly type: 'duration' | 'operation_step'
1244-
/**
1245-
* UUID of the vital
1246-
*/
1247-
readonly id: string
1248-
/**
1249-
* Optional key to distinguish between multiple operations of the same name running in parallel (e.g., 'photo_upload' with keys 'profile_pic' vs 'cover')
1250-
*/
1251-
readonly operation_key?: string
1252-
/**
1253-
* Name of the vital, as it is also used as facet path for its value, it must contain only letters, digits, or the characters - _ . @ $
1254-
*/
1255-
readonly name?: string
1256-
/**
1257-
* Description of the vital. It can be used as a secondary identifier (URL, React component name...)
1258-
*/
1259-
readonly description?: string
1260-
/**
1261-
* Duration of the vital in nanoseconds
1262-
*/
1263-
readonly duration?: number
1264-
/**
1265-
* Type of the step that triggered the vital, if applicable
1266-
*/
1267-
readonly step_type?: 'start' | 'update' | 'retry' | 'end'
1268-
/**
1269-
* Reason for the failure of the step, if applicable
1270-
*/
1271-
readonly failure_reason?: 'error' | 'abandoned' | 'other'
1272-
[k: string]: unknown
1273-
}
1291+
readonly vital: DurationProperties | AppLaunchProperties | FeatureOperationProperties
12741292
/**
12751293
* Internal properties
12761294
*/
@@ -1289,6 +1307,90 @@ export type RumVitalEvent = CommonProperties &
12891307
}
12901308
[k: string]: unknown
12911309
}
1310+
/**
1311+
* Duration properties of a Vital event
1312+
*/
1313+
export type DurationProperties = VitalCommonProperties & {
1314+
/**
1315+
* Type of the vital.
1316+
*/
1317+
readonly type: 'duration'
1318+
/**
1319+
* Duration of the vital in nanoseconds.
1320+
*/
1321+
readonly duration: number
1322+
[k: string]: unknown
1323+
}
1324+
/**
1325+
* Schema of common properties for a Vital event
1326+
*/
1327+
export type VitalCommonProperties = {
1328+
/**
1329+
* UUID of the vital
1330+
*/
1331+
readonly id: string
1332+
/**
1333+
* Name of the vital, as it is also used as facet path for its value, it must contain only letters, digits, or the characters - _ . @ $
1334+
*/
1335+
readonly name?: string
1336+
/**
1337+
* Description of the vital. It can be used as a secondary identifier (URL, React component name...)
1338+
*/
1339+
readonly description?: string
1340+
[k: string]: unknown
1341+
}
1342+
/**
1343+
* Schema for app launch metrics.
1344+
*/
1345+
export type AppLaunchProperties = VitalCommonProperties & {
1346+
/**
1347+
* Type of the vital.
1348+
*/
1349+
readonly type: 'app_launch'
1350+
/**
1351+
* The metric of the app launch.
1352+
*/
1353+
readonly app_launch_metric: 'ttid' | 'ttfd'
1354+
/**
1355+
* Duration of the vital in nanoseconds.
1356+
*/
1357+
readonly duration: number
1358+
/**
1359+
* The type of the app launch.
1360+
*/
1361+
readonly startup_type?: 'cold_start' | 'warm_start'
1362+
/**
1363+
* Whether the app launch was prewarmed.
1364+
*/
1365+
readonly is_prewarmed?: boolean
1366+
/**
1367+
* If the app launch had a saved instance state bundle.
1368+
*/
1369+
readonly has_saved_instance_state_bundle?: boolean
1370+
[k: string]: unknown
1371+
}
1372+
/**
1373+
* Schema for a feature operation.
1374+
*/
1375+
export type FeatureOperationProperties = VitalCommonProperties & {
1376+
/**
1377+
* Type of the vital.
1378+
*/
1379+
readonly type: 'operation_step'
1380+
/**
1381+
* Optional key to distinguish between multiple operations of the same name running in parallel (e.g., 'photo_upload' with keys 'profile_pic' vs 'cover')
1382+
*/
1383+
readonly operation_key?: string
1384+
/**
1385+
* Type of the step that triggered the vital, if applicable
1386+
*/
1387+
readonly step_type?: 'start' | 'update' | 'retry' | 'end'
1388+
/**
1389+
* Reason for the failure of the step, if applicable
1390+
*/
1391+
readonly failure_reason?: 'error' | 'abandoned' | 'other'
1392+
[k: string]: unknown
1393+
}
12921394

12931395
/**
12941396
* Schema of common properties of RUM events

0 commit comments

Comments
 (0)