Skip to content

:hedgehog: PostHog is the leading platform for building self-driving products. Our developer tools – AI observability, analytics, session replay, flags, experiments, error tracking, logs, and more – capture all the context agents need to diagnose problems, uncover opportunities, and ship fixes. Steer it all from Slack, web, desktop, or the MCP.

1.5 KB
Raw Blame
import {
    KAFKA_SESSION_RECORDING_SNAPSHOT_ITEM_EVENTS,
    KAFKA_SESSION_RECORDING_SNAPSHOT_ITEM_OVERFLOW,
} from '~/common/config/kafka-topics'

// WARNING: Do not change these - they will essentially reset the consumer
export const KAFKA_CONSUMER_GROUP_ID = 'session-recordings-blob-v2'
export const KAFKA_CONSUMER_GROUP_ID_OVERFLOW = 'session-recordings-blob-v2-overflow'
export const KAFKA_CONSUMER_SESSION_TIMEOUT_MS = 90_000

// Re-export kafka topics constants
export { KAFKA_SESSION_RECORDING_SNAPSHOT_ITEM_EVENTS, KAFKA_SESSION_RECORDING_SNAPSHOT_ITEM_OVERFLOW }

// Re-export shared retention constants so existing recording-ingestion imports still work
export { RetentionPeriodToDaysMap, ValidRetentionPeriods } from '~/ingestion/pipelines/sessionreplay/shared/constants'

// Maximum length of a session recording (24 hours)
export const MAX_SESSION_LENGTH_SECONDS = 24 * 60 * 60

// Redis TTL for session tracking keys
// Set to 2x max session length for safety margin (handles edge cases like
// sessions that span across the boundary, delayed messages, etc.)
export const SESSION_TRACKER_REDIS_TTL_SECONDS = 2 * MAX_SESSION_LENGTH_SECONDS

// Mobile SDKs upload queued recordings days later, so a billed mobile session's mark must outlive that upload.
export const SESSION_TRACKER_MOBILE_BILLED_TTL_SECONDS = 7 * 24 * 60 * 60

// Redis TTL for session blocklist keys
// Matches session tracker TTL since blocked sessions should persist for same duration
export const SESSION_FILTER_REDIS_TTL_SECONDS = 2 * MAX_SESSION_LENGTH_SECONDS