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.

feat(replay): count live recordings with hogql instead of livestream (#109849)

Tue Haulundada7c88e4056
diff --git a/frontend/snapshots.yml b/frontend/snapshots.yml
index f64b5f9100cb..5f56dad6d581 100644
--- a/frontend/snapshots.yml
+++ b/frontend/snapshots.yml
@@ -7663,17 +7663,17 @@ snapshots:
replay-tabs-comments--replay-comments-empty--light:
hash: v1.k794b7964.eacc112601665aaad99a28267264805387b57496ee35b89bafef74db2c2c2794.pTNBJCYNg6D28_QldfksZRa-Bzl-VSAcEWzL5AeegF8
replay-tabs-home-failure--not-found--dark:
- hash: v1.k794b7964.bf1fc2024924b2d2d156739c04e8acade818852ad91dfd6e01210665b246149f.6nwqTT8W_PljoKoR11Dup9D06jQVw8-SBZQbAM43gks
+ hash: v1.k794b7964.b9a8cf652792ff2c0bd190c60a09632c19b4d185a26cd90bd1778a70602948d7.VxjlB-GndCf740MtiPkEF0T7pY69VB1RDP9D1MH5DhY
replay-tabs-home-failure--not-found--light:
- hash: v1.k794b7964.d9b15fdde17563eeb620d2a170d2b73434cc960fb55818fd07bb725d5a077700.LAZBeOy08kO2WM7ec--oJjkn8R_3VYZ-Wqvcg6IDD-8
+ hash: v1.k794b7964.00a842b636a80935d1226db71e97c4ee7096f394d40777b38244e9de9013415e.DnT2Kx8Kf97VLRAW2Sr8u1EL_1h6ejblvkGULoNCnic
replay-tabs-home-filters-banner--event-match-scope-only-during-recording--dark:
- hash: v1.k794b7964.e2f4941d60b081b3660e8dba7947eebc5676151aed686f3fa5ca380683fe3282.jCljzt67zP29x2WtWs_Q_gzjM3RUTY8aE3732K9bdmM
+ hash: v1.k794b7964.50ae1d3fef5fde6f3e306a7639f7d18294aee2dbbc521bb7d4139c1440063a99.UJzxSU6SMYQMCkOJslSeB2ZOC1gUjj6mYlket5wwU1M
replay-tabs-home-filters-banner--event-match-scope-only-during-recording--light:
- hash: v1.k794b7964.f06605f72c3416040beb8cb5369cfc077a646d5ff1aa4d21f308a28dce99efdb.Qw2htfdPddy7jYaOKZ7iN9wptxD8bnUJElP6jcrzvUg
+ hash: v1.k794b7964.cfdcd383cf52371553dff34373a687d6cf472bdf8fd480961f4b4bae499b887d.Bv-nqusXOgq88q3kdZFS3yJJueJFz3f_EQO1JJh1ous
replay-tabs-home-filters-banner--event-match-scope-whole-session--dark:
- hash: v1.k794b7964.1d2a4083393db09a6e18bfd5c96d9d0a1df9ad497d5ee77e6bb47307fbf43a84.tVACRDwJfqOxsA4HI-1lRxSRpcGXNCSCHu5OSlbYZFw
+ hash: v1.k794b7964.dd7a20ac28b262aa73cab4dcb6bc561c88202bf4bcfdb27b9aaf5fac33e70818.wRll0kDieLoFPerm-sRqj5lTxHXTzuNhAGVa5xrEu3M
replay-tabs-home-filters-banner--event-match-scope-whole-session--light:
- hash: v1.k794b7964.259486a3df29e32bad864a9e06079cdb8a1f6a1cb0dc5a4a77a56266ecead44e.VckaQWTQZOhQhLXAB_kkZ0RYpUtcSSTOb1f1pKmlKwQ
+ hash: v1.k794b7964.0c64840424d0bdce4d10bed232350a4759e96158ebe995b7b8428b0ba7898619.cidxUqOJpbqLUWD0V5qQlVME_qXgvxCuqLF26XNECJQ
replay-tabs-home-filters-banner--page-filter-nudge--dark:
hash: v1.k794b7964.ef10ad389f863bfe246e69dc7bb0c74c3735cede108e2d373aa5b8338446b424.ewXseA-JwXOXnnzhCjOxwWoEzJiNIQsRDSepEBEsJ2Q
replay-tabs-home-filters-banner--page-filter-nudge--light:
@@ -7691,9 +7691,9 @@ snapshots:
replay-tabs-home-filters-banner--scanner-cross-sell--light:
hash: v1.k794b7964.f7737d364d17d814799515a49367354f049f8b8fa49bc47bc6f3fd9def2fc6aa.1QjsRrQwtB0d-7QTtiHkJH1b6GyCHE6teVTo_7M7owE
replay-tabs-home-filters-banner--templates-tab--dark:
- hash: v1.k794b7964.d438ddf6f2d9f05b13d8645a296bf3d7f9875d485708c4a921eb9c49f2991f90.sf5NCCDbhBU-m1nTsrn2EWTeYdDkfXwx2h3f8GFRGCo
+ hash: v1.k794b7964.821408e248503db259ac3cfedf8189f2cc20d9bb2fd3ea2148c5f016d9626471.3W4sY8uzOBOrdHKk0KYAAVdbJyKgArelBDA4AbiiKhU
replay-tabs-home-filters-banner--templates-tab--light:
- hash: v1.k794b7964.9e447d52b926cb22093f8c73945c9b4aebb3f79781e350a3f5245559c83e54d2.PJue3UTGwQpd6J6F_vyMA__xCKXHvLqyJew3QYep8SI
+ hash: v1.k794b7964.9e38e553e9fcd165d4572edcfd24c6eac9a4958846e3cbc8c3daf85b8d60af19.Qef4EsSsp39XzM0OQXwhW-0Q1GUfNwizkHBaqrDxxhg
replay-tabs-home-success--filters-expanded--dark:
hash: v1.k794b7964.a05acdcbac185e041adaf30a6d8ef4977978907164381eba3d3dc9c9d8aea04d.qKdFMomWAKqzXhor-Jl8T1XN8Kgp4pdrZiklEnoryuI
replay-tabs-home-success--filters-expanded--light:
diff --git a/frontend/src/lib/components/LiveUserCount/LiveUserCount.tsx b/frontend/src/lib/components/LiveUserCount/LiveUserCount.tsx
index 0072eb236699..bd8df3ee3c3a 100644
--- a/frontend/src/lib/components/LiveUserCount/LiveUserCount.tsx
+++ b/frontend/src/lib/components/LiveUserCount/LiveUserCount.tsx
@@ -3,13 +3,12 @@ import './LiveUserCount.scss'
import { useActions, useValues } from 'kea'
import { useEffect } from 'react'
-import { IconPerson, IconVideoCamera } from '@posthog/icons'
+import { IconPerson } from '@posthog/icons'
import { Tooltip } from '@posthog/lemon-ui'
import { usePageVisibility } from 'lib/hooks/usePageVisibility'
import { cn } from 'lib/utils/css-classes'
import { humanFriendlyLargeNumber, humanFriendlyNumber } from 'lib/utils/numbers'
-import { pluralize } from 'lib/utils/strings'
import { teamLogic } from 'scenes/teamLogic'
import { LiveUserCountLogicProps, liveUserCountLogic } from './liveUserCountLogic'
@@ -60,15 +59,12 @@ function LiveUserCountTooltipContent({
)
}
-interface LiveCountProps {
- pollIntervalMs?: number
-}
-
export type LiveUserCountProps = {
+ pollIntervalMs?: number
docLink?: string
showUpdatedTimeInTooltip?: boolean
dataAttr?: string
-} & LiveCountProps
+}
export function LiveUserCount({
pollIntervalMs = 30000,
@@ -117,50 +113,3 @@ export function LiveUserCount({
</Tooltip>
)
}
-
-export function LiveRecordingsCount({ pollIntervalMs = 30000 }: LiveCountProps): JSX.Element | null {
- const { activeRecordings } = useValues(liveUserCountLogic({ pollIntervalMs }))
- const { pauseStream, resumeStream } = useActions(liveUserCountLogic({ pollIntervalMs }))
-
- const { isVisible } = usePageVisibility()
- useEffect(() => {
- if (isVisible) {
- resumeStream()
- } else {
- pauseStream()
- }
- }, [isVisible, resumeStream, pauseStream])
-
- const hasRecordings = (activeRecordings ?? 0) > 0
-
- if (activeRecordings === null) {
- return null
- }
-
- return (
- <Tooltip
- title={
- activeRecordings == null
- ? 'Unable to retrieve active recordings count.'
- : 'Session recordings currently in progress.'
- }
- placement="right"
- >
- <div
- className={cn(
- 'flex items-center gap-1.5 px-2 py-1 rounded-md transition-colors',
- hasRecordings ? 'bg-success-highlight' : 'bg-border-light'
- )}
- >
- <div className={cn('live-user-indicator', hasRecordings ? 'online' : 'offline')} />
- <IconVideoCamera className="size-4 shrink-0 min-[660px]:hidden" />
- <span className="text-xs font-medium whitespace-nowrap" data-attr="live-recordings-count">
- <strong>{humanFriendlyLargeNumber(activeRecordings)}</strong>
- </span>
- <span className="hidden min-[660px]:inline">
- recently active {pluralize(activeRecordings, 'recording', undefined, false)}
- </span>
- </div>
- </Tooltip>
- )
-}
diff --git a/frontend/src/lib/components/LiveUserCount/index.ts b/frontend/src/lib/components/LiveUserCount/index.ts
index 8c6686c68498..aa28123b7663 100644
--- a/frontend/src/lib/components/LiveUserCount/index.ts
+++ b/frontend/src/lib/components/LiveUserCount/index.ts
@@ -1,3 +1,3 @@
-export { LiveUserCount, LiveRecordingsCount } from './LiveUserCount'
+export { LiveUserCount } from './LiveUserCount'
export { liveUserCountLogic } from './liveUserCountLogic'
export type { LiveUserCountLogicProps, LiveUserCountStats } from './liveUserCountLogic'
diff --git a/frontend/src/lib/components/LiveUserCount/liveUserCountLogic.ts b/frontend/src/lib/components/LiveUserCount/liveUserCountLogic.ts
index d7cee8da0bca..75354c5b3210 100644
--- a/frontend/src/lib/components/LiveUserCount/liveUserCountLogic.ts
+++ b/frontend/src/lib/components/LiveUserCount/liveUserCountLogic.ts
@@ -7,7 +7,6 @@ import type { TeamPublicType, TeamType } from '../../../types'
export interface LiveUserCountStats {
users_on_product?: number
- active_recordings?: number
}
export interface LiveUserCountLogicProps {
@@ -17,7 +16,6 @@ export interface LiveUserCountLogicProps {
// Generated by kea-typegen. Update if you're an agent, ignore if you're human.
export interface liveUserCountLogicValues {
currentTeam: TeamPublicType | TeamType | null // teamLogic
- activeRecordings: number | null
isHovering: boolean
liveUserCount: number | null
now: Date | null
@@ -57,7 +55,6 @@ export interface liveUserCountLogicMeta {
key: number
__keaTypeGenInternalSelectorTypes: {
liveUserCount: (stats: LiveUserCountStats | null) => number | null
- activeRecordings: (stats: LiveUserCountStats | null) => number | null
statsUpdatedSecondsAgo: (statsUpdatedTime: Date | null, now: Date | null) => number | null
}
}
@@ -113,7 +110,6 @@ export const liveUserCountLogic = kea<liveUserCountLogicType>([
}),
selectors({
liveUserCount: [(s) => [s.stats], (stats: LiveUserCountStats | null) => stats?.users_on_product ?? null],
- activeRecordings: [(s) => [s.stats], (stats: LiveUserCountStats | null) => stats?.active_recordings ?? null],
statsUpdatedSecondsAgo: [
(s) => [s.statsUpdatedTime, s.now],
(statsUpdatedTime: Date | null, now: Date | null) => {
diff --git a/frontend/src/scenes/activity/live/LiveEventsTable.tsx b/frontend/src/scenes/activity/live/LiveEventsTable.tsx
index 08886b7fff91..554d6136a130 100644
--- a/frontend/src/scenes/activity/live/LiveEventsTable.tsx
+++ b/frontend/src/scenes/activity/live/LiveEventsTable.tsx
@@ -4,7 +4,7 @@ import { useEffect } from 'react'
import { IconPauseFilled, IconPlayFilled, IconRefresh, IconTerminal } from '@posthog/icons'
import { LemonButton, Link } from '@posthog/lemon-ui'
-import { LiveRecordingsCount, LiveUserCount } from 'lib/components/LiveUserCount'
+import { LiveUserCount } from 'lib/components/LiveUserCount'
import { PropertyFilters } from 'lib/components/PropertyFilters/PropertyFilters'
import { TaxonomicFilterGroupType } from 'lib/components/TaxonomicFilter/types'
import { FEATURE_FLAGS } from 'lib/constants'
@@ -14,6 +14,7 @@ import { featureFlagLogic } from 'lib/logic/featureFlagLogic'
import { ActivitySceneTabs } from 'scenes/activity/ActivitySceneTabs'
import { sceneConfigurations } from 'scenes/scenes'
import { Scene, SceneExport } from 'scenes/sceneTypes'
+import { LiveRecordingsCount } from 'scenes/session-recordings/components/LiveRecordingsCount'
import { SceneContent } from '~/layout/scenes/components/SceneContent'
import { SceneTitleSection } from '~/layout/scenes/components/SceneTitleSection'
@@ -72,7 +73,7 @@ export function LiveEventsTable(): JSX.Element {
<div className="mb-4 flex w-full justify-between items-center">
<div className="flex gap-2">
<LiveUserCount pollIntervalMs={LIVE_EVENTS_POLL_INTERVAL_MS} showUpdatedTimeInTooltip={false} />
- <LiveRecordingsCount pollIntervalMs={LIVE_EVENTS_POLL_INTERVAL_MS} />
+ <LiveRecordingsCount />
</div>
<div className="flex gap-2">
diff --git a/frontend/src/scenes/session-recordings/SessionRecordings.tsx b/frontend/src/scenes/session-recordings/SessionRecordings.tsx
index 3633f84db2ec..9dfa29f34bb5 100644
--- a/frontend/src/scenes/session-recordings/SessionRecordings.tsx
+++ b/frontend/src/scenes/session-recordings/SessionRecordings.tsx
@@ -9,7 +9,6 @@ import { PostHogCaptureOnViewed } from '@posthog/react'
import { isAccessDeniedError, shouldReportApiFailure } from 'lib/api-error'
import { AccessControlAction } from 'lib/components/AccessControlAction'
-import { LiveRecordingsCount } from 'lib/components/LiveUserCount'
import { Shortcut } from 'lib/components/Shortcuts/Shortcut'
import { keyBinds } from 'lib/components/Shortcuts/shortcuts'
import { useFeatureFlag } from 'lib/hooks/useFeatureFlag'
@@ -22,6 +21,7 @@ import { useAttachedLogic } from 'lib/logic/scenes/useAttachedLogic'
import { cn } from 'lib/utils/css-classes'
import { sceneConfigurations } from 'scenes/scenes'
import { Scene, SceneExport } from 'scenes/sceneTypes'
+import { LiveRecordingsCount } from 'scenes/session-recordings/components/LiveRecordingsCount'
import { teamLogic } from 'scenes/teamLogic'
import { urls } from 'scenes/urls'
diff --git a/frontend/src/scenes/session-recordings/SessionsRecordings-player-failure.stories.tsx b/frontend/src/scenes/session-recordings/SessionsRecordings-player-failure.stories.tsx
index 9023409ac8b9..5bf8ab7eefc0 100644
--- a/frontend/src/scenes/session-recordings/SessionsRecordings-player-failure.stories.tsx
+++ b/frontend/src/scenes/session-recordings/SessionsRecordings-player-failure.stories.tsx
@@ -24,7 +24,6 @@ const meta: Meta = {
// API is set up so that everything except the call to load session recording metadata succeeds
mswDecorator({
get: {
- '/stats': () => [200, { users_on_product: 42, active_recordings: 7 }],
'/api/environments/:team_id/session_recordings': ({ request }) => {
const version = new URL(request.url).searchParams.get('version')
return [
@@ -121,7 +120,13 @@ const meta: Meta = {
},
},
post: {
- '/api/environments/:team_id/query/:kind': recordingEventsJson,
+ '/api/environments/:team_id/query/:kind': async ({ request }) => {
+ const body = (await request.json()) as Record<string, any>
+ if (body.query.kind === 'HogQLQuery' && body.query.query.includes('raw_session_replay_events')) {
+ return [200, { results: [[7]] }]
+ }
+ return [200, recordingEventsJson]
+ },
'/api/environments/:team_id/session_recordings/:id/capture_diagnostics': { properties: null },
},
}),
diff --git a/frontend/src/scenes/session-recordings/SessionsRecordings-player-success.stories.tsx b/frontend/src/scenes/session-recordings/SessionsRecordings-player-success.stories.tsx
index 50890467de5e..d97a716aa5f8 100644
--- a/frontend/src/scenes/session-recordings/SessionsRecordings-player-success.stories.tsx
+++ b/frontend/src/scenes/session-recordings/SessionsRecordings-player-success.stories.tsx
@@ -102,7 +102,6 @@ const meta: Meta = {
decorators: [
mswDecorator({
get: {
- '/stats': () => [200, { users_on_product: 42, active_recordings: 7 }],
'/api/environments/:team_id/session_recordings': ({ request }) => {
const version = new URL(request.url).searchParams.get('version')
return [
@@ -172,6 +171,10 @@ const meta: Meta = {
'/api/environments/:team_id/query/:kind': async ({ request }) => {
const body = (await request.json()) as Record<string, any>
+ if (body.query.kind === 'HogQLQuery' && body.query.query.includes('raw_session_replay_events')) {
+ return [200, { results: [[7]] }]
+ }
+
if (body.query.kind === 'HogQLQuery' && body.query.query.includes('$session_id as session_id')) {
return HttpResponse.json({
results: recordings.map((r) => [
diff --git a/frontend/src/scenes/session-recordings/SessionsRecordings-playlist-listing.stories.tsx b/frontend/src/scenes/session-recordings/SessionsRecordings-playlist-listing.stories.tsx
index 2cf83a9bade8..b371f2a4f61d 100644
--- a/frontend/src/scenes/session-recordings/SessionsRecordings-playlist-listing.stories.tsx
+++ b/frontend/src/scenes/session-recordings/SessionsRecordings-playlist-listing.stories.tsx
@@ -22,7 +22,6 @@ const meta: Meta = {
decorators: [
mswDecorator({
get: {
- '/stats': () => [200, { users_on_product: 42, active_recordings: 7 }],
'/api/projects/:team_id/session_recording_playlists': recordingPlaylists,
'/api/environments/:team_id/session_recordings': ({ request }) => {
const version = new URL(request.url).searchParams.get('version')
diff --git a/frontend/src/scenes/session-recordings/components/LiveRecordingsCount.tsx b/frontend/src/scenes/session-recordings/components/LiveRecordingsCount.tsx
new file mode 100644
index 000000000000..9f28ccd5fa81
--- /dev/null
+++ b/frontend/src/scenes/session-recordings/components/LiveRecordingsCount.tsx
@@ -0,0 +1,41 @@
+import { useValues } from 'kea'
+
+import { IconVideoCamera } from '@posthog/icons'
+import { Tooltip } from '@posthog/lemon-ui'
+
+import 'lib/components/LiveUserCount/LiveUserCount.scss'
+import { cn } from 'lib/utils/css-classes'
+import { humanFriendlyLargeNumber } from 'lib/utils/numbers'
+import { pluralize } from 'lib/utils/strings'
+
+import { liveRecordingsCountLogic } from './liveRecordingsCountLogic'
+
+export function LiveRecordingsCount(): JSX.Element | null {
+ const { activeRecordings } = useValues(liveRecordingsCountLogic)
+
+ if (activeRecordings === null) {
+ return null
+ }
+
+ const hasRecordings = activeRecordings > 0
+
+ return (
+ <Tooltip title="Session recordings currently in progress." placement="right">
+ <div
+ className={cn(
+ 'flex items-center gap-1.5 px-2 py-1 rounded-md transition-colors',
+ hasRecordings ? 'bg-success-highlight' : 'bg-border-light'
+ )}
+ >
+ <div className={cn('live-user-indicator', hasRecordings ? 'online' : 'offline')} />
+ <IconVideoCamera className="size-4 shrink-0 min-[660px]:hidden" />
+ <span className="text-xs font-medium whitespace-nowrap" data-attr="live-recordings-count">
+ <strong>{humanFriendlyLargeNumber(activeRecordings)}</strong>
+ </span>
+ <span className="hidden min-[660px]:inline">
+ recently active {pluralize(activeRecordings, 'recording', undefined, false)}
+ </span>
+ </div>
+ </Tooltip>
+ )
+}
diff --git a/frontend/src/scenes/session-recordings/components/liveRecordingsCountLogic.ts b/frontend/src/scenes/session-recordings/components/liveRecordingsCountLogic.ts
new file mode 100644
index 000000000000..215123d1c4d3
--- /dev/null
+++ b/frontend/src/scenes/session-recordings/components/liveRecordingsCountLogic.ts
@@ -0,0 +1,89 @@
+import { MakeLogicType, events, kea, path } from 'kea'
+import { loaders } from 'kea-loaders'
+
+import api from 'lib/api'
+
+import { QueryLogTags } from '~/queries/schema/schema-general'
+import { hogql } from '~/queries/utils'
+
+const POLL_INTERVAL_MS = 60000
+
+const QUERY_TAGS: QueryLogTags = { scene: 'Replay', productKey: 'session_replay' }
+
+// The min_first_timestamp bound lets ClickHouse prune on the sort key; a session cannot run longer than a day.
+const LIVE_RECORDINGS_COUNT_QUERY = hogql`
+ SELECT count()
+ FROM (
+ SELECT session_id
+ FROM raw_session_replay_events
+ WHERE _timestamp >= now() - INTERVAL 5 MINUTE
+ AND min_first_timestamp >= now() - INTERVAL 1 DAY
+ GROUP BY session_id
+ HAVING max(is_deleted) = 0
+ )`
+
+// Generated by kea-typegen. Update if you're an agent, ignore if you're human.
+export interface liveRecordingsCountLogicValues {
+ activeRecordings: number | null
+ activeRecordingsLoading: boolean
+}
+
+// Generated by kea-typegen. Update if you're an agent, ignore if you're human.
+export interface liveRecordingsCountLogicActions {
+ loadActiveRecordings: () => any
+ loadActiveRecordingsFailure: (
+ error: string,
+ errorObject?: any
+ ) => {
+ error: string
+ errorObject?: any
+ }
+ loadActiveRecordingsSuccess: (
+ activeRecordings: number | null,
+ payload?: any
+ ) => {
+ activeRecordings: number | null
+ payload?: any
+ }
+}
+
+export type liveRecordingsCountLogicType = MakeLogicType<
+ liveRecordingsCountLogicValues,
+ liveRecordingsCountLogicActions
+>
+
+export const liveRecordingsCountLogic = kea<liveRecordingsCountLogicType>([
+ path(['scenes', 'session-recordings', 'components', 'liveRecordingsCountLogic']),
+ loaders(({ values }) => ({
+ activeRecordings: [
+ null as number | null,
+ {
+ loadActiveRecordings: async () => {
+ // A failed poll keeps the last count instead of toasting every interval.
+ try {
+ // The default refresh mode would serve a cached count for up to 5 minutes.
+ const response = await api.queryHogQL<[number][]>(LIVE_RECORDINGS_COUNT_QUERY, QUERY_TAGS, {
+ refresh: 'force_blocking',
+ })
+ return response.results[0]?.[0] ?? 0
+ } catch {
+ return values.activeRecordings
+ }
+ },
+ },
+ ],
+ })),
+ events(({ actions, values, cache }) => ({
+ afterMount: () => {
+ cache.disposables.add(() => {
+ actions.loadActiveRecordings()
+ const intervalId = setInterval(() => {
+ if (!values.activeRecordingsLoading) {
+ actions.loadActiveRecordings()
+ }
+ }, POLL_INTERVAL_MS)
+ return () => clearInterval(intervalId)
+ }, 'pollInterval')
+ },
+ })),
+])
diff --git a/frontend/src/scenes/session-recordings/filters/RecordingsUniversalFiltersEmbed.stories.tsx b/frontend/src/scenes/session-recordings/filters/RecordingsUniversalFiltersEmbed.stories.tsx
index ad758c3b600e..fc89dba39978 100644
--- a/frontend/src/scenes/session-recordings/filters/RecordingsUniversalFiltersEmbed.stories.tsx
+++ b/frontend/src/scenes/session-recordings/filters/RecordingsUniversalFiltersEmbed.stories.tsx
@@ -30,7 +30,6 @@ const meta: Meta = {
decorators: [
mswDecorator({
get: {
- '/stats': () => [200, { users_on_product: 42, active_recordings: 7 }],
'/api/projects/:team_id/session_recording_playlists': recordingPlaylists,
'/api/environments/:team_id/session_recordings': ({ request }) => {
const version = new URL(request.url).searchParams.get('version')
@@ -38,7 +37,13 @@ const meta: Meta = {
},
},
post: {
- '/api/environments/:team_id/query/:kind': recordingEventsJson,
+ '/api/environments/:team_id/query/:kind': async ({ request }) => {
+ const body = (await request.json()) as Record<string, any>
+ if (body.query.kind === 'HogQLQuery' && body.query.query.includes('raw_session_replay_events')) {
+ return [200, { results: [[7]] }]
+ }
+ return [200, recordingEventsJson]
+ },
},
}),
],
diff --git a/frontend/src/scenes/session-recordings/playlist/SessionRecordingsPlaylistScene.stories.tsx b/frontend/src/scenes/session-recordings/playlist/SessionRecordingsPlaylistScene.stories.tsx
index 6a4e02a58aa3..acd88fdb9597 100644
--- a/frontend/src/scenes/session-recordings/playlist/SessionRecordingsPlaylistScene.stories.tsx
+++ b/frontend/src/scenes/session-recordings/playlist/SessionRecordingsPlaylistScene.stories.tsx
@@ -94,7 +94,6 @@ const meta: Meta = {
decorators: [
mswDecorator({
get: {
- '/stats': () => [200, { users_on_product: 42, active_recordings: 7 }],
'/api/environments/:team_id/session_recordings': () => [
200,
{ has_next: false, results: recordings, version: '1' },