Skip to content
Merged
Show file tree
Hide file tree
Changes from 6 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
82 changes: 81 additions & 1 deletion lib/cjs/generated/rum.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
/**
* Schema of all properties of a RUM event
*/
export declare type RumEvent = RumActionEvent | RumErrorEvent | RumLongTaskEvent | RumResourceEvent | RumViewEvent | RumVitalEvent;
export declare type RumEvent = RumActionEvent | RumTransitionEvent | RumErrorEvent | RumLongTaskEvent | RumResourceEvent | RumViewEvent | RumVitalEvent;
/**
* Schema of all properties of an Action event
*/
Expand Down Expand Up @@ -151,6 +151,50 @@ export declare type RumActionEvent = CommonProperties & ViewContainerSchema & {
};
[k: string]: unknown;
};
/**
* Schema of all properties of an Transition event
*/
export declare type RumTransitionEvent = CommonProperties & StreamContainerSchema & {
/**
* RUM event type
*/
readonly type: 'transition';
/**
* Transition properties
*/
readonly transition: {
/**
* Type of the transition
*/
readonly type: string;
/**
* UUID of the transition
*/
readonly id?: string;
/**
* The player's current timestamp in milliseconds
*/
readonly timestamp?: number;
/**
* Buffer starvation duration, the amount of time spent rebuffering in milliseconds
*/
readonly buffer_starrvation_duration?: number;
/**
* Media start delay, the amount of time spent loading before playing in milliseconds
*/
readonly media_start_delay?: number;
/**
* Error code, as reported by the player
*/
readonly error_code?: number;
/**
* Duration of the event in milliseconds
*/
readonly duration?: number;
[k: string]: unknown;
};
[k: string]: unknown;
};
/**
* Schema of all properties of an Error event
*/
Expand Down Expand Up @@ -1618,6 +1662,42 @@ export interface ViewContainerSchema {
};
[k: string]: unknown;
}
/**
* Stream Container schema for streams that are nested
*/
export interface StreamContainerSchema {
/**
* Stream Container properties (stream wrapping the current stream)
*/
readonly container?: {
/**
* Attributes of the stream's container
*/
readonly stream: {
/**
* ID of the parent stream
*/
readonly id: string;
[k: string]: unknown;
};
/**
* Attributes of the view's container
*/
readonly view?: {
/**
* ID of the parent view
*/
readonly id: string;
[k: string]: unknown;
};
/**
* Source of the parent stream
*/
readonly source: 'android' | 'ios' | 'browser' | 'flutter' | 'react-native' | 'roku' | 'unity' | 'kotlin-multiplatform';
[k: string]: unknown;
};
[k: string]: unknown;
}
/**
* Schema of all properties of events that can have parent actions
*/
Expand Down
82 changes: 81 additions & 1 deletion lib/esm/generated/rum.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
/**
* Schema of all properties of a RUM event
*/
export declare type RumEvent = RumActionEvent | RumErrorEvent | RumLongTaskEvent | RumResourceEvent | RumViewEvent | RumVitalEvent;
export declare type RumEvent = RumActionEvent | RumTransitionEvent | RumErrorEvent | RumLongTaskEvent | RumResourceEvent | RumViewEvent | RumVitalEvent;
/**
* Schema of all properties of an Action event
*/
Expand Down Expand Up @@ -151,6 +151,50 @@ export declare type RumActionEvent = CommonProperties & ViewContainerSchema & {
};
[k: string]: unknown;
};
/**
* Schema of all properties of an Transition event
*/
export declare type RumTransitionEvent = CommonProperties & StreamContainerSchema & {
/**
* RUM event type
*/
readonly type: 'transition';
/**
* Transition properties
*/
readonly transition: {
/**
* Type of the transition
*/
readonly type: string;
/**
* UUID of the transition
*/
readonly id?: string;
/**
* The player's current timestamp in milliseconds
*/
readonly timestamp?: number;
/**
* Buffer starvation duration, the amount of time spent rebuffering in milliseconds
*/
readonly buffer_starrvation_duration?: number;
/**
* Media start delay, the amount of time spent loading before playing in milliseconds
*/
readonly media_start_delay?: number;
/**
* Error code, as reported by the player
*/
readonly error_code?: number;
/**
* Duration of the event in milliseconds
*/
readonly duration?: number;
[k: string]: unknown;
};
[k: string]: unknown;
};
/**
* Schema of all properties of an Error event
*/
Expand Down Expand Up @@ -1618,6 +1662,42 @@ export interface ViewContainerSchema {
};
[k: string]: unknown;
}
/**
* Stream Container schema for streams that are nested
*/
export interface StreamContainerSchema {
/**
* Stream Container properties (stream wrapping the current stream)
*/
readonly container?: {
/**
* Attributes of the stream's container
*/
readonly stream: {
/**
* ID of the parent stream
*/
readonly id: string;
[k: string]: unknown;
};
/**
* Attributes of the view's container
*/
readonly view?: {
/**
* ID of the parent view
*/
readonly id: string;
[k: string]: unknown;
};
/**
* Source of the parent stream
*/
readonly source: 'android' | 'ios' | 'browser' | 'flutter' | 'react-native' | 'roku' | 'unity' | 'kotlin-multiplatform';
[k: string]: unknown;
};
[k: string]: unknown;
}
/**
* Schema of all properties of events that can have parent actions
*/
Expand Down
32 changes: 32 additions & 0 deletions samples/rum-events/transition.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
{
"type": "transition",
"date": 1591284428705,
"application": {
"id": "ac8218cf-498b-4d33-bd44-151095959547"
},
"session": {
"id": "cacbf45c-3a05-48ce-b066-d76349460599",
"type": "user"
},
"source": "android",
"view": {
"id": "623d50fd-75cf-4025-97d2-e51ff94171f6",
"referrer": "",
"url": "https://app.datadoghq.com/rum/explorer?live=1h&query=&tab=view"
},
"stream": {
"id": "7be62f6b-b0c1-4165-bf5f-2ca647dfec30",
"referrer": "",
"url": "https://app.datadoghq.com/rum/explorer?live=1h&query=&tab=view"
},
"transition": {
"type": "MEDIA_PLAYER_PLAY",
"id": "47af0abb-3de1-4170-a491-4473716df979",
"timestamp": 3600000,
"buffer_starvation_duration": 500,
"media_start_delay": 800
},
"_dd": {
"format_version": 2
}
}
3 changes: 3 additions & 0 deletions schemas/rum-events-schema.json
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,9 @@
{
"$ref": "rum/action-schema.json"
},
{
"$ref": "rum/transition-schema.json"
},
{
"$ref": "rum/error-schema.json"
},
Expand Down
51 changes: 51 additions & 0 deletions schemas/rum/_stream-container-schema.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
{
"$schema": "http://json-schema.org/draft-07/schema",
"$id": "rum/_stream-container-schema.json",
"title": "StreamContainerSchema",
"type": "object",
"description": "Stream Container schema for streams that are nested",
"properties": {
"container": {
"type": "object",
"description": "Stream Container properties (stream wrapping the current stream)",
"required": ["stream", "source"],
"properties": {
"stream": {
"type": "object",
Copy link
Contributor

@bcaudan bcaudan Sep 12, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💬 suggestion: ‏if source is not needed, we could also remove the container level, no?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

yes, i was basing it off the view-container schema, but that wasn't the correct definition to use as an example

in 1992a90 im making it so it's now named _stream-event-schema.json and it only makes the stream.id property required

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sorry about the iteration on this one, I'm discovering the topic as I am reviewing.
It seems that we would now have a _stream-event-schema.json used by view event and a _stream-schema.json used by transition event.
Depending on how we plan to use those schemas, we could probably make their names and descriptions more explicit.
Happy to chat about it if needed.

"description": "Attributes of the stream's container",
"required": ["id"],
"properties": {
"id": {
"type": "string",
"description": "ID of the parent stream",
"pattern": "^[a-f0-9]{8}-[a-f0-9]{4}-[a-f0-9]{4}-[a-f0-9]{4}-[a-f0-9]{12}$",
"readOnly": true
}
},
"readOnly": true
},
"view": {
"type": "object",
"description": "Attributes of the view's container",
"required": ["id"],
"properties": {
"id": {
"type": "string",
"description": "ID of the parent view",
"pattern": "^[a-f0-9]{8}-[a-f0-9]{4}-[a-f0-9]{4}-[a-f0-9]{4}-[a-f0-9]{12}$",
"readOnly": true
}
},
"readOnly": true
},
"source": {
"type": "string",
"description": "Source of the parent stream",
"enum": ["android", "ios", "browser", "flutter", "react-native", "roku", "unity", "kotlin-multiplatform"],
"readOnly": true
}
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

❓ question: ‏Since we already have view.id and source from common schema, do we also need to have them there?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You're right, it's not needed, removing it

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What about source?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

yes that one isn't needed either 🤦 removing it...

},
"readOnly": true
}
}
}
75 changes: 75 additions & 0 deletions schemas/rum/transition-schema.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,75 @@
{
"$schema": "http://json-schema.org/draft-07/schema",
"$id": "rum/transition-schema.json",
"title": "RumTransitionEvent",
"type": "object",
"description": "Schema of all properties of an Transition event",
"allOf": [
{
"$ref": "_common-schema.json"
},
{
"$ref": "_stream-container-schema.json"
},
{
"required": ["type", "transition"],
"properties": {
"type": {
"type": "string",
"description": "RUM event type",
"const": "transition",
"readOnly": true
},
"transition": {
"type": "object",
"description": "Transition properties",
"required": ["type"],
"properties": {
"type": {
"type": "string",
"description": "Type of the transition",
"readOnly": true
},
"id": {
"type": "string",
"description": "UUID of the transition",
"pattern": "^[a-f0-9]{8}-[a-f0-9]{4}-[a-f0-9]{4}-[a-f0-9]{4}-[a-f0-9]{12}$",
"readOnly": true
},
"timestamp": {
"type": "integer",
"description": "The player's current timestamp in milliseconds",
"minimum": 0,
"readOnly": true
},
"buffer_starrvation_duration": {
"type": "integer",
"description": "Buffer starvation duration, the amount of time spent rebuffering in milliseconds",
"minimum": 0,
"readOnly": true
},
"media_start_delay": {
"type": "integer",
"description": "Media start delay, the amount of time spent loading before playing in milliseconds",
"minimum": 0,
"readOnly": true
},
"error_code": {
"type": "integer",
"description": "Error code, as reported by the player",
"minimum": 0,
"readOnly": true
},
"duration": {
"type": "integer",
"description": "Duration of the event in milliseconds",
"minimum": 0,
"readOnly": true
}
},
"readOnly": true
}
}
}
]
}