-
Notifications
You must be signed in to change notification settings - Fork 1.4k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(plugin-server): handle process_person=false (#21262)
* chore(plugin-server): extract normalizeEvent method, since this has nothing to do with persons * chore(plugin-server): cleanup PersonState args * chore(plugin-server): lazily json serialize some timeoutguard context * feat(plugin-server): handle process_person=false
- Loading branch information
1 parent
b28e44c
commit ea05d8e
Showing
18 changed files
with
614 additions
and
105 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
25 changes: 25 additions & 0 deletions
25
plugin-server/src/worker/ingestion/event-pipeline/normalizeEventStep.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
import { PluginEvent } from '@posthog/plugin-scaffold' | ||
import { DateTime } from 'luxon' | ||
|
||
import { normalizeEvent, normalizeProcessPerson } from '../../../utils/event' | ||
import { status } from '../../../utils/status' | ||
import { parseEventTimestamp } from '../timestamps' | ||
|
||
export function normalizeEventStep(event: PluginEvent, processPerson: boolean): Promise<[PluginEvent, DateTime]> { | ||
let timestamp: DateTime | ||
try { | ||
event = normalizeEvent(event) | ||
event = normalizeProcessPerson(event, processPerson) | ||
timestamp = parseEventTimestamp(event) | ||
} catch (error) { | ||
status.warn('⚠️', 'Failed normalizing event', { | ||
team_id: event.team_id, | ||
uuid: event.uuid, | ||
error, | ||
}) | ||
throw error | ||
} | ||
|
||
// We need to be "async" to deal with how `runStep` currently works. | ||
return Promise.resolve([event, timestamp]) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.