change(ui): regen messages; wait for player initialization; insert event lists instead of creating new ones

This commit is contained in:
nick-delirium 2023-03-20 11:40:00 +01:00 committed by Delirium
parent 89ec4b67f1
commit d65e789b5b
16 changed files with 36 additions and 34 deletions

View file

@ -48,7 +48,7 @@ const (
MsgPerformanceTrack = 49 MsgPerformanceTrack = 49
MsgStringDict = 50 MsgStringDict = 50
MsgSetNodeAttributeDict = 51 MsgSetNodeAttributeDict = 51
MsgResourceTimingLegacy = 53 MsgResourceTimingDeprecated = 53
MsgConnectionInformation = 54 MsgConnectionInformation = 54
MsgSetPageVisibility = 55 MsgSetPageVisibility = 55
MsgPerformanceTrackAggr = 56 MsgPerformanceTrackAggr = 56
@ -1297,7 +1297,7 @@ func (msg *SetNodeAttributeDict) TypeID() int {
return 51 return 51
} }
type ResourceTimingLegacy struct { type ResourceTimingDeprecated struct {
message message
Timestamp uint64 Timestamp uint64
Duration uint64 Duration uint64
@ -1309,7 +1309,7 @@ type ResourceTimingLegacy struct {
Initiator string Initiator string
} }
func (msg *ResourceTimingLegacy) Encode() []byte { func (msg *ResourceTimingDeprecated) Encode() []byte {
buf := make([]byte, 81+len(msg.URL)+len(msg.Initiator)) buf := make([]byte, 81+len(msg.URL)+len(msg.Initiator))
buf[0] = 53 buf[0] = 53
p := 1 p := 1
@ -1324,11 +1324,11 @@ func (msg *ResourceTimingLegacy) Encode() []byte {
return buf[:p] return buf[:p]
} }
func (msg *ResourceTimingLegacy) Decode() Message { func (msg *ResourceTimingDeprecated) Decode() Message {
return msg return msg
} }
func (msg *ResourceTimingLegacy) TypeID() int { func (msg *ResourceTimingDeprecated) TypeID() int {
return 53 return 53
} }

View file

@ -756,9 +756,9 @@ func DecodeSetNodeAttributeDict(reader BytesReader) (Message, error) {
return msg, err return msg, err
} }
func DecodeResourceTimingLegacy(reader BytesReader) (Message, error) { func DecodeResourceTimingDeprecated(reader BytesReader) (Message, error) {
var err error = nil var err error = nil
msg := &ResourceTimingLegacy{} msg := &ResourceTimingDeprecated{}
if msg.Timestamp, err = reader.ReadUint(); err != nil { if msg.Timestamp, err = reader.ReadUint(); err != nil {
return nil, err return nil, err
} }
@ -1895,7 +1895,7 @@ func ReadMessage(t uint64, reader BytesReader) (Message, error) {
case 51: case 51:
return DecodeSetNodeAttributeDict(reader) return DecodeSetNodeAttributeDict(reader)
case 53: case 53:
return DecodeResourceTimingLegacy(reader) return DecodeResourceTimingDeprecated(reader)
case 54: case 54:
return DecodeConnectionInformation(reader) return DecodeConnectionInformation(reader)
case 55: case 55:

View file

@ -441,7 +441,7 @@ class SetNodeAttributeDict(Message):
self.value_key = value_key self.value_key = value_key
class ResourceTimingLegacy(Message): class ResourceTimingDeprecated(Message):
__id__ = 53 __id__ = 53
def __init__(self, timestamp, duration, ttfb, header_size, encoded_body_size, decoded_body_size, url, initiator): def __init__(self, timestamp, duration, ttfb, header_size, encoded_body_size, decoded_body_size, url, initiator):

View file

@ -420,7 +420,7 @@ class MessageCodec(Codec):
) )
if message_id == 53: if message_id == 53:
return ResourceTimingLegacy( return ResourceTimingDeprecated(
timestamp=self.read_uint(reader), timestamp=self.read_uint(reader),
duration=self.read_uint(reader), duration=self.read_uint(reader),
ttfb=self.read_uint(reader), ttfb=self.read_uint(reader),

View file

@ -68,7 +68,7 @@ function WebPlayer(props: any) {
if (session.events.length > 0 || session.errors.length > 0) { if (session.events.length > 0 || session.errors.length > 0) {
contextValue.player?.updateLists?.(session) contextValue.player?.updateLists?.(session)
} }
}, [session.events, session.errors]) }, [session.events, session.errors, contextValue.player])
const isPlayerReady = contextValue.store?.get().ready const isPlayerReady = contextValue.store?.get().ready

View file

@ -139,8 +139,10 @@ export default class MessageManager {
} }
public updateLists(lists: Partial<InitialLists>) { public updateLists(lists: Partial<InitialLists>) {
this.lists = new Lists(lists) Object.keys(lists).forEach((key: 'event' | 'stack' | 'exceptions') => {
const currentList = this.lists.lists[key]
lists[key]!.forEach(item => currentList.insert(item))
})
lists?.event?.forEach((e: Record<string, string>) => { lists?.event?.forEach((e: Record<string, string>) => {
if (e.type === EVENT_TYPES.LOCATION) { if (e.type === EVENT_TYPES.LOCATION) {
this.locationEventManager.append(e); this.locationEventManager.append(e);

View file

@ -403,7 +403,7 @@ export default class RawMessageReader extends PrimitiveReader {
const url = this.readString(); if (url === null) { return resetPointer() } const url = this.readString(); if (url === null) { return resetPointer() }
const initiator = this.readString(); if (initiator === null) { return resetPointer() } const initiator = this.readString(); if (initiator === null) { return resetPointer() }
return { return {
tp: MType.ResourceTimingLegacy, tp: MType.ResourceTimingDeprecated,
timestamp, timestamp,
duration, duration,
ttfb, ttfb,

View file

@ -36,7 +36,7 @@ import type {
RawPerformanceTrack, RawPerformanceTrack,
RawStringDict, RawStringDict,
RawSetNodeAttributeDict, RawSetNodeAttributeDict,
RawResourceTimingLegacy, RawResourceTimingDeprecated,
RawConnectionInformation, RawConnectionInformation,
RawSetPageVisibility, RawSetPageVisibility,
RawLoadFontFace, RawLoadFontFace,
@ -135,7 +135,7 @@ export type StringDict = RawStringDict & Timed
export type SetNodeAttributeDict = RawSetNodeAttributeDict & Timed export type SetNodeAttributeDict = RawSetNodeAttributeDict & Timed
export type ResourceTimingLegacy = RawResourceTimingLegacy & Timed export type ResourceTimingDeprecated = RawResourceTimingDeprecated & Timed
export type ConnectionInformation = RawConnectionInformation & Timed export type ConnectionInformation = RawConnectionInformation & Timed

View file

@ -34,7 +34,7 @@ export const enum MType {
PerformanceTrack = 49, PerformanceTrack = 49,
StringDict = 50, StringDict = 50,
SetNodeAttributeDict = 51, SetNodeAttributeDict = 51,
ResourceTimingLegacy = 53, ResourceTimingDeprecated = 53,
ConnectionInformation = 54, ConnectionInformation = 54,
SetPageVisibility = 55, SetPageVisibility = 55,
LoadFontFace = 57, LoadFontFace = 57,
@ -286,8 +286,8 @@ export interface RawSetNodeAttributeDict {
valueKey: number, valueKey: number,
} }
export interface RawResourceTimingLegacy { export interface RawResourceTimingDeprecated {
tp: MType.ResourceTimingLegacy, tp: MType.ResourceTimingDeprecated,
timestamp: number, timestamp: number,
duration: number, duration: number,
ttfb: number, ttfb: number,
@ -532,4 +532,4 @@ export interface RawIosNetworkCall {
} }
export type RawMessage = RawTimestamp | RawSetPageLocation | RawSetViewportSize | RawSetViewportScroll | RawCreateDocument | RawCreateElementNode | RawCreateTextNode | RawMoveNode | RawRemoveNode | RawSetNodeAttribute | RawRemoveNodeAttribute | RawSetNodeData | RawSetCssData | RawSetNodeScroll | RawSetInputValue | RawSetInputChecked | RawMouseMove | RawLegacyNetworkRequest | RawConsoleLog | RawCssInsertRule | RawCssDeleteRule | RawFetch | RawProfiler | RawOTable | RawRedux | RawVuex | RawMobX | RawNgRx | RawGraphQl | RawPerformanceTrack | RawStringDict | RawSetNodeAttributeDict | RawResourceTimingLegacy | RawConnectionInformation | RawSetPageVisibility | RawLoadFontFace | RawSetNodeFocus | RawLongTask | RawSetNodeAttributeURLBased | RawSetCssDataURLBased | RawCssInsertRuleURLBased | RawMouseClick | RawCreateIFrameDocument | RawAdoptedSsReplaceURLBased | RawAdoptedSsReplace | RawAdoptedSsInsertRuleURLBased | RawAdoptedSsInsertRule | RawAdoptedSsDeleteRule | RawAdoptedSsAddOwner | RawAdoptedSsRemoveOwner | RawZustand | RawSelectionChange | RawMouseThrashing | RawResourceTiming | RawNetworkRequest | RawIosSessionStart | RawIosCustomEvent | RawIosScreenChanges | RawIosClickEvent | RawIosPerformanceEvent | RawIosLog | RawIosNetworkCall; export type RawMessage = RawTimestamp | RawSetPageLocation | RawSetViewportSize | RawSetViewportScroll | RawCreateDocument | RawCreateElementNode | RawCreateTextNode | RawMoveNode | RawRemoveNode | RawSetNodeAttribute | RawRemoveNodeAttribute | RawSetNodeData | RawSetCssData | RawSetNodeScroll | RawSetInputValue | RawSetInputChecked | RawMouseMove | RawLegacyNetworkRequest | RawConsoleLog | RawCssInsertRule | RawCssDeleteRule | RawFetch | RawProfiler | RawOTable | RawRedux | RawVuex | RawMobX | RawNgRx | RawGraphQl | RawPerformanceTrack | RawStringDict | RawSetNodeAttributeDict | RawResourceTimingDeprecated | RawConnectionInformation | RawSetPageVisibility | RawLoadFontFace | RawSetNodeFocus | RawLongTask | RawSetNodeAttributeURLBased | RawSetCssDataURLBased | RawCssInsertRuleURLBased | RawMouseClick | RawCreateIFrameDocument | RawAdoptedSsReplaceURLBased | RawAdoptedSsReplace | RawAdoptedSsInsertRuleURLBased | RawAdoptedSsInsertRule | RawAdoptedSsDeleteRule | RawAdoptedSsAddOwner | RawAdoptedSsRemoveOwner | RawZustand | RawSelectionChange | RawMouseThrashing | RawResourceTiming | RawNetworkRequest | RawIosSessionStart | RawIosCustomEvent | RawIosScreenChanges | RawIosClickEvent | RawIosPerformanceEvent | RawIosLog | RawIosNetworkCall;

View file

@ -35,7 +35,7 @@ export const TP_MAP = {
49: MType.PerformanceTrack, 49: MType.PerformanceTrack,
50: MType.StringDict, 50: MType.StringDict,
51: MType.SetNodeAttributeDict, 51: MType.SetNodeAttributeDict,
53: MType.ResourceTimingLegacy, 53: MType.ResourceTimingDeprecated,
54: MType.ConnectionInformation, 54: MType.ConnectionInformation,
55: MType.SetPageVisibility, 55: MType.SetPageVisibility,
57: MType.LoadFontFace, 57: MType.LoadFontFace,

View file

@ -271,7 +271,7 @@ type TrSetNodeAttributeDict = [
valueKey: number, valueKey: number,
] ]
type TrResourceTimingLegacy = [ type TrResourceTimingDeprecated = [
type: 53, type: 53,
timestamp: number, timestamp: number,
duration: number, duration: number,
@ -484,7 +484,7 @@ type TrNetworkRequest = [
] ]
export type TrackerMessage = TrTimestamp | TrSetPageLocation | TrSetViewportSize | TrSetViewportScroll | TrCreateDocument | TrCreateElementNode | TrCreateTextNode | TrMoveNode | TrRemoveNode | TrSetNodeAttribute | TrRemoveNodeAttribute | TrSetNodeData | TrSetNodeScroll | TrSetInputTarget | TrSetInputValue | TrSetInputChecked | TrMouseMove | TrLegacyNetworkRequest | TrConsoleLog | TrPageLoadTiming | TrPageRenderTiming | TrCustomEvent | TrUserID | TrUserAnonymousID | TrMetadata | TrCSSInsertRule | TrCSSDeleteRule | TrFetch | TrProfiler | TrOTable | TrStateAction | TrRedux | TrVuex | TrMobX | TrNgRx | TrGraphQL | TrPerformanceTrack | TrStringDict | TrSetNodeAttributeDict | TrResourceTimingLegacy | TrConnectionInformation | TrSetPageVisibility | TrLoadFontFace | TrSetNodeFocus | TrLongTask | TrSetNodeAttributeURLBased | TrSetCSSDataURLBased | TrTechnicalInfo | TrCustomIssue | TrCSSInsertRuleURLBased | TrMouseClick | TrCreateIFrameDocument | TrAdoptedSSReplaceURLBased | TrAdoptedSSInsertRuleURLBased | TrAdoptedSSDeleteRule | TrAdoptedSSAddOwner | TrAdoptedSSRemoveOwner | TrJSException | TrZustand | TrBatchMetadata | TrPartitionedMessage | TrInputChange | TrSelectionChange | TrMouseThrashing | TrUnbindNodes | TrResourceTiming | TrNetworkRequest export type TrackerMessage = TrTimestamp | TrSetPageLocation | TrSetViewportSize | TrSetViewportScroll | TrCreateDocument | TrCreateElementNode | TrCreateTextNode | TrMoveNode | TrRemoveNode | TrSetNodeAttribute | TrRemoveNodeAttribute | TrSetNodeData | TrSetNodeScroll | TrSetInputTarget | TrSetInputValue | TrSetInputChecked | TrMouseMove | TrLegacyNetworkRequest | TrConsoleLog | TrPageLoadTiming | TrPageRenderTiming | TrCustomEvent | TrUserID | TrUserAnonymousID | TrMetadata | TrCSSInsertRule | TrCSSDeleteRule | TrFetch | TrProfiler | TrOTable | TrStateAction | TrRedux | TrVuex | TrMobX | TrNgRx | TrGraphQL | TrPerformanceTrack | TrStringDict | TrSetNodeAttributeDict | TrResourceTimingDeprecated | TrConnectionInformation | TrSetPageVisibility | TrLoadFontFace | TrSetNodeFocus | TrLongTask | TrSetNodeAttributeURLBased | TrSetCSSDataURLBased | TrTechnicalInfo | TrCustomIssue | TrCSSInsertRuleURLBased | TrMouseClick | TrCreateIFrameDocument | TrAdoptedSSReplaceURLBased | TrAdoptedSSInsertRuleURLBased | TrAdoptedSSDeleteRule | TrAdoptedSSAddOwner | TrAdoptedSSRemoveOwner | TrJSException | TrZustand | TrBatchMetadata | TrPartitionedMessage | TrInputChange | TrSelectionChange | TrMouseThrashing | TrUnbindNodes | TrResourceTiming | TrNetworkRequest
export default function translate(tMsg: TrackerMessage): RawMessage | null { export default function translate(tMsg: TrackerMessage): RawMessage | null {
switch(tMsg[0]) { switch(tMsg[0]) {
@ -766,7 +766,7 @@ export default function translate(tMsg: TrackerMessage): RawMessage | null {
case 53: { case 53: {
return { return {
tp: MType.ResourceTimingLegacy, tp: MType.ResourceTimingDeprecated,
timestamp: tMsg[1], timestamp: tMsg[1],
duration: tMsg[2], duration: tMsg[2],
ttfb: tMsg[3], ttfb: tMsg[3],

View file

@ -265,7 +265,7 @@ message 51, "SetNodeAttributeDict" do
uint 'NameKey' uint 'NameKey'
uint 'ValueKey' uint 'ValueKey'
end end
message 53, 'ResourceTimingLegacy', :replayer => :devtools do message 53, 'ResourceTimingDeprecated', :replayer => :devtools do
uint 'Timestamp' uint 'Timestamp'
uint 'Duration' uint 'Duration'
uint 'TTFB' uint 'TTFB'

View file

@ -41,7 +41,7 @@ export declare const enum Type {
PerformanceTrack = 49, PerformanceTrack = 49,
StringDict = 50, StringDict = 50,
SetNodeAttributeDict = 51, SetNodeAttributeDict = 51,
ResourceTimingLegacy = 53, ResourceTimingDeprecated = 53,
ConnectionInformation = 54, ConnectionInformation = 54,
SetPageVisibility = 55, SetPageVisibility = 55,
LoadFontFace = 57, LoadFontFace = 57,
@ -338,8 +338,8 @@ export type SetNodeAttributeDict = [
/*valueKey:*/ number, /*valueKey:*/ number,
] ]
export type ResourceTimingLegacy = [ export type ResourceTimingDeprecated = [
/*type:*/ Type.ResourceTimingLegacy, /*type:*/ Type.ResourceTimingDeprecated,
/*timestamp:*/ number, /*timestamp:*/ number,
/*duration:*/ number, /*duration:*/ number,
/*ttfb:*/ number, /*ttfb:*/ number,
@ -551,5 +551,5 @@ export type NetworkRequest = [
] ]
type Message = Timestamp | SetPageLocation | SetViewportSize | SetViewportScroll | CreateDocument | CreateElementNode | CreateTextNode | MoveNode | RemoveNode | SetNodeAttribute | RemoveNodeAttribute | SetNodeData | SetNodeScroll | SetInputTarget | SetInputValue | SetInputChecked | MouseMove | LegacyNetworkRequest | ConsoleLog | PageLoadTiming | PageRenderTiming | CustomEvent | UserID | UserAnonymousID | Metadata | CSSInsertRule | CSSDeleteRule | Fetch | Profiler | OTable | StateAction | Redux | Vuex | MobX | NgRx | GraphQL | PerformanceTrack | StringDict | SetNodeAttributeDict | ResourceTimingLegacy | ConnectionInformation | SetPageVisibility | LoadFontFace | SetNodeFocus | LongTask | SetNodeAttributeURLBased | SetCSSDataURLBased | TechnicalInfo | CustomIssue | CSSInsertRuleURLBased | MouseClick | CreateIFrameDocument | AdoptedSSReplaceURLBased | AdoptedSSInsertRuleURLBased | AdoptedSSDeleteRule | AdoptedSSAddOwner | AdoptedSSRemoveOwner | JSException | Zustand | BatchMetadata | PartitionedMessage | InputChange | SelectionChange | MouseThrashing | UnbindNodes | ResourceTiming | NetworkRequest type Message = Timestamp | SetPageLocation | SetViewportSize | SetViewportScroll | CreateDocument | CreateElementNode | CreateTextNode | MoveNode | RemoveNode | SetNodeAttribute | RemoveNodeAttribute | SetNodeData | SetNodeScroll | SetInputTarget | SetInputValue | SetInputChecked | MouseMove | LegacyNetworkRequest | ConsoleLog | PageLoadTiming | PageRenderTiming | CustomEvent | UserID | UserAnonymousID | Metadata | CSSInsertRule | CSSDeleteRule | Fetch | Profiler | OTable | StateAction | Redux | Vuex | MobX | NgRx | GraphQL | PerformanceTrack | StringDict | SetNodeAttributeDict | ResourceTimingDeprecated | ConnectionInformation | SetPageVisibility | LoadFontFace | SetNodeFocus | LongTask | SetNodeAttributeURLBased | SetCSSDataURLBased | TechnicalInfo | CustomIssue | CSSInsertRuleURLBased | MouseClick | CreateIFrameDocument | AdoptedSSReplaceURLBased | AdoptedSSInsertRuleURLBased | AdoptedSSDeleteRule | AdoptedSSAddOwner | AdoptedSSRemoveOwner | JSException | Zustand | BatchMetadata | PartitionedMessage | InputChange | SelectionChange | MouseThrashing | UnbindNodes | ResourceTiming | NetworkRequest
export default Message export default Message

View file

@ -498,7 +498,7 @@ export function SetNodeAttributeDict(
] ]
} }
export function ResourceTimingLegacy( export function ResourceTimingDeprecated(
timestamp: number, timestamp: number,
duration: number, duration: number,
ttfb: number, ttfb: number,
@ -507,9 +507,9 @@ export function ResourceTimingLegacy(
decodedBodySize: number, decodedBodySize: number,
url: string, url: string,
initiator: string, initiator: string,
): Messages.ResourceTimingLegacy { ): Messages.ResourceTimingDeprecated {
return [ return [
Messages.Type.ResourceTimingLegacy, Messages.Type.ResourceTimingDeprecated,
timestamp, timestamp,
duration, duration,
ttfb, ttfb,

View file

@ -60,7 +60,7 @@ export default function (app: App): void {
const sendImgError = app.safe(function (img: HTMLImageElement): void { const sendImgError = app.safe(function (img: HTMLImageElement): void {
const resolvedSrc = resolveURL(img.src || '') // Src type is null sometimes. - is it true? const resolvedSrc = resolveURL(img.src || '') // Src type is null sometimes. - is it true?
if (isURL(resolvedSrc)) { if (isURL(resolvedSrc)) {
app.send(ResourceTiming(app.timestamp(), 0, 0, 0, 0, 0, resolvedSrc, 'img')) app.send(ResourceTiming(app.timestamp(), 0, 0, 0, 0, 0, resolvedSrc, 'img', 0, false))
} }
}) })

View file

@ -166,7 +166,7 @@ export default class MessageEncoder extends PrimitiveEncoder {
return this.uint(msg[1]) && this.uint(msg[2]) && this.uint(msg[3]) return this.uint(msg[1]) && this.uint(msg[2]) && this.uint(msg[3])
break break
case Messages.Type.ResourceTimingLegacy: case Messages.Type.ResourceTimingDeprecated:
return this.uint(msg[1]) && this.uint(msg[2]) && this.uint(msg[3]) && this.uint(msg[4]) && this.uint(msg[5]) && this.uint(msg[6]) && this.string(msg[7]) && this.string(msg[8]) return this.uint(msg[1]) && this.uint(msg[2]) && this.uint(msg[3]) && this.uint(msg[4]) && this.uint(msg[5]) && this.uint(msg[6]) && this.string(msg[7]) && this.string(msg[8])
break break