fix: Properly show session replays from very long sessions in client … (#414)

This commit is contained in:
Mike Shi 2024-05-28 13:37:58 -07:00 committed by GitHub
parent b192366f55
commit 63e7d301d5
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
2 changed files with 15 additions and 1 deletions

View file

@ -0,0 +1,6 @@
---
'@hyperdx/api': patch
---
fix: Properly show session replays from very long sessions in client sessions
search results

View file

@ -2371,12 +2371,20 @@ export const getSessions = async ({
],
);
// Filter by either a record init span, or a visibility span
// 1. Record init is emitted on SDK initialization and should only happen
// if there is an actual recording being done for the session (ex. no background sessions)
// 2. Visibility is needed as sessions are rolled over every 4 hours, and therefore
// there isn't always a record init event in every session if the user has been
// on a page for longer than 4 hours. We're using the visibility event
// as a proxy for a user interacting with the page and likely will have some
// recording for the session
const sessionsWithRecordingsQuery = SqlString.format(
`WITH sessions AS (${sessionsWithSearchQuery}),
sessionIdsWithRecordings AS (
SELECT DISTINCT _rum_session_id as sessionId
FROM ??
WHERE span_name='record init'
WHERE (span_name='record init' OR span_name='visibility')
AND (_rum_session_id IN (SELECT sessions.sessionId FROM sessions))
AND (?)
)