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

View file

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

View file

@ -441,7 +441,7 @@ class SetNodeAttributeDict(Message):
self.value_key = value_key
class ResourceTimingLegacy(Message):
class ResourceTimingDeprecated(Message):
__id__ = 53
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:
return ResourceTimingLegacy(
return ResourceTimingDeprecated(
timestamp=self.read_uint(reader),
duration=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) {
contextValue.player?.updateLists?.(session)
}
}, [session.events, session.errors])
}, [session.events, session.errors, contextValue.player])
const isPlayerReady = contextValue.store?.get().ready

View file

@ -139,8 +139,10 @@ export default class MessageManager {
}
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>) => {
if (e.type === EVENT_TYPES.LOCATION) {
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 initiator = this.readString(); if (initiator === null) { return resetPointer() }
return {
tp: MType.ResourceTimingLegacy,
tp: MType.ResourceTimingDeprecated,
timestamp,
duration,
ttfb,

View file

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

View file

@ -34,7 +34,7 @@ export const enum MType {
PerformanceTrack = 49,
StringDict = 50,
SetNodeAttributeDict = 51,
ResourceTimingLegacy = 53,
ResourceTimingDeprecated = 53,
ConnectionInformation = 54,
SetPageVisibility = 55,
LoadFontFace = 57,
@ -286,8 +286,8 @@ export interface RawSetNodeAttributeDict {
valueKey: number,
}
export interface RawResourceTimingLegacy {
tp: MType.ResourceTimingLegacy,
export interface RawResourceTimingDeprecated {
tp: MType.ResourceTimingDeprecated,
timestamp: number,
duration: 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,
50: MType.StringDict,
51: MType.SetNodeAttributeDict,
53: MType.ResourceTimingLegacy,
53: MType.ResourceTimingDeprecated,
54: MType.ConnectionInformation,
55: MType.SetPageVisibility,
57: MType.LoadFontFace,

View file

@ -271,7 +271,7 @@ type TrSetNodeAttributeDict = [
valueKey: number,
]
type TrResourceTimingLegacy = [
type TrResourceTimingDeprecated = [
type: 53,
timestamp: 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 {
switch(tMsg[0]) {
@ -766,7 +766,7 @@ export default function translate(tMsg: TrackerMessage): RawMessage | null {
case 53: {
return {
tp: MType.ResourceTimingLegacy,
tp: MType.ResourceTimingDeprecated,
timestamp: tMsg[1],
duration: tMsg[2],
ttfb: tMsg[3],

View file

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

View file

@ -41,7 +41,7 @@ export declare const enum Type {
PerformanceTrack = 49,
StringDict = 50,
SetNodeAttributeDict = 51,
ResourceTimingLegacy = 53,
ResourceTimingDeprecated = 53,
ConnectionInformation = 54,
SetPageVisibility = 55,
LoadFontFace = 57,
@ -338,8 +338,8 @@ export type SetNodeAttributeDict = [
/*valueKey:*/ number,
]
export type ResourceTimingLegacy = [
/*type:*/ Type.ResourceTimingLegacy,
export type ResourceTimingDeprecated = [
/*type:*/ Type.ResourceTimingDeprecated,
/*timestamp:*/ number,
/*duration:*/ 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

View file

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

View file

@ -60,7 +60,7 @@ export default function (app: App): void {
const sendImgError = app.safe(function (img: HTMLImageElement): void {
const resolvedSrc = resolveURL(img.src || '') // Src type is null sometimes. - is it true?
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])
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])
break