Skip to content

Commit e239431

Browse files
bdiboncursoragent
andcommitted
Add websocket setup_duration field
Co-authored-by: Cursor <cursoragent@cursor.com>
1 parent 3a8e17a commit e239431

3 files changed

Lines changed: 214 additions & 2 deletions

File tree

lib/cjs/generated/rum.d.ts

Lines changed: 104 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -607,7 +607,7 @@ export type RumResourceEvent = CommonProperties & ActionChildProperties & ViewCo
607607
/**
608608
* Resource type
609609
*/
610-
readonly type: 'document' | 'xhr' | 'beacon' | 'fetch' | 'css' | 'js' | 'image' | 'font' | 'media' | 'other' | 'native';
610+
readonly type: 'document' | 'xhr' | 'beacon' | 'fetch' | 'css' | 'js' | 'image' | 'font' | 'media' | 'other' | 'native' | 'websocket';
611611
/**
612612
* HTTP method of the resource
613613
*/
@@ -801,6 +801,7 @@ export type RumResourceEvent = CommonProperties & ActionChildProperties & ViewCo
801801
[k: string]: unknown;
802802
};
803803
readonly graphql?: RumGraphql;
804+
readonly websocket?: RumWebSocket;
804805
[k: string]: unknown;
805806
};
806807
/**
@@ -1564,6 +1565,108 @@ export interface ProfilingInternalContextSchema {
15641565
readonly error_reason?: 'not-supported-by-browser' | 'failed-to-lazy-load' | 'missing-document-policy-header' | 'unexpected-exception';
15651566
[k: string]: unknown;
15661567
}
1568+
/**
1569+
* WebSocket-specific connection details. Only present when resource.type is 'websocket'.
1570+
*/
1571+
export interface RumWebSocket {
1572+
/**
1573+
* UUID generated by the SDK at WebSocket construction time.
1574+
*/
1575+
readonly connection_id?: string;
1576+
/**
1577+
* Unix timestamp (ms) when the WebSocket connection opened.
1578+
*/
1579+
readonly start_time?: number;
1580+
/**
1581+
* Unix timestamp (ms) when the connection closed or was flushed.
1582+
*/
1583+
readonly end_time?: number;
1584+
/**
1585+
* View ID where the WebSocket connection opened.
1586+
*/
1587+
readonly start_view_id?: string;
1588+
/**
1589+
* View ID where the connection ended; may equal start_view_id.
1590+
*/
1591+
readonly end_view_id?: string;
1592+
/**
1593+
* How the SDK learned the connection ended.
1594+
*/
1595+
readonly closure_reason?: 'close_event' | 'session_end';
1596+
/**
1597+
* WebSocket close code, per RFC 6455. Only set when closure_reason is 'close_event'.
1598+
*/
1599+
readonly close_code?: number;
1600+
/**
1601+
* WebSocket close reason string. Only set when closure_reason is 'close_event'.
1602+
*/
1603+
readonly close_reason?: string;
1604+
/**
1605+
* Value of CloseEvent.wasClean — false on abnormal closes (e.g. close code 1006). Only set when closure_reason is 'close_event'.
1606+
*/
1607+
readonly was_clean?: boolean;
1608+
/**
1609+
* Aggregated stats for incoming messages over the lifetime of the connection.
1610+
*/
1611+
readonly messages_in?: {
1612+
/**
1613+
* Number of incoming messages received.
1614+
*/
1615+
readonly count?: number;
1616+
/**
1617+
* Total bytes received.
1618+
*/
1619+
readonly size?: number;
1620+
[k: string]: unknown;
1621+
};
1622+
/**
1623+
* Aggregated stats for outgoing messages over the lifetime of the connection.
1624+
*/
1625+
readonly messages_out?: {
1626+
/**
1627+
* Number of outgoing messages sent.
1628+
*/
1629+
readonly count?: number;
1630+
/**
1631+
* Total bytes sent.
1632+
*/
1633+
readonly size?: number;
1634+
[k: string]: unknown;
1635+
};
1636+
/**
1637+
* Milliseconds from open to first incoming message.
1638+
*/
1639+
readonly time_to_first_message_in?: number;
1640+
/**
1641+
* Milliseconds from open to first outgoing message.
1642+
*/
1643+
readonly time_to_first_message_out?: number;
1644+
/**
1645+
* Unix timestamp (ms) of the last message (in or out).
1646+
*/
1647+
readonly last_message_at?: number;
1648+
/**
1649+
* Longest silence in milliseconds between consecutive messages.
1650+
*/
1651+
readonly max_gap?: number;
1652+
/**
1653+
* Milliseconds of silence before the connection closed.
1654+
*/
1655+
readonly idle_duration_before_close?: number;
1656+
/**
1657+
* Peak WebSocket.bufferedAmount in bytes.
1658+
*/
1659+
readonly buffered_amount_max?: number;
1660+
/**
1661+
* Negotiated WebSocket sub-protocol from WebSocket.protocol once the connection is open. Empty string when no sub-protocol was selected.
1662+
*/
1663+
readonly protocol?: string;
1664+
/**
1665+
* Milliseconds from WebSocket construction until the connection opened. If the connection never opened, milliseconds until the close event or session flush.
1666+
*/
1667+
readonly setup_duration?: number;
1668+
[k: string]: unknown;
1669+
}
15671670
/**
15681671
* Stream schema for media streaming properties
15691672
*/

lib/esm/generated/rum.d.ts

Lines changed: 104 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -607,7 +607,7 @@ export type RumResourceEvent = CommonProperties & ActionChildProperties & ViewCo
607607
/**
608608
* Resource type
609609
*/
610-
readonly type: 'document' | 'xhr' | 'beacon' | 'fetch' | 'css' | 'js' | 'image' | 'font' | 'media' | 'other' | 'native';
610+
readonly type: 'document' | 'xhr' | 'beacon' | 'fetch' | 'css' | 'js' | 'image' | 'font' | 'media' | 'other' | 'native' | 'websocket';
611611
/**
612612
* HTTP method of the resource
613613
*/
@@ -801,6 +801,7 @@ export type RumResourceEvent = CommonProperties & ActionChildProperties & ViewCo
801801
[k: string]: unknown;
802802
};
803803
readonly graphql?: RumGraphql;
804+
readonly websocket?: RumWebSocket;
804805
[k: string]: unknown;
805806
};
806807
/**
@@ -1564,6 +1565,108 @@ export interface ProfilingInternalContextSchema {
15641565
readonly error_reason?: 'not-supported-by-browser' | 'failed-to-lazy-load' | 'missing-document-policy-header' | 'unexpected-exception';
15651566
[k: string]: unknown;
15661567
}
1568+
/**
1569+
* WebSocket-specific connection details. Only present when resource.type is 'websocket'.
1570+
*/
1571+
export interface RumWebSocket {
1572+
/**
1573+
* UUID generated by the SDK at WebSocket construction time.
1574+
*/
1575+
readonly connection_id?: string;
1576+
/**
1577+
* Unix timestamp (ms) when the WebSocket connection opened.
1578+
*/
1579+
readonly start_time?: number;
1580+
/**
1581+
* Unix timestamp (ms) when the connection closed or was flushed.
1582+
*/
1583+
readonly end_time?: number;
1584+
/**
1585+
* View ID where the WebSocket connection opened.
1586+
*/
1587+
readonly start_view_id?: string;
1588+
/**
1589+
* View ID where the connection ended; may equal start_view_id.
1590+
*/
1591+
readonly end_view_id?: string;
1592+
/**
1593+
* How the SDK learned the connection ended.
1594+
*/
1595+
readonly closure_reason?: 'close_event' | 'session_end';
1596+
/**
1597+
* WebSocket close code, per RFC 6455. Only set when closure_reason is 'close_event'.
1598+
*/
1599+
readonly close_code?: number;
1600+
/**
1601+
* WebSocket close reason string. Only set when closure_reason is 'close_event'.
1602+
*/
1603+
readonly close_reason?: string;
1604+
/**
1605+
* Value of CloseEvent.wasClean — false on abnormal closes (e.g. close code 1006). Only set when closure_reason is 'close_event'.
1606+
*/
1607+
readonly was_clean?: boolean;
1608+
/**
1609+
* Aggregated stats for incoming messages over the lifetime of the connection.
1610+
*/
1611+
readonly messages_in?: {
1612+
/**
1613+
* Number of incoming messages received.
1614+
*/
1615+
readonly count?: number;
1616+
/**
1617+
* Total bytes received.
1618+
*/
1619+
readonly size?: number;
1620+
[k: string]: unknown;
1621+
};
1622+
/**
1623+
* Aggregated stats for outgoing messages over the lifetime of the connection.
1624+
*/
1625+
readonly messages_out?: {
1626+
/**
1627+
* Number of outgoing messages sent.
1628+
*/
1629+
readonly count?: number;
1630+
/**
1631+
* Total bytes sent.
1632+
*/
1633+
readonly size?: number;
1634+
[k: string]: unknown;
1635+
};
1636+
/**
1637+
* Milliseconds from open to first incoming message.
1638+
*/
1639+
readonly time_to_first_message_in?: number;
1640+
/**
1641+
* Milliseconds from open to first outgoing message.
1642+
*/
1643+
readonly time_to_first_message_out?: number;
1644+
/**
1645+
* Unix timestamp (ms) of the last message (in or out).
1646+
*/
1647+
readonly last_message_at?: number;
1648+
/**
1649+
* Longest silence in milliseconds between consecutive messages.
1650+
*/
1651+
readonly max_gap?: number;
1652+
/**
1653+
* Milliseconds of silence before the connection closed.
1654+
*/
1655+
readonly idle_duration_before_close?: number;
1656+
/**
1657+
* Peak WebSocket.bufferedAmount in bytes.
1658+
*/
1659+
readonly buffered_amount_max?: number;
1660+
/**
1661+
* Negotiated WebSocket sub-protocol from WebSocket.protocol once the connection is open. Empty string when no sub-protocol was selected.
1662+
*/
1663+
readonly protocol?: string;
1664+
/**
1665+
* Milliseconds from WebSocket construction until the connection opened. If the connection never opened, milliseconds until the close event or session flush.
1666+
*/
1667+
readonly setup_duration?: number;
1668+
[k: string]: unknown;
1669+
}
15671670
/**
15681671
* Stream schema for media streaming properties
15691672
*/

schemas/rum/_websocket-schema.json

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -131,6 +131,12 @@
131131
"type": "string",
132132
"description": "Negotiated WebSocket sub-protocol from WebSocket.protocol once the connection is open. Empty string when no sub-protocol was selected.",
133133
"readOnly": true
134+
},
135+
"setup_duration": {
136+
"type": "integer",
137+
"description": "Milliseconds from WebSocket construction until the connection opened. If the connection never opened, milliseconds until the close event or session flush.",
138+
"minimum": 0,
139+
"readOnly": true
134140
}
135141
},
136142
"readOnly": true

0 commit comments

Comments
 (0)