MCPcopy
hub / github.com/PostHog/posthog / processEvent

Function processEvent

plugin-server/tests/main/process-event.test.ts:108–132  ·  view source on GitHub ↗
(
    distinctId: string,
    ip: string | null,
    _siteUrl: string,
    data: Partial<PluginEvent>,
    teamId: number,
    timestamp: DateTime,
    eventUuid: string
)

Source from the content-addressed store, hash-verified

106}
107
108async function processEvent(
109 distinctId: string,
110 ip: string | null,
111 _siteUrl: string,
112 data: Partial<PluginEvent>,
113 teamId: number,
114 timestamp: DateTime,
115 eventUuid: string
116): Promise<void> {
117 const pluginEvent: PluginEvent = {
118 distinct_id: distinctId,
119 site_url: _siteUrl,
120 team_id: teamId,
121 timestamp: timestamp.toUTC().toISO(),
122 now: timestamp.toUTC().toISO(),
123 ip: ip,
124 uuid: eventUuid,
125 ...data,
126 } as any as PluginEvent
127
128 const runner = new EventPipelineRunner(hub, pluginEvent)
129 await runner.runEventPipeline(pluginEvent)
130
131 await delayUntilEventIngested(() => hub.db.fetchEvents(), ++processEventCounter)
132}
133
134// Simple client used to simulate sending events
135// Use state object to simulate stateful clients that keep track of old

Callers 3

runProcessEventFunction · 0.70

Calls 3

runEventPipelineMethod · 0.95
delayUntilEventIngestedFunction · 0.90
fetchEventsMethod · 0.80

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…