MCPcopy Create free account
hub / github.com/Openpanel-dev/openpanel / sendSessionEvent

Function sendSessionEvent

apps/api/e2e/session-stress.ts:89–97  ·  view source on GitHub ↗
(ip: string, i: number, e: number)

Source from the content-addressed store, hash-verified

87// One event in a session: the entry is always a screen_view; the rest are a
88// 50/50 mix of more screen_views and random custom events.
89function sendSessionEvent(ip: string, i: number, e: number) {
90 if (e === 0 || Math.random() < 0.5) {
91 return screenView(ip, `/p${i}/${e}`, randomProps(ip));
92 }
93 return track(
94 { type: 'track', payload: { name: pick(CUSTOM_EVENTS), properties: randomProps(ip) } },
95 ip
96 );
97}
98
99async function emit(): Promise<Session[]> {
100 scenario(`emit ${SESSIONS} sessions × ${EVENTS_PER_SESSION} events (concurrency ${CONCURRENCY})`);

Callers 1

emitFunction · 0.85

Calls 4

screenViewFunction · 0.90
trackFunction · 0.90
randomPropsFunction · 0.85
pickFunction · 0.70

Tested by

no test coverage detected