From e6ad085f2e917629c303905cd95724940a6e2fef Mon Sep 17 00:00:00 2001 From: Alex Kaminskii Date: Mon, 12 Dec 2022 15:47:11 +0100 Subject: [PATCH] refactor(mobs/backend):write ResourceTiming to devtools.mob --- backend/pkg/messages/filters.go | 2 +- .../web/messages/RawMessageReader.gen.ts | 22 +++++++++++++++++++ .../app/player/web/messages/message.gen.ts | 3 +++ frontend/app/player/web/messages/raw.gen.ts | 15 ++++++++++++- .../player/web/messages/tracker-legacy.gen.ts | 1 + .../app/player/web/messages/tracker.gen.ts | 14 ++++++++++++ mobs/messages.rb | 2 +- 7 files changed, 56 insertions(+), 3 deletions(-) diff --git a/backend/pkg/messages/filters.go b/backend/pkg/messages/filters.go index ee5a08d8e..6c96383c9 100644 --- a/backend/pkg/messages/filters.go +++ b/backend/pkg/messages/filters.go @@ -2,7 +2,7 @@ package messages func IsReplayerType(id int) bool { - return 80 != id && 81 != id && 82 != id && 1 != id && 3 != id && 17 != id && 23 != id && 24 != id && 25 != id && 26 != id && 27 != id && 28 != id && 29 != id && 30 != id && 31 != id && 32 != id && 33 != id && 35 != id && 42 != id && 52 != id && 53 != id && 56 != id && 62 != id && 63 != id && 64 != id && 66 != id && 78 != id && 126 != id && 127 != id && 107 != id && 91 != id && 92 != id && 94 != id && 95 != id && 97 != id && 98 != id && 99 != id && 101 != id && 104 != id && 110 != id && 111 != id + return 80 != id && 81 != id && 82 != id && 1 != id && 3 != id && 17 != id && 23 != id && 24 != id && 25 != id && 26 != id && 27 != id && 28 != id && 29 != id && 30 != id && 31 != id && 32 != id && 33 != id && 35 != id && 42 != id && 52 != id && 56 != id && 62 != id && 63 != id && 64 != id && 66 != id && 78 != id && 126 != id && 127 != id && 107 != id && 91 != id && 92 != id && 94 != id && 95 != id && 97 != id && 98 != id && 99 != id && 101 != id && 104 != id && 110 != id && 111 != id } func IsIOSType(id int) bool { diff --git a/frontend/app/player/web/messages/RawMessageReader.gen.ts b/frontend/app/player/web/messages/RawMessageReader.gen.ts index a0ee74548..5201913b9 100644 --- a/frontend/app/player/web/messages/RawMessageReader.gen.ts +++ b/frontend/app/player/web/messages/RawMessageReader.gen.ts @@ -371,6 +371,28 @@ export default class RawMessageReader extends PrimitiveReader { }; } + case 53: { + const timestamp = this.readUint(); if (timestamp === null) { return resetPointer() } + const duration = this.readUint(); if (duration === null) { return resetPointer() } + const ttfb = this.readUint(); if (ttfb === null) { return resetPointer() } + const headerSize = this.readUint(); if (headerSize === null) { return resetPointer() } + const encodedBodySize = this.readUint(); if (encodedBodySize === null) { return resetPointer() } + const decodedBodySize = this.readUint(); if (decodedBodySize === null) { return resetPointer() } + const url = this.readString(); if (url === null) { return resetPointer() } + const initiator = this.readString(); if (initiator === null) { return resetPointer() } + return { + tp: MType.ResourceTiming, + timestamp, + duration, + ttfb, + headerSize, + encodedBodySize, + decodedBodySize, + url, + initiator, + }; + } + case 54: { const downlink = this.readUint(); if (downlink === null) { return resetPointer() } const type = this.readString(); if (type === null) { return resetPointer() } diff --git a/frontend/app/player/web/messages/message.gen.ts b/frontend/app/player/web/messages/message.gen.ts index 7fd01f5f8..0900cc471 100644 --- a/frontend/app/player/web/messages/message.gen.ts +++ b/frontend/app/player/web/messages/message.gen.ts @@ -34,6 +34,7 @@ import type { RawNgRx, RawGraphQl, RawPerformanceTrack, + RawResourceTiming, RawConnectionInformation, RawSetPageVisibility, RawLoadFontFace, @@ -124,6 +125,8 @@ export type GraphQl = RawGraphQl & Timed export type PerformanceTrack = RawPerformanceTrack & Timed +export type ResourceTiming = RawResourceTiming & Timed + export type ConnectionInformation = RawConnectionInformation & Timed export type SetPageVisibility = RawSetPageVisibility & Timed diff --git a/frontend/app/player/web/messages/raw.gen.ts b/frontend/app/player/web/messages/raw.gen.ts index b245b86d6..2de1ae946 100644 --- a/frontend/app/player/web/messages/raw.gen.ts +++ b/frontend/app/player/web/messages/raw.gen.ts @@ -32,6 +32,7 @@ export const enum MType { NgRx = 47, GraphQl = 48, PerformanceTrack = 49, + ResourceTiming = 53, ConnectionInformation = 54, SetPageVisibility = 55, LoadFontFace = 57, @@ -266,6 +267,18 @@ export interface RawPerformanceTrack { usedJSHeapSize: number, } +export interface RawResourceTiming { + tp: MType.ResourceTiming, + timestamp: number, + duration: number, + ttfb: number, + headerSize: number, + encodedBodySize: number, + decodedBodySize: number, + url: string, + initiator: string, +} + export interface RawConnectionInformation { tp: MType.ConnectionInformation, downlink: number, @@ -461,4 +474,4 @@ export interface RawIosNetworkCall { } -export type RawMessage = RawTimestamp | RawSetPageLocation | RawSetViewportSize | RawSetViewportScroll | RawCreateDocument | RawCreateElementNode | RawCreateTextNode | RawMoveNode | RawRemoveNode | RawSetNodeAttribute | RawRemoveNodeAttribute | RawSetNodeData | RawSetCssData | RawSetNodeScroll | RawSetInputValue | RawSetInputChecked | RawMouseMove | RawNetworkRequest | RawConsoleLog | RawCssInsertRule | RawCssDeleteRule | RawFetch | RawProfiler | RawOTable | RawRedux | RawVuex | RawMobX | RawNgRx | RawGraphQl | RawPerformanceTrack | RawConnectionInformation | RawSetPageVisibility | RawLoadFontFace | RawSetNodeFocus | RawLongTask | RawSetNodeAttributeURLBased | RawSetCssDataURLBased | RawCssInsertRuleURLBased | RawMouseClick | RawCreateIFrameDocument | RawAdoptedSsReplaceURLBased | RawAdoptedSsReplace | RawAdoptedSsInsertRuleURLBased | RawAdoptedSsInsertRule | RawAdoptedSsDeleteRule | RawAdoptedSsAddOwner | RawAdoptedSsRemoveOwner | RawZustand | 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 | RawNetworkRequest | RawConsoleLog | RawCssInsertRule | RawCssDeleteRule | RawFetch | RawProfiler | RawOTable | RawRedux | RawVuex | RawMobX | RawNgRx | RawGraphQl | RawPerformanceTrack | RawResourceTiming | RawConnectionInformation | RawSetPageVisibility | RawLoadFontFace | RawSetNodeFocus | RawLongTask | RawSetNodeAttributeURLBased | RawSetCssDataURLBased | RawCssInsertRuleURLBased | RawMouseClick | RawCreateIFrameDocument | RawAdoptedSsReplaceURLBased | RawAdoptedSsReplace | RawAdoptedSsInsertRuleURLBased | RawAdoptedSsInsertRule | RawAdoptedSsDeleteRule | RawAdoptedSsAddOwner | RawAdoptedSsRemoveOwner | RawZustand | RawIosSessionStart | RawIosCustomEvent | RawIosScreenChanges | RawIosClickEvent | RawIosPerformanceEvent | RawIosLog | RawIosNetworkCall; diff --git a/frontend/app/player/web/messages/tracker-legacy.gen.ts b/frontend/app/player/web/messages/tracker-legacy.gen.ts index fe8ca6062..3d5f81b0e 100644 --- a/frontend/app/player/web/messages/tracker-legacy.gen.ts +++ b/frontend/app/player/web/messages/tracker-legacy.gen.ts @@ -33,6 +33,7 @@ export const TP_MAP = { 47: MType.NgRx, 48: MType.GraphQl, 49: MType.PerformanceTrack, + 53: MType.ResourceTiming, 54: MType.ConnectionInformation, 55: MType.SetPageVisibility, 57: MType.LoadFontFace, diff --git a/frontend/app/player/web/messages/tracker.gen.ts b/frontend/app/player/web/messages/tracker.gen.ts index 01d8944e0..0788b85d1 100644 --- a/frontend/app/player/web/messages/tracker.gen.ts +++ b/frontend/app/player/web/messages/tracker.gen.ts @@ -687,6 +687,20 @@ export default function translate(tMsg: TrackerMessage): RawMessage | null { } } + case 53: { + return { + tp: MType.ResourceTiming, + timestamp: tMsg[1], + duration: tMsg[2], + ttfb: tMsg[3], + headerSize: tMsg[4], + encodedBodySize: tMsg[5], + decodedBodySize: tMsg[6], + url: tMsg[7], + initiator: tMsg[8], + } + } + case 54: { return { tp: MType.ConnectionInformation, diff --git a/mobs/messages.rb b/mobs/messages.rb index dbff393e0..7090aaeb1 100644 --- a/mobs/messages.rb +++ b/mobs/messages.rb @@ -340,7 +340,7 @@ end message 52, 'DOMDrop', :tracker => false, :replayer => false do uint 'Timestamp' end -message 53, 'ResourceTiming', :replayer => false do +message 53, 'ResourceTiming', :replayer => :devtools do uint 'Timestamp' uint 'Duration' uint 'TTFB'