[DB] added url field for click rage issues (#925)
* feat(backend): added url field for click rage issues
This commit is contained in:
parent
a6e4779652
commit
da7d2038ef
14 changed files with 1858 additions and 1731 deletions
|
|
@ -22,6 +22,7 @@ type ClickRageDetector struct {
|
|||
firstInARawTimestamp uint64
|
||||
firstInARawMessageId uint64
|
||||
countsInARow int
|
||||
url string
|
||||
}
|
||||
|
||||
func (crd *ClickRageDetector) reset() {
|
||||
|
|
@ -30,6 +31,7 @@ func (crd *ClickRageDetector) reset() {
|
|||
crd.firstInARawTimestamp = 0
|
||||
crd.firstInARawMessageId = 0
|
||||
crd.countsInARow = 0
|
||||
crd.url = ""
|
||||
}
|
||||
|
||||
func (crd *ClickRageDetector) Build() Message {
|
||||
|
|
@ -45,6 +47,7 @@ func (crd *ClickRageDetector) Build() Message {
|
|||
Payload: string(payload),
|
||||
Timestamp: crd.firstInARawTimestamp,
|
||||
MessageID: crd.firstInARawMessageId,
|
||||
URL: crd.url,
|
||||
}
|
||||
return event
|
||||
}
|
||||
|
|
@ -54,6 +57,9 @@ func (crd *ClickRageDetector) Build() Message {
|
|||
func (crd *ClickRageDetector) Handle(message Message, messageID uint64, timestamp uint64) Message {
|
||||
switch msg := message.(type) {
|
||||
case *MouseClick:
|
||||
if crd.url == "" && msg.Url != "" {
|
||||
crd.url = msg.Url
|
||||
}
|
||||
// TODO: check if we it is ok to capture clickRage event without the connected ClickEvent in db.
|
||||
if msg.Label == "" {
|
||||
return crd.Build()
|
||||
|
|
@ -69,6 +75,9 @@ func (crd *ClickRageDetector) Handle(message Message, messageID uint64, timestam
|
|||
crd.firstInARawTimestamp = timestamp
|
||||
crd.firstInARawMessageId = messageID
|
||||
crd.countsInARow = 1
|
||||
if crd.url == "" && msg.Url != "" {
|
||||
crd.url = msg.Url
|
||||
}
|
||||
return event
|
||||
}
|
||||
return nil
|
||||
|
|
|
|||
|
|
@ -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 && 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 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 && 80 != id && 81 != id && 82 != id && 125 != 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 {
|
||||
|
|
|
|||
|
|
@ -25,6 +25,16 @@ func transformDeprecated(msg Message) Message {
|
|||
Timestamp: m.Timestamp,
|
||||
Duration: m.Duration,
|
||||
}
|
||||
case *IssueEventDeprecated:
|
||||
return &IssueEvent{
|
||||
MessageID: m.MessageID,
|
||||
Timestamp: m.Timestamp,
|
||||
Type: m.Type,
|
||||
ContextString: m.ContextString,
|
||||
Context: m.Context,
|
||||
Payload: m.Payload,
|
||||
URL: "",
|
||||
}
|
||||
}
|
||||
return msg
|
||||
}
|
||||
|
|
|
|||
|
|
@ -2,9 +2,6 @@
|
|||
package messages
|
||||
|
||||
const (
|
||||
MsgBatchMeta = 80
|
||||
MsgBatchMetadata = 81
|
||||
MsgPartitionedMessage = 82
|
||||
MsgTimestamp = 0
|
||||
MsgSessionStart = 1
|
||||
MsgSessionEndDeprecated = 3
|
||||
|
|
@ -61,7 +58,7 @@ const (
|
|||
MsgLongTask = 59
|
||||
MsgSetNodeAttributeURLBased = 60
|
||||
MsgSetCSSDataURLBased = 61
|
||||
MsgIssueEvent = 62
|
||||
MsgIssueEventDeprecated = 62
|
||||
MsgTechnicalInfo = 63
|
||||
MsgCustomIssue = 64
|
||||
MsgAssetCache = 66
|
||||
|
|
@ -77,6 +74,10 @@ const (
|
|||
MsgAdoptedSSRemoveOwner = 77
|
||||
MsgZustand = 79
|
||||
MsgJSException = 78
|
||||
MsgBatchMeta = 80
|
||||
MsgBatchMetadata = 81
|
||||
MsgPartitionedMessage = 82
|
||||
MsgIssueEvent = 125
|
||||
MsgSessionEnd = 126
|
||||
MsgSessionSearch = 127
|
||||
MsgIOSBatchMeta = 107
|
||||
|
|
@ -100,82 +101,6 @@ const (
|
|||
MsgIOSIssueEvent = 111
|
||||
)
|
||||
|
||||
type BatchMeta struct {
|
||||
message
|
||||
PageNo uint64
|
||||
FirstIndex uint64
|
||||
Timestamp int64
|
||||
}
|
||||
|
||||
func (msg *BatchMeta) Encode() []byte {
|
||||
buf := make([]byte, 31)
|
||||
buf[0] = 80
|
||||
p := 1
|
||||
p = WriteUint(msg.PageNo, buf, p)
|
||||
p = WriteUint(msg.FirstIndex, buf, p)
|
||||
p = WriteInt(msg.Timestamp, buf, p)
|
||||
return buf[:p]
|
||||
}
|
||||
|
||||
func (msg *BatchMeta) Decode() Message {
|
||||
return msg
|
||||
}
|
||||
|
||||
func (msg *BatchMeta) TypeID() int {
|
||||
return 80
|
||||
}
|
||||
|
||||
type BatchMetadata struct {
|
||||
message
|
||||
Version uint64
|
||||
PageNo uint64
|
||||
FirstIndex uint64
|
||||
Timestamp int64
|
||||
Location string
|
||||
}
|
||||
|
||||
func (msg *BatchMetadata) Encode() []byte {
|
||||
buf := make([]byte, 51+len(msg.Location))
|
||||
buf[0] = 81
|
||||
p := 1
|
||||
p = WriteUint(msg.Version, buf, p)
|
||||
p = WriteUint(msg.PageNo, buf, p)
|
||||
p = WriteUint(msg.FirstIndex, buf, p)
|
||||
p = WriteInt(msg.Timestamp, buf, p)
|
||||
p = WriteString(msg.Location, buf, p)
|
||||
return buf[:p]
|
||||
}
|
||||
|
||||
func (msg *BatchMetadata) Decode() Message {
|
||||
return msg
|
||||
}
|
||||
|
||||
func (msg *BatchMetadata) TypeID() int {
|
||||
return 81
|
||||
}
|
||||
|
||||
type PartitionedMessage struct {
|
||||
message
|
||||
PartNo uint64
|
||||
PartTotal uint64
|
||||
}
|
||||
|
||||
func (msg *PartitionedMessage) Encode() []byte {
|
||||
buf := make([]byte, 21)
|
||||
buf[0] = 82
|
||||
p := 1
|
||||
p = WriteUint(msg.PartNo, buf, p)
|
||||
p = WriteUint(msg.PartTotal, buf, p)
|
||||
return buf[:p]
|
||||
}
|
||||
|
||||
func (msg *PartitionedMessage) Decode() Message {
|
||||
return msg
|
||||
}
|
||||
|
||||
func (msg *PartitionedMessage) TypeID() int {
|
||||
return 82
|
||||
}
|
||||
|
||||
type Timestamp struct {
|
||||
message
|
||||
|
|
@ -343,6 +268,7 @@ func (msg *SetViewportScroll) TypeID() int {
|
|||
|
||||
type CreateDocument struct {
|
||||
message
|
||||
|
||||
}
|
||||
|
||||
func (msg *CreateDocument) Encode() []byte {
|
||||
|
|
@ -1672,7 +1598,7 @@ func (msg *SetCSSDataURLBased) TypeID() int {
|
|||
return 61
|
||||
}
|
||||
|
||||
type IssueEvent struct {
|
||||
type IssueEventDeprecated struct {
|
||||
message
|
||||
MessageID uint64
|
||||
Timestamp uint64
|
||||
|
|
@ -1682,7 +1608,7 @@ type IssueEvent struct {
|
|||
Payload string
|
||||
}
|
||||
|
||||
func (msg *IssueEvent) Encode() []byte {
|
||||
func (msg *IssueEventDeprecated) Encode() []byte {
|
||||
buf := make([]byte, 61+len(msg.Type)+len(msg.ContextString)+len(msg.Context)+len(msg.Payload))
|
||||
buf[0] = 62
|
||||
p := 1
|
||||
|
|
@ -1695,11 +1621,11 @@ func (msg *IssueEvent) Encode() []byte {
|
|||
return buf[:p]
|
||||
}
|
||||
|
||||
func (msg *IssueEvent) Decode() Message {
|
||||
func (msg *IssueEventDeprecated) Decode() Message {
|
||||
return msg
|
||||
}
|
||||
|
||||
func (msg *IssueEvent) TypeID() int {
|
||||
func (msg *IssueEventDeprecated) TypeID() int {
|
||||
return 62
|
||||
}
|
||||
|
||||
|
|
@ -2066,6 +1992,116 @@ func (msg *JSException) TypeID() int {
|
|||
return 78
|
||||
}
|
||||
|
||||
type BatchMeta struct {
|
||||
message
|
||||
PageNo uint64
|
||||
FirstIndex uint64
|
||||
Timestamp int64
|
||||
}
|
||||
|
||||
func (msg *BatchMeta) Encode() []byte {
|
||||
buf := make([]byte, 31)
|
||||
buf[0] = 80
|
||||
p := 1
|
||||
p = WriteUint(msg.PageNo, buf, p)
|
||||
p = WriteUint(msg.FirstIndex, buf, p)
|
||||
p = WriteInt(msg.Timestamp, buf, p)
|
||||
return buf[:p]
|
||||
}
|
||||
|
||||
func (msg *BatchMeta) Decode() Message {
|
||||
return msg
|
||||
}
|
||||
|
||||
func (msg *BatchMeta) TypeID() int {
|
||||
return 80
|
||||
}
|
||||
|
||||
type BatchMetadata struct {
|
||||
message
|
||||
Version uint64
|
||||
PageNo uint64
|
||||
FirstIndex uint64
|
||||
Timestamp int64
|
||||
Location string
|
||||
}
|
||||
|
||||
func (msg *BatchMetadata) Encode() []byte {
|
||||
buf := make([]byte, 51+len(msg.Location))
|
||||
buf[0] = 81
|
||||
p := 1
|
||||
p = WriteUint(msg.Version, buf, p)
|
||||
p = WriteUint(msg.PageNo, buf, p)
|
||||
p = WriteUint(msg.FirstIndex, buf, p)
|
||||
p = WriteInt(msg.Timestamp, buf, p)
|
||||
p = WriteString(msg.Location, buf, p)
|
||||
return buf[:p]
|
||||
}
|
||||
|
||||
func (msg *BatchMetadata) Decode() Message {
|
||||
return msg
|
||||
}
|
||||
|
||||
func (msg *BatchMetadata) TypeID() int {
|
||||
return 81
|
||||
}
|
||||
|
||||
type PartitionedMessage struct {
|
||||
message
|
||||
PartNo uint64
|
||||
PartTotal uint64
|
||||
}
|
||||
|
||||
func (msg *PartitionedMessage) Encode() []byte {
|
||||
buf := make([]byte, 21)
|
||||
buf[0] = 82
|
||||
p := 1
|
||||
p = WriteUint(msg.PartNo, buf, p)
|
||||
p = WriteUint(msg.PartTotal, buf, p)
|
||||
return buf[:p]
|
||||
}
|
||||
|
||||
func (msg *PartitionedMessage) Decode() Message {
|
||||
return msg
|
||||
}
|
||||
|
||||
func (msg *PartitionedMessage) TypeID() int {
|
||||
return 82
|
||||
}
|
||||
|
||||
type IssueEvent struct {
|
||||
message
|
||||
MessageID uint64
|
||||
Timestamp uint64
|
||||
Type string
|
||||
ContextString string
|
||||
Context string
|
||||
Payload string
|
||||
URL string
|
||||
}
|
||||
|
||||
func (msg *IssueEvent) Encode() []byte {
|
||||
buf := make([]byte, 71+len(msg.Type)+len(msg.ContextString)+len(msg.Context)+len(msg.Payload)+len(msg.URL))
|
||||
buf[0] = 125
|
||||
p := 1
|
||||
p = WriteUint(msg.MessageID, buf, p)
|
||||
p = WriteUint(msg.Timestamp, buf, p)
|
||||
p = WriteString(msg.Type, buf, p)
|
||||
p = WriteString(msg.ContextString, buf, p)
|
||||
p = WriteString(msg.Context, buf, p)
|
||||
p = WriteString(msg.Payload, buf, p)
|
||||
p = WriteString(msg.URL, buf, p)
|
||||
return buf[:p]
|
||||
}
|
||||
|
||||
func (msg *IssueEvent) Decode() Message {
|
||||
return msg
|
||||
}
|
||||
|
||||
func (msg *IssueEvent) TypeID() int {
|
||||
return 125
|
||||
}
|
||||
|
||||
type SessionEnd struct {
|
||||
message
|
||||
Timestamp uint64
|
||||
|
|
@ -2664,3 +2700,4 @@ func (msg *IOSIssueEvent) Decode() Message {
|
|||
func (msg *IOSIssueEvent) TypeID() int {
|
||||
return 111
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -5,54 +5,6 @@ import (
|
|||
"fmt"
|
||||
)
|
||||
|
||||
func DecodeBatchMeta(reader BytesReader) (Message, error) {
|
||||
var err error = nil
|
||||
msg := &BatchMeta{}
|
||||
if msg.PageNo, err = reader.ReadUint(); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
if msg.FirstIndex, err = reader.ReadUint(); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
if msg.Timestamp, err = reader.ReadInt(); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return msg, err
|
||||
}
|
||||
|
||||
func DecodeBatchMetadata(reader BytesReader) (Message, error) {
|
||||
var err error = nil
|
||||
msg := &BatchMetadata{}
|
||||
if msg.Version, err = reader.ReadUint(); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
if msg.PageNo, err = reader.ReadUint(); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
if msg.FirstIndex, err = reader.ReadUint(); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
if msg.Timestamp, err = reader.ReadInt(); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
if msg.Location, err = reader.ReadString(); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return msg, err
|
||||
}
|
||||
|
||||
func DecodePartitionedMessage(reader BytesReader) (Message, error) {
|
||||
var err error = nil
|
||||
msg := &PartitionedMessage{}
|
||||
if msg.PartNo, err = reader.ReadUint(); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
if msg.PartTotal, err = reader.ReadUint(); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return msg, err
|
||||
}
|
||||
|
||||
func DecodeTimestamp(reader BytesReader) (Message, error) {
|
||||
var err error = nil
|
||||
msg := &Timestamp{}
|
||||
|
|
@ -1035,9 +987,9 @@ func DecodeSetCSSDataURLBased(reader BytesReader) (Message, error) {
|
|||
return msg, err
|
||||
}
|
||||
|
||||
func DecodeIssueEvent(reader BytesReader) (Message, error) {
|
||||
func DecodeIssueEventDeprecated(reader BytesReader) (Message, error) {
|
||||
var err error = nil
|
||||
msg := &IssueEvent{}
|
||||
msg := &IssueEventDeprecated{}
|
||||
if msg.MessageID, err = reader.ReadUint(); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
|
@ -1266,6 +1218,81 @@ func DecodeJSException(reader BytesReader) (Message, error) {
|
|||
return msg, err
|
||||
}
|
||||
|
||||
func DecodeBatchMeta(reader BytesReader) (Message, error) {
|
||||
var err error = nil
|
||||
msg := &BatchMeta{}
|
||||
if msg.PageNo, err = reader.ReadUint(); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
if msg.FirstIndex, err = reader.ReadUint(); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
if msg.Timestamp, err = reader.ReadInt(); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return msg, err
|
||||
}
|
||||
|
||||
func DecodeBatchMetadata(reader BytesReader) (Message, error) {
|
||||
var err error = nil
|
||||
msg := &BatchMetadata{}
|
||||
if msg.Version, err = reader.ReadUint(); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
if msg.PageNo, err = reader.ReadUint(); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
if msg.FirstIndex, err = reader.ReadUint(); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
if msg.Timestamp, err = reader.ReadInt(); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
if msg.Location, err = reader.ReadString(); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return msg, err
|
||||
}
|
||||
|
||||
func DecodePartitionedMessage(reader BytesReader) (Message, error) {
|
||||
var err error = nil
|
||||
msg := &PartitionedMessage{}
|
||||
if msg.PartNo, err = reader.ReadUint(); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
if msg.PartTotal, err = reader.ReadUint(); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return msg, err
|
||||
}
|
||||
|
||||
func DecodeIssueEvent(reader BytesReader) (Message, error) {
|
||||
var err error = nil
|
||||
msg := &IssueEvent{}
|
||||
if msg.MessageID, err = reader.ReadUint(); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
if msg.Timestamp, err = reader.ReadUint(); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
if msg.Type, err = reader.ReadString(); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
if msg.ContextString, err = reader.ReadString(); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
if msg.Context, err = reader.ReadString(); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
if msg.Payload, err = reader.ReadString(); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
if msg.URL, err = reader.ReadString(); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return msg, err
|
||||
}
|
||||
|
||||
func DecodeSessionEnd(reader BytesReader) (Message, error) {
|
||||
var err error = nil
|
||||
msg := &SessionEnd{}
|
||||
|
|
@ -1694,12 +1721,6 @@ func DecodeIOSIssueEvent(reader BytesReader) (Message, error) {
|
|||
|
||||
func ReadMessage(t uint64, reader BytesReader) (Message, error) {
|
||||
switch t {
|
||||
case 80:
|
||||
return DecodeBatchMeta(reader)
|
||||
case 81:
|
||||
return DecodeBatchMetadata(reader)
|
||||
case 82:
|
||||
return DecodePartitionedMessage(reader)
|
||||
case 0:
|
||||
return DecodeTimestamp(reader)
|
||||
case 1:
|
||||
|
|
@ -1813,7 +1834,7 @@ func ReadMessage(t uint64, reader BytesReader) (Message, error) {
|
|||
case 61:
|
||||
return DecodeSetCSSDataURLBased(reader)
|
||||
case 62:
|
||||
return DecodeIssueEvent(reader)
|
||||
return DecodeIssueEventDeprecated(reader)
|
||||
case 63:
|
||||
return DecodeTechnicalInfo(reader)
|
||||
case 64:
|
||||
|
|
@ -1844,6 +1865,14 @@ func ReadMessage(t uint64, reader BytesReader) (Message, error) {
|
|||
return DecodeZustand(reader)
|
||||
case 78:
|
||||
return DecodeJSException(reader)
|
||||
case 80:
|
||||
return DecodeBatchMeta(reader)
|
||||
case 81:
|
||||
return DecodeBatchMetadata(reader)
|
||||
case 82:
|
||||
return DecodePartitionedMessage(reader)
|
||||
case 125:
|
||||
return DecodeIssueEvent(reader)
|
||||
case 126:
|
||||
return DecodeSessionEnd(reader)
|
||||
case 127:
|
||||
|
|
|
|||
|
|
@ -40,6 +40,13 @@ func SplitMessages(data []byte) ([]*msgInfo, error) {
|
|||
return nil, fmt.Errorf("read message type err: %s", err)
|
||||
}
|
||||
|
||||
if msgType == MsgRedux {
|
||||
log.Printf("redux")
|
||||
}
|
||||
if msgType == MsgFetch {
|
||||
log.Printf("fetch")
|
||||
}
|
||||
|
||||
// Read message body
|
||||
_, err = ReadMessage(msgType, reader)
|
||||
if err != nil {
|
||||
|
|
|
|||
|
|
@ -87,7 +87,7 @@ var batches = map[string]string{
|
|||
"requests": "INSERT INTO experimental.events (session_id, project_id, message_id, datetime, url, request_body, response_body, status, method, duration, success, event_type) VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)",
|
||||
"custom": "INSERT INTO experimental.events (session_id, project_id, message_id, datetime, name, payload, event_type) VALUES (?, ?, ?, ?, ?, ?, ?)",
|
||||
"graphql": "INSERT INTO experimental.events (session_id, project_id, message_id, datetime, name, request_body, response_body, event_type) VALUES (?, ?, ?, ?, ?, ?, ?, ?)",
|
||||
"issuesEvents": "INSERT INTO experimental.events (session_id, project_id, message_id, datetime, issue_id, issue_type, event_type) VALUES (?, ?, ?, ?, ?, ?, ?)",
|
||||
"issuesEvents": "INSERT INTO experimental.events (session_id, project_id, message_id, datetime, issue_id, issue_type, event_type, url) VALUES (?, ?, ?, ?, ?, ?, ?, ?)",
|
||||
"issues": "INSERT INTO experimental.issues (project_id, issue_id, type, context_string) VALUES (?, ?, ?, ?)",
|
||||
}
|
||||
|
||||
|
|
@ -132,6 +132,7 @@ func (c *connectorImpl) InsertIssue(session *types.Session, msg *messages.IssueE
|
|||
issueID,
|
||||
msg.Type,
|
||||
"ISSUE",
|
||||
msg.URL,
|
||||
); err != nil {
|
||||
c.checkError("issuesEvents", err)
|
||||
return fmt.Errorf("can't append to issuesEvents batch: %s", err)
|
||||
|
|
|
|||
|
|
@ -6,34 +6,6 @@ class Message(ABC):
|
|||
pass
|
||||
|
||||
|
||||
class BatchMeta(Message):
|
||||
__id__ = 80
|
||||
|
||||
def __init__(self, page_no, first_index, timestamp):
|
||||
self.page_no = page_no
|
||||
self.first_index = first_index
|
||||
self.timestamp = timestamp
|
||||
|
||||
|
||||
class BatchMetadata(Message):
|
||||
__id__ = 81
|
||||
|
||||
def __init__(self, version, page_no, first_index, timestamp, location):
|
||||
self.version = version
|
||||
self.page_no = page_no
|
||||
self.first_index = first_index
|
||||
self.timestamp = timestamp
|
||||
self.location = location
|
||||
|
||||
|
||||
class PartitionedMessage(Message):
|
||||
__id__ = 82
|
||||
|
||||
def __init__(self, part_no, part_total):
|
||||
self.part_no = part_no
|
||||
self.part_total = part_total
|
||||
|
||||
|
||||
class Timestamp(Message):
|
||||
__id__ = 0
|
||||
|
||||
|
|
@ -586,7 +558,7 @@ class SetCSSDataURLBased(Message):
|
|||
self.base_url = base_url
|
||||
|
||||
|
||||
class IssueEvent(Message):
|
||||
class IssueEventDeprecated(Message):
|
||||
__id__ = 62
|
||||
|
||||
def __init__(self, message_id, timestamp, type, context_string, context, payload):
|
||||
|
|
@ -727,6 +699,47 @@ class JSException(Message):
|
|||
self.metadata = metadata
|
||||
|
||||
|
||||
class BatchMeta(Message):
|
||||
__id__ = 80
|
||||
|
||||
def __init__(self, page_no, first_index, timestamp):
|
||||
self.page_no = page_no
|
||||
self.first_index = first_index
|
||||
self.timestamp = timestamp
|
||||
|
||||
|
||||
class BatchMetadata(Message):
|
||||
__id__ = 81
|
||||
|
||||
def __init__(self, version, page_no, first_index, timestamp, location):
|
||||
self.version = version
|
||||
self.page_no = page_no
|
||||
self.first_index = first_index
|
||||
self.timestamp = timestamp
|
||||
self.location = location
|
||||
|
||||
|
||||
class PartitionedMessage(Message):
|
||||
__id__ = 82
|
||||
|
||||
def __init__(self, part_no, part_total):
|
||||
self.part_no = part_no
|
||||
self.part_total = part_total
|
||||
|
||||
|
||||
class IssueEvent(Message):
|
||||
__id__ = 125
|
||||
|
||||
def __init__(self, message_id, timestamp, type, context_string, context, payload, url):
|
||||
self.message_id = message_id
|
||||
self.timestamp = timestamp
|
||||
self.type = type
|
||||
self.context_string = context_string
|
||||
self.context = context
|
||||
self.payload = payload
|
||||
self.url = url
|
||||
|
||||
|
||||
class SessionEnd(Message):
|
||||
__id__ = 126
|
||||
|
||||
|
|
|
|||
|
|
@ -76,28 +76,6 @@ class MessageCodec(Codec):
|
|||
|
||||
def read_head_message(self, reader: io.BytesIO, message_id) -> Message:
|
||||
|
||||
if message_id == 80:
|
||||
return BatchMeta(
|
||||
page_no=self.read_uint(reader),
|
||||
first_index=self.read_uint(reader),
|
||||
timestamp=self.read_int(reader)
|
||||
)
|
||||
|
||||
if message_id == 81:
|
||||
return BatchMetadata(
|
||||
version=self.read_uint(reader),
|
||||
page_no=self.read_uint(reader),
|
||||
first_index=self.read_uint(reader),
|
||||
timestamp=self.read_int(reader),
|
||||
location=self.read_string(reader)
|
||||
)
|
||||
|
||||
if message_id == 82:
|
||||
return PartitionedMessage(
|
||||
part_no=self.read_uint(reader),
|
||||
part_total=self.read_uint(reader)
|
||||
)
|
||||
|
||||
if message_id == 0:
|
||||
return Timestamp(
|
||||
timestamp=self.read_uint(reader)
|
||||
|
|
@ -539,7 +517,7 @@ class MessageCodec(Codec):
|
|||
)
|
||||
|
||||
if message_id == 62:
|
||||
return IssueEvent(
|
||||
return IssueEventDeprecated(
|
||||
message_id=self.read_uint(reader),
|
||||
timestamp=self.read_uint(reader),
|
||||
type=self.read_string(reader),
|
||||
|
|
@ -647,6 +625,39 @@ class MessageCodec(Codec):
|
|||
metadata=self.read_string(reader)
|
||||
)
|
||||
|
||||
if message_id == 80:
|
||||
return BatchMeta(
|
||||
page_no=self.read_uint(reader),
|
||||
first_index=self.read_uint(reader),
|
||||
timestamp=self.read_int(reader)
|
||||
)
|
||||
|
||||
if message_id == 81:
|
||||
return BatchMetadata(
|
||||
version=self.read_uint(reader),
|
||||
page_no=self.read_uint(reader),
|
||||
first_index=self.read_uint(reader),
|
||||
timestamp=self.read_int(reader),
|
||||
location=self.read_string(reader)
|
||||
)
|
||||
|
||||
if message_id == 82:
|
||||
return PartitionedMessage(
|
||||
part_no=self.read_uint(reader),
|
||||
part_total=self.read_uint(reader)
|
||||
)
|
||||
|
||||
if message_id == 125:
|
||||
return IssueEvent(
|
||||
message_id=self.read_uint(reader),
|
||||
timestamp=self.read_uint(reader),
|
||||
type=self.read_string(reader),
|
||||
context_string=self.read_string(reader),
|
||||
context=self.read_string(reader),
|
||||
payload=self.read_string(reader),
|
||||
url=self.read_string(reader)
|
||||
)
|
||||
|
||||
if message_id == 126:
|
||||
return SessionEnd(
|
||||
timestamp=self.read_uint(reader),
|
||||
|
|
|
|||
|
|
@ -5,21 +5,6 @@ import type { RawMessage } from './raw.gen'
|
|||
import { MType } from './raw.gen'
|
||||
|
||||
|
||||
type TrBatchMetadata = [
|
||||
type: 81,
|
||||
version: number,
|
||||
pageNo: number,
|
||||
firstIndex: number,
|
||||
timestamp: number,
|
||||
location: string,
|
||||
]
|
||||
|
||||
type TrPartitionedMessage = [
|
||||
type: 82,
|
||||
partNo: number,
|
||||
partTotal: number,
|
||||
]
|
||||
|
||||
type TrTimestamp = [
|
||||
type: 0,
|
||||
timestamp: number,
|
||||
|
|
@ -423,8 +408,23 @@ type TrJSException = [
|
|||
metadata: string,
|
||||
]
|
||||
|
||||
type TrBatchMetadata = [
|
||||
type: 81,
|
||||
version: number,
|
||||
pageNo: number,
|
||||
firstIndex: number,
|
||||
timestamp: number,
|
||||
location: string,
|
||||
]
|
||||
|
||||
export type TrackerMessage = TrBatchMetadata | TrPartitionedMessage | TrTimestamp | TrSetPageLocation | TrSetViewportSize | TrSetViewportScroll | TrCreateDocument | TrCreateElementNode | TrCreateTextNode | TrMoveNode | TrRemoveNode | TrSetNodeAttribute | TrRemoveNodeAttribute | TrSetNodeData | TrSetNodeScroll | TrSetInputTarget | TrSetInputValue | TrSetInputChecked | TrMouseMove | TrNetworkRequest | TrConsoleLog | TrPageLoadTiming | TrPageRenderTiming | TrJSExceptionDeprecated | TrCustomEvent | TrUserID | TrUserAnonymousID | TrMetadata | TrCSSInsertRule | TrCSSDeleteRule | TrFetch | TrProfiler | TrOTable | TrStateAction | TrRedux | TrVuex | TrMobX | TrNgRx | TrGraphQL | TrPerformanceTrack | TrResourceTiming | TrConnectionInformation | TrSetPageVisibility | TrLoadFontFace | TrSetNodeFocus | TrLongTask | TrSetNodeAttributeURLBased | TrSetCSSDataURLBased | TrTechnicalInfo | TrCustomIssue | TrCSSInsertRuleURLBased | TrMouseClick | TrCreateIFrameDocument | TrAdoptedSSReplaceURLBased | TrAdoptedSSInsertRuleURLBased | TrAdoptedSSDeleteRule | TrAdoptedSSAddOwner | TrAdoptedSSRemoveOwner | TrZustand | TrJSException
|
||||
type TrPartitionedMessage = [
|
||||
type: 82,
|
||||
partNo: number,
|
||||
partTotal: number,
|
||||
]
|
||||
|
||||
|
||||
export type TrackerMessage = TrTimestamp | TrSetPageLocation | TrSetViewportSize | TrSetViewportScroll | TrCreateDocument | TrCreateElementNode | TrCreateTextNode | TrMoveNode | TrRemoveNode | TrSetNodeAttribute | TrRemoveNodeAttribute | TrSetNodeData | TrSetNodeScroll | TrSetInputTarget | TrSetInputValue | TrSetInputChecked | TrMouseMove | TrNetworkRequest | TrConsoleLog | TrPageLoadTiming | TrPageRenderTiming | TrJSExceptionDeprecated | TrCustomEvent | TrUserID | TrUserAnonymousID | TrMetadata | TrCSSInsertRule | TrCSSDeleteRule | TrFetch | TrProfiler | TrOTable | TrStateAction | TrRedux | TrVuex | TrMobX | TrNgRx | TrGraphQL | TrPerformanceTrack | TrResourceTiming | TrConnectionInformation | TrSetPageVisibility | TrLoadFontFace | TrSetNodeFocus | TrLongTask | TrSetNodeAttributeURLBased | TrSetCSSDataURLBased | TrTechnicalInfo | TrCustomIssue | TrCSSInsertRuleURLBased | TrMouseClick | TrCreateIFrameDocument | TrAdoptedSSReplaceURLBased | TrAdoptedSSInsertRuleURLBased | TrAdoptedSSDeleteRule | TrAdoptedSSAddOwner | TrAdoptedSSRemoveOwner | TrZustand | TrJSException | TrBatchMetadata | TrPartitionedMessage
|
||||
|
||||
export default function translate(tMsg: TrackerMessage): RawMessage | null {
|
||||
switch(tMsg[0]) {
|
||||
|
|
|
|||
|
|
@ -1,27 +1,4 @@
|
|||
# Special one for Batch Metadata. Message id could define the version
|
||||
|
||||
# Deprecated since tracker 3.6.0 in favor of BatchMetadata
|
||||
message 80, 'BatchMeta', :replayer => false, :tracker => false do
|
||||
uint 'PageNo'
|
||||
uint 'FirstIndex'
|
||||
int 'Timestamp'
|
||||
end
|
||||
|
||||
# since tracker 3.6.0 TODO: for webworker only
|
||||
message 81, 'BatchMetadata', :replayer => false do
|
||||
uint 'Version'
|
||||
uint 'PageNo'
|
||||
uint 'FirstIndex'
|
||||
int 'Timestamp'
|
||||
string 'Location'
|
||||
end
|
||||
|
||||
# since tracker 3.6.0
|
||||
message 82, 'PartitionedMessage', :replayer => false do
|
||||
uint 'PartNo'
|
||||
uint 'PartTotal'
|
||||
end
|
||||
|
||||
# OpenReplay messages definition
|
||||
|
||||
message 0, 'Timestamp' do
|
||||
uint 'Timestamp'
|
||||
|
|
@ -408,7 +385,7 @@ message 61, 'SetCSSDataURLBased' do
|
|||
string 'Data'
|
||||
string 'BaseURL'
|
||||
end
|
||||
message 62, 'IssueEvent', :replayer => false, :tracker => false do
|
||||
message 62, 'IssueEventDeprecated', :replayer => false, :tracker => false do
|
||||
uint 'MessageID'
|
||||
uint 'Timestamp'
|
||||
string 'Type'
|
||||
|
|
@ -493,15 +470,48 @@ message 78, 'JSException', :replayer => false do
|
|||
string 'Metadata'
|
||||
end
|
||||
|
||||
# 80 -- 90 reserved
|
||||
|
||||
# Special one for Batch Metadata. Message id could define the version
|
||||
|
||||
# Deprecated since tracker 3.6.0 in favor of BatchMetadata
|
||||
message 80, 'BatchMeta', :replayer => false, :tracker => false do
|
||||
uint 'PageNo'
|
||||
uint 'FirstIndex'
|
||||
int 'Timestamp'
|
||||
end
|
||||
|
||||
# since tracker 3.6.0 TODO: for webworker only
|
||||
message 81, 'BatchMetadata', :replayer => false do
|
||||
uint 'Version'
|
||||
uint 'PageNo'
|
||||
uint 'FirstIndex'
|
||||
int 'Timestamp'
|
||||
string 'Location'
|
||||
end
|
||||
|
||||
# since tracker 3.6.0
|
||||
message 82, 'PartitionedMessage', :replayer => false do
|
||||
uint 'PartNo'
|
||||
uint 'PartTotal'
|
||||
end
|
||||
|
||||
message 125, 'IssueEvent', :replayer => false, :tracker => false do
|
||||
uint 'MessageID'
|
||||
uint 'Timestamp'
|
||||
string 'Type'
|
||||
string 'ContextString'
|
||||
string 'Context'
|
||||
string 'Payload'
|
||||
string 'URL'
|
||||
end
|
||||
|
||||
message 126, 'SessionEnd', :tracker => false, :replayer => false do
|
||||
uint 'Timestamp'
|
||||
string 'EncryptionKey'
|
||||
end
|
||||
|
||||
message 127, 'SessionSearch', :tracker => false, :replayer => false do
|
||||
uint 'Timestamp'
|
||||
uint 'Partition'
|
||||
end
|
||||
|
||||
|
||||
# 80 -- 90 reserved
|
||||
|
|
|
|||
|
|
@ -2,8 +2,6 @@
|
|||
/* eslint-disable */
|
||||
|
||||
export declare const enum Type {
|
||||
BatchMetadata = 81,
|
||||
PartitionedMessage = 82,
|
||||
Timestamp = 0,
|
||||
SetPageLocation = 4,
|
||||
SetViewportSize = 5,
|
||||
|
|
@ -62,24 +60,11 @@ export declare const enum Type {
|
|||
AdoptedSSRemoveOwner = 77,
|
||||
Zustand = 79,
|
||||
JSException = 78,
|
||||
BatchMetadata = 81,
|
||||
PartitionedMessage = 82,
|
||||
}
|
||||
|
||||
|
||||
export type BatchMetadata = [
|
||||
/*type:*/ Type.BatchMetadata,
|
||||
/*version:*/ number,
|
||||
/*pageNo:*/ number,
|
||||
/*firstIndex:*/ number,
|
||||
/*timestamp:*/ number,
|
||||
/*location:*/ string,
|
||||
]
|
||||
|
||||
export type PartitionedMessage = [
|
||||
/*type:*/ Type.PartitionedMessage,
|
||||
/*partNo:*/ number,
|
||||
/*partTotal:*/ number,
|
||||
]
|
||||
|
||||
export type Timestamp = [
|
||||
/*type:*/ Type.Timestamp,
|
||||
/*timestamp:*/ number,
|
||||
|
|
@ -483,6 +468,21 @@ export type JSException = [
|
|||
/*metadata:*/ string,
|
||||
]
|
||||
|
||||
export type BatchMetadata = [
|
||||
/*type:*/ Type.BatchMetadata,
|
||||
/*version:*/ number,
|
||||
/*pageNo:*/ number,
|
||||
/*firstIndex:*/ number,
|
||||
/*timestamp:*/ number,
|
||||
/*location:*/ string,
|
||||
]
|
||||
|
||||
type Message = BatchMetadata | PartitionedMessage | Timestamp | SetPageLocation | SetViewportSize | SetViewportScroll | CreateDocument | CreateElementNode | CreateTextNode | MoveNode | RemoveNode | SetNodeAttribute | RemoveNodeAttribute | SetNodeData | SetNodeScroll | SetInputTarget | SetInputValue | SetInputChecked | MouseMove | NetworkRequest | ConsoleLog | PageLoadTiming | PageRenderTiming | JSExceptionDeprecated | CustomEvent | UserID | UserAnonymousID | Metadata | CSSInsertRule | CSSDeleteRule | Fetch | Profiler | OTable | StateAction | Redux | Vuex | MobX | NgRx | GraphQL | PerformanceTrack | ResourceTiming | ConnectionInformation | SetPageVisibility | LoadFontFace | SetNodeFocus | LongTask | SetNodeAttributeURLBased | SetCSSDataURLBased | TechnicalInfo | CustomIssue | CSSInsertRuleURLBased | MouseClick | CreateIFrameDocument | AdoptedSSReplaceURLBased | AdoptedSSInsertRuleURLBased | AdoptedSSDeleteRule | AdoptedSSAddOwner | AdoptedSSRemoveOwner | Zustand | JSException
|
||||
export type PartitionedMessage = [
|
||||
/*type:*/ Type.PartitionedMessage,
|
||||
/*partNo:*/ number,
|
||||
/*partTotal:*/ number,
|
||||
]
|
||||
|
||||
|
||||
type Message = Timestamp | SetPageLocation | SetViewportSize | SetViewportScroll | CreateDocument | CreateElementNode | CreateTextNode | MoveNode | RemoveNode | SetNodeAttribute | RemoveNodeAttribute | SetNodeData | SetNodeScroll | SetInputTarget | SetInputValue | SetInputChecked | MouseMove | NetworkRequest | ConsoleLog | PageLoadTiming | PageRenderTiming | JSExceptionDeprecated | CustomEvent | UserID | UserAnonymousID | Metadata | CSSInsertRule | CSSDeleteRule | Fetch | Profiler | OTable | StateAction | Redux | Vuex | MobX | NgRx | GraphQL | PerformanceTrack | ResourceTiming | ConnectionInformation | SetPageVisibility | LoadFontFace | SetNodeFocus | LongTask | SetNodeAttributeURLBased | SetCSSDataURLBased | TechnicalInfo | CustomIssue | CSSInsertRuleURLBased | MouseClick | CreateIFrameDocument | AdoptedSSReplaceURLBased | AdoptedSSInsertRuleURLBased | AdoptedSSDeleteRule | AdoptedSSAddOwner | AdoptedSSRemoveOwner | Zustand | JSException | BatchMetadata | PartitionedMessage
|
||||
export default Message
|
||||
|
|
|
|||
|
|
@ -5,34 +5,6 @@ import * as Messages from '../../common/messages.gen.js'
|
|||
export { default, Type } from '../../common/messages.gen.js'
|
||||
|
||||
|
||||
export function BatchMetadata(
|
||||
version: number,
|
||||
pageNo: number,
|
||||
firstIndex: number,
|
||||
timestamp: number,
|
||||
location: string,
|
||||
): Messages.BatchMetadata {
|
||||
return [
|
||||
Messages.Type.BatchMetadata,
|
||||
version,
|
||||
pageNo,
|
||||
firstIndex,
|
||||
timestamp,
|
||||
location,
|
||||
]
|
||||
}
|
||||
|
||||
export function PartitionedMessage(
|
||||
partNo: number,
|
||||
partTotal: number,
|
||||
): Messages.PartitionedMessage {
|
||||
return [
|
||||
Messages.Type.PartitionedMessage,
|
||||
partNo,
|
||||
partTotal,
|
||||
]
|
||||
}
|
||||
|
||||
export function Timestamp(
|
||||
timestamp: number,
|
||||
): Messages.Timestamp {
|
||||
|
|
@ -781,3 +753,31 @@ export function JSException(
|
|||
]
|
||||
}
|
||||
|
||||
export function BatchMetadata(
|
||||
version: number,
|
||||
pageNo: number,
|
||||
firstIndex: number,
|
||||
timestamp: number,
|
||||
location: string,
|
||||
): Messages.BatchMetadata {
|
||||
return [
|
||||
Messages.Type.BatchMetadata,
|
||||
version,
|
||||
pageNo,
|
||||
firstIndex,
|
||||
timestamp,
|
||||
location,
|
||||
]
|
||||
}
|
||||
|
||||
export function PartitionedMessage(
|
||||
partNo: number,
|
||||
partTotal: number,
|
||||
): Messages.PartitionedMessage {
|
||||
return [
|
||||
Messages.Type.PartitionedMessage,
|
||||
partNo,
|
||||
partTotal,
|
||||
]
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -10,14 +10,6 @@ export default class MessageEncoder extends PrimitiveEncoder {
|
|||
encode(msg: Message): boolean {
|
||||
switch(msg[0]) {
|
||||
|
||||
case Messages.Type.BatchMetadata:
|
||||
return this.uint(msg[1]) && this.uint(msg[2]) && this.uint(msg[3]) && this.int(msg[4]) && this.string(msg[5])
|
||||
break
|
||||
|
||||
case Messages.Type.PartitionedMessage:
|
||||
return this.uint(msg[1]) && this.uint(msg[2])
|
||||
break
|
||||
|
||||
case Messages.Type.Timestamp:
|
||||
return this.uint(msg[1])
|
||||
break
|
||||
|
|
@ -250,6 +242,14 @@ export default class MessageEncoder extends PrimitiveEncoder {
|
|||
return this.string(msg[1]) && this.string(msg[2]) && this.string(msg[3]) && this.string(msg[4])
|
||||
break
|
||||
|
||||
case Messages.Type.BatchMetadata:
|
||||
return this.uint(msg[1]) && this.uint(msg[2]) && this.uint(msg[3]) && this.int(msg[4]) && this.string(msg[5])
|
||||
break
|
||||
|
||||
case Messages.Type.PartitionedMessage:
|
||||
return this.uint(msg[1]) && this.uint(msg[2])
|
||||
break
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue