feat(archive): add groups + recordings to the PostHog archive

- groups: posthog-resource-archive now also snapshots group types + group
  instances (groups_types/ + groups/?group_type_index) into
  posthog_resource_snapshots (change-detected).
- recordings: new posthog-recording-archive job (@*/6h) captures complete
  metadata for EVERY recording into posthog_recordings (skipDuplicates over a
  rolling 90d window) + MinIO dump — a superset of the insight pipeline's
  promoted SessionMeta subset. rrweb blobs still archived by archive-recordings.
- /posthog-archive browser: Groups / Group Types tabs + a Recordings tab.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
This commit is contained in:
Semih
2026-06-10 21:19:54 +03:00
parent e953f5fc34
commit 400ed224c5
7 changed files with 373 additions and 45 deletions

View File

@@ -561,6 +561,35 @@ model PosthogResourceSnapshot {
@@map("posthog_resource_snapshots")
}
// Complete metadata for EVERY session recording (not just the insight-pipeline's
// promoted subset in SessionMeta). One row per recording; full list-item payload
// kept lossless. rrweb blobs themselves are archived separately to MinIO by the
// archive-recordings job for ingested sessions.
model PosthogRecording {
id String @id // PostHog recording / session id
projectKey String
distinctId String?
personName String?
startTime DateTime?
endTime DateTime?
durationSec Int?
activeSeconds Int?
clickCount Int?
keypressCount Int?
mouseActivityCount Int?
consoleErrorCount Int?
startUrl String?
ongoing Boolean @default(false)
properties Json // full recording list item, lossless
capturedAt DateTime @default(now())
dumpedAt DateTime?
@@index([projectKey, startTime])
@@index([distinctId])
@@index([dumpedAt])
@@map("posthog_recordings")
}
// ---------- Phase C: Sentry archive ----------
// Sentry issue (group) aggregate state. Upserted to the latest snapshot — the