mirror of
https://github.com/PostHog/posthog.git
synced 2024-11-28 18:26:15 +01:00
fix: revert "feat: faster json parsing" (#19838)
Revert "feat: faster json parsing"
This commit is contained in:
parent
4c9977b0fc
commit
e049e2c4b6
@ -80,7 +80,6 @@
|
||||
"prom-client": "^14.2.0",
|
||||
"re2": "^1.20.3",
|
||||
"safe-stable-stringify": "^2.4.0",
|
||||
"simdjson": "^0.9.2",
|
||||
"tail": "^2.2.6",
|
||||
"uuid": "^8.3.2",
|
||||
"v8-profiler-next": "^1.9.0",
|
||||
|
@ -133,9 +133,6 @@ dependencies:
|
||||
safe-stable-stringify:
|
||||
specifier: ^2.4.0
|
||||
version: 2.4.3
|
||||
simdjson:
|
||||
specifier: ^0.9.2
|
||||
version: 0.9.2
|
||||
tail:
|
||||
specifier: ^2.2.6
|
||||
version: 2.2.6
|
||||
@ -8083,10 +8080,6 @@ packages:
|
||||
semver: 7.5.0
|
||||
dev: false
|
||||
|
||||
/node-addon-api@2.0.2:
|
||||
resolution: {integrity: sha512-Ntyt4AIXyaLIuMHF6IOoTakB3K+RWxwtsHNRxllEoA6vPwP9o4866g6YWDLUdnucilZhmkxiHwHr11gAENw+QA==}
|
||||
dev: false
|
||||
|
||||
/node-fetch@2.6.9:
|
||||
resolution: {integrity: sha512-DJm/CJkZkRjKKj4Zi4BsKVZh3ValV5IR5s7LVZnW+6YMh0W1BfNA8XSs6DLMGYlId5F3KnA70uu2qepcR08Qqg==}
|
||||
engines: {node: 4.x || >=6.0.0}
|
||||
@ -9252,13 +9245,6 @@ packages:
|
||||
engines: {node: '>=14'}
|
||||
dev: false
|
||||
|
||||
/simdjson@0.9.2:
|
||||
resolution: {integrity: sha512-CW97acb8ty4EcxJGsCTrgxh1iiqLKbcuaIAte4DjPdoytK2ps1cRN1HpBJjIzqaL5cn1m/Dqc4AqA6NlKPPKKA==}
|
||||
requiresBuild: true
|
||||
dependencies:
|
||||
node-addon-api: 2.0.2
|
||||
dev: false
|
||||
|
||||
/simple-concat@1.0.1:
|
||||
resolution: {integrity: sha512-cSFtAPtRhljv69IK0hTVZQ+OfE9nePi/rtJmw5UjHeVyVroEqJXP1sFztKUy1qU+xvz3u/sfYJLa947b7nAN2Q==}
|
||||
dev: true
|
||||
|
@ -2,7 +2,6 @@ import { captureException, captureMessage } from '@sentry/node'
|
||||
import { DateTime } from 'luxon'
|
||||
import { KafkaConsumer, Message, MessageHeader, PartitionMetadata, TopicPartition } from 'node-rdkafka'
|
||||
import path from 'path'
|
||||
import { parse } from 'simdjson'
|
||||
|
||||
import { KAFKA_SESSION_RECORDING_SNAPSHOT_ITEM_EVENTS } from '../../../config/kafka-topics'
|
||||
import { PipelineEvent, RawEventMessage, RRWebEvent } from '../../../types'
|
||||
@ -177,13 +176,8 @@ export const parseKafkaMessage = async (
|
||||
let event: PipelineEvent
|
||||
|
||||
try {
|
||||
// we only read distinct_id, team_id, token, and data from the message payload
|
||||
// data is read into event
|
||||
// TODO: simd json can lazily parse json, so if we could avoid parsing "events" from the data
|
||||
// we'd get the biggest perf win, since that is the potentially large "blob" of data
|
||||
// see: https://github.com/luizperes/simdjson_nodejs?tab=readme-ov-file#parsing-a-json-string-lazily
|
||||
messagePayload = parse(message.value.toString())
|
||||
event = parse(messagePayload.data)
|
||||
messagePayload = JSON.parse(message.value.toString())
|
||||
event = JSON.parse(messagePayload.data)
|
||||
} catch (error) {
|
||||
return dropMessage('invalid_json', { error })
|
||||
}
|
||||
|
@ -68,25 +68,7 @@ describe('session-recording utils', () => {
|
||||
)
|
||||
expect(parsedMessage).toEqual({
|
||||
distinct_id: String(numericId),
|
||||
events: [
|
||||
{
|
||||
data: {
|
||||
payload: {
|
||||
level: 'log',
|
||||
payload: ['"Hedgehog: Will \'jump\' for 2916.6666666666665ms"'],
|
||||
trace: [
|
||||
'HedgehogActor.setAnimation (http://127.0.0.1:8000/static/toolbar.js?_ts=1693421010000:105543:17)',
|
||||
'HedgehogActor.setRandomAnimation (http://127.0.0.1:8000/static/toolbar.js?_ts=1693421010000:105550:14)',
|
||||
'HedgehogActor.update (http://127.0.0.1:8000/static/toolbar.js?_ts=1693421010000:105572:16)',
|
||||
'loop (http://127.0.0.1:8000/static/toolbar.js?_ts=1693421010000:105754:15)',
|
||||
],
|
||||
},
|
||||
plugin: 'rrweb/console@1',
|
||||
},
|
||||
timestamp: 1693422950693,
|
||||
type: 6,
|
||||
},
|
||||
],
|
||||
events: expect.any(Array),
|
||||
metadata: {
|
||||
offset: 1,
|
||||
partition: 1,
|
||||
@ -97,7 +79,6 @@ describe('session-recording utils', () => {
|
||||
session_id: '018a47c2-2f4a-70a8-b480-5e51d8b8d070',
|
||||
team_id: 1,
|
||||
window_id: '018a47c2-2f4a-70a8-b480-5e52f5480448',
|
||||
snapshot_source: undefined,
|
||||
})
|
||||
})
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user