feat(backend): added convertor for old sessionEnd message (#786)

This commit is contained in:
Alexander 2022-10-25 14:50:02 +02:00 committed by GitHub
parent e58adb4d8e
commit 51b6414cb6
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
9 changed files with 2741 additions and 2570 deletions

View file

@ -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 && 36 != id && 42 != id && 43 != id && 50 != id && 51 != id && 52 != id && 53 != id && 56 != id && 62 != id && 63 != id && 64 != id && 66 != id && 78 != 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 && 36 != id && 42 != id && 43 != id && 50 != id && 51 != 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
}
func IsIOSType(id int) bool {
@ -11,4 +11,4 @@ func IsIOSType(id int) bool {
func IsDOMType(id int) bool {
return 0 == id || 4 == id || 5 == id || 6 == id || 7 == id || 8 == id || 9 == id || 10 == id || 11 == id || 12 == id || 13 == id || 14 == id || 15 == id || 16 == id || 18 == id || 19 == id || 20 == id || 37 == id || 38 == id || 49 == id || 54 == id || 55 == id || 59 == id || 60 == id || 61 == id || 67 == id || 69 == id || 70 == id || 71 == id || 72 == id || 73 == id || 74 == id || 75 == id || 76 == id || 77 == id || 90 == id || 93 == id || 96 == id || 100 == id || 102 == id || 103 == id || 105 == id
}
}

View file

@ -39,7 +39,8 @@ func NewMessageIterator(messageHandler MessageHandler, messageFilter []int, auto
}
iter.preFilter = map[int]struct{}{
MsgBatchMetadata: {}, MsgBatchMeta: {}, MsgTimestamp: {},
MsgSessionStart: {}, MsgSessionEnd: {}, MsgSetPageLocation: {}}
MsgSessionStart: {}, MsgSessionEnd: {}, MsgSetPageLocation: {},
MsgSessionEndDeprecated: {}}
return iter
}

View file

@ -9,6 +9,11 @@ func transformDeprecated(msg Message) Message {
Payload: m.Payload,
Metadata: "{}",
}
case *SessionEndDeprecated:
return &SessionEnd{
Timestamp: m.Timestamp,
EncryptionKey: "",
}
}
return msg
}

File diff suppressed because it is too large Load diff

View file

@ -64,6 +64,7 @@ func (m *RawMessage) Decode() Message {
*m.broken = true
return nil
}
msg = transformDeprecated(msg)
msg.Meta().SetMeta(m.meta)
return msg
}

File diff suppressed because it is too large Load diff

View file

@ -63,12 +63,11 @@ class SessionStart(Message):
self.user_id = user_id
class SessionEnd(Message):
class SessionEndDeprecated(Message):
__id__ = 3
def __init__(self, timestamp, encryption_key):
def __init__(self, timestamp):
self.timestamp = timestamp
self.encryption_key = encryption_key
class SetPageLocation(Message):
@ -742,6 +741,14 @@ class JSException(Message):
self.metadata = metadata
class SessionEnd(Message):
__id__ = 126
def __init__(self, timestamp, encryption_key):
self.timestamp = timestamp
self.encryption_key = encryption_key
class SessionSearch(Message):
__id__ = 127

View file

@ -124,9 +124,8 @@ class MessageCodec(Codec):
)
if message_id == 3:
return SessionEnd(
timestamp=self.read_uint(reader),
encryption_key=self.read_string(reader)
return SessionEndDeprecated(
timestamp=self.read_uint(reader)
)
if message_id == 4:
@ -660,6 +659,12 @@ class MessageCodec(Codec):
metadata=self.read_string(reader)
)
if message_id == 126:
return SessionEnd(
timestamp=self.read_uint(reader),
encryption_key=self.read_string(reader)
)
if message_id == 127:
return SessionSearch(
timestamp=self.read_uint(reader),

View file

@ -46,9 +46,8 @@ message 1, 'SessionStart', :tracker => false, :replayer => false do
end
## message 2, 'CreateDocument', do
# end
message 3, 'SessionEnd', :tracker => false, :replayer => false do
message 3, 'SessionEndDeprecated', :tracker => false, :replayer => false do
uint 'Timestamp'
string 'EncryptionKey'
end
message 4, 'SetPageLocation' do
string 'URL'
@ -467,7 +466,10 @@ message 78, 'JSException', :replayer => false do
string 'Payload'
string 'Metadata'
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'