Session replay: client-owned session id and a per-tab window id
I maintainer di solito rispondono entro 1 giorno
Nessuno ha ancora preso questa issue.
Valutazione
- Difficoltà
- 5/5
- Tempo stimato
- Più di una settimana
- Idoneità per principianti
- 20/100
- Tipo di issue
- Funzionalità
- Chiarezza
- Specificata chiaramente
- Stato di attività
- Attiva
- Stack tecnologico
- typescript
Direzione di ricerca
Start by reading linked issues #537, #599, #613 and #614, then trace the web SDK's track/identify/replay payload assembly, the ingest session-resolution path, and the session_replay_chunks schema/migration. Follow how replay chunks are keyed by session and how the player orders and seeks them. Done means an agreed rollout split into the four described PRs, with client session-id fallback and per-window replay loading covered by tests.
Scritto dal modello di indicizzazione a partire dal testo della issue.
Descrizione
We run OpenPanel session replay in production on a fork (a few thousand recorded sessions a day, web and a canvas-heavy app) and hit a set of failures that all come from the same two gaps: the browser does not own its session id, and recordings are not separated per tab. Before sending code, I would like to agree on the design, since this touches how sessions are resolved. Two small SDK fixes from the same work are already up: #613 and #614.
Problems
1. Chunks recorded before the first track response land in the wrong session. The recorder starts immediately, but the SDK has no session id until the first /track answers, so early chunks (usually including the full snapshot) are queued and later resolved on the server from IP and user agent. That is #537; #599 patches the queue flush, but the root cause is that the client cannot know its session id synchronously.
2. Different people behind the same NAT share sessions. The server derives the device (and so the session) from a hash of IP and user agent. Offices, mobile carriers (CGNAT) and university networks put many users on one IP, often with an identical UA. Their events and replays merge into one session, and the player tries to play two different people's DOMs as one recording.
3. Two tabs of one session interleave in one recording. Every tab runs its own rrweb recorder, but chunks are keyed only by session. Opening a second tab produces two independent DOM streams under one session id; ordered by time, they make the player jump between pages and fail with "Node not found" after a seek.
Proposal
A. Client-owned session id (opt-in or default, your call)
The web SDK keeps the session in localStorage, shared by every tab of the origin, the same contract PostHog uses:
_op_session_id,_op_session_start_ms,_op_last_activity_ms- rotate when idle longer than the session timeout (30 min) or older than a hard cap (24 h)
- activity is read fresh from storage on each check, so an idle tab does not rotate a session a sibling tab keeps alive
- rotation is lazy (checked when the id is read), so there are no timers or cross-tab coordination
- in-memory fallback when storage is unavailable
The SDK sends the id on every track/identify/replay payload. Ingest uses it when present and valid, and falls back to today's server-side resolution otherwise, so old SDKs and server-side SDKs keep working unchanged. Replay chunks then always have their session id from the first event, which fixes #537 at the root, and NAT collisions disappear because the id no longer depends on IP and UA.
B. Per-tab window_id
A random id generated per tab per page load (kept in sessionStorage, renewed when the session rotates) and sent with each replay chunk:
session_replay_chunksgets awindow_id String DEFAULT ''column; existing rows and old SDKs read as one window, so nothing changes for them- the player loads one window at a time and shows a tab switcher when a session has several, so each recording is a single coherent DOM stream
- optionally exposed as
getWindowId()so apps can attach it to their own events and deep-link a business event to the exact tab recording
Rollout
Each part is backward compatible on its own and could land as small PRs:
- ingest accepts an optional client session id (validated, falls back to current resolution)
- web SDK session manager (behind an option first if you prefer)
window_idcolumn migration + ingest + replay buffer- player: per-window loading and a tab switcher
From our production
After we moved to a client-owned session id and per-tab window id, the multi-tab and NAT-collision recordings stopped appearing, and early chunks (including the first full snapshot) stay in the right session.
Happy to implement this in that order if the direction works for you, or to adjust it (for example keeping the server as the source of truth and only binding the client id when present).
- Lingua principale
- TypeScript
- Stelle
- 7.2k
- Fork
- 531
- Merge medio
- 23h 58m
- PR unite (30g)
- 51
Preparare l'ambiente
- Include un Dockerfile o un file Docker Compose
- Nessun modello di pull request
- Nessuna guida per i contributori
Come iniziare
- Leggi tutta la issue e poi la guida ai contributi del progetto.
- Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
- Fai un fork del repository e lavora su un branch.
- Apri una pull request che faccia riferimento al numero della issue.
Altre issue di Openpanel-dev/openpanel
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 73/100
Openpanel-dev/openpanel#610 · 1 commento ·
I maintainer di solito rispondono entro 1 giorno
-
ClickHouse retry logs print CLICKHOUSE_URL with its passwordForse già presa @ppjsw l’ha presa 10 giorni fa. Aperta
Difficoltà 1/5 1-3 ore Idoneità per principianti 92/100
Openpanel-dev/openpanel#551 · 1 commento ·
I maintainer di solito rispondono entro 1 giorno
-
login page needs refinementForse di nuovo libera Una pull request per questa issue è stata chiusa senza essere unita. Aperta
Difficoltà 2/5 1-3 ore Idoneità per principianti 68/100
Openpanel-dev/openpanel#495 ·
I maintainer di solito rispondono entro 1 giorno
-
Dashboard dropdown pickers re-render on every animation frame while openForse già presa @MihirSachdeva l’ha presa 2 giorni fa. Aperta
Difficoltà 1/5 1-3 ore Idoneità per principianti 35/100
Openpanel-dev/openpanel#629 ·
I maintainer di solito rispondono entro 1 giorno
-
Session-grouped queries treat every sessionless event as one session (wrong results, ClickHouse OOM)Forse già presa @grootbro l’ha presa 7 giorni fa. Aperta
Difficoltà 4/5 3-5 giorni Idoneità per principianti 52/100
Openpanel-dev/openpanel#575 ·
I maintainer di solito rispondono entro 1 giorno
Tutte le issue di Openpanel-dev/openpanel
Issue simili
-
bug triage
Difficoltà 2/5 1-3 ore Idoneità per principianti 74/100
I maintainer di solito rispondono entro 1 giorno
-
Export the Hemi Earn Router address and the Router and Agent ABIs from `@vetro-protocol/earn`Apertahemi-earn
Difficoltà 2/5 1-3 ore Idoneità per principianti 82/100
vetro-protocol/vetro-monorepo#1043 ·
I maintainer di solito rispondono entro 1 giorno
-
stage 2: bare names resolve against PATH differently from the shell (empty and relative entries)Aperta
Difficoltà 2/5 1-3 ore Idoneità per principianti 82/100
STRML/omp-classifier#206 ·
I maintainer di solito rispondono entro 1 giorno
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 70/100
atlassian-labs/mermaid-diagrams-viewer#188 ·
I maintainer di solito rispondono entro 1 giorno
-
dashboard enhancement
Difficoltà 2/5 1-3 ore Idoneità per principianti 76/100
Olanetsoft/agent-lookout#225 ·
I maintainer di solito rispondono entro 1 giorno