-
Notifications
You must be signed in to change notification settings - Fork 1.5k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Show session recording durations in sessions list when available #4853
Conversation
This is a good solution but the original issue raised was about "Distribution of Session Lengths" in the sessions insight (internal link for example). I'd be harder to solve though as you'd need to do a query across both the events table and session recordings table. Maybe the actual solution is trying to figure out why $pageleave doesn't get sent? I suspect it may have something to do with the fact that we're using that beacon to also send session recording data which is really big |
There were several issues raised in the thread, including this one about incorrect durations in the sessions list. That's what the "more context in issue" bit above is referring to as well. As for "Distribution of Session Lengths", there's no easy solution and what I replied in the thread still holds true: the best bet is to wait until we start showing a distribution of times between funnel steps. Copying from the thread (with slight cleanup):
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
A few minor comments, but code-wise looks good.
Not sure if displaying the session duration just relying on the recording size is the best approach here though. What if we didn't have a recording for the entirety of the session? I know for instance some users were conditionally turning session recording in certain pages only.
yield {"id": recording["session_id"], "viewed": recording["session_id"] in viewed} | ||
if isinstance(recording["duration"], datetime.timedelta): | ||
# postgres | ||
recording_duration = recording["duration"].seconds |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Might be better to use recording["duration"].total_seconds()
in case the timedelta is not set with the seconds
property?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
oh django, you continue to surprise me :)
@@ -211,7 +217,9 @@ export function SessionsView({ personIds, isPersonPage = false }: SessionsTableP | |||
</div> | |||
|
|||
<ResizableTable | |||
locale={{ emptyText: 'No Sessions on ' + dayjs(selectedDate).format('YYYY-MM-DD') }} | |||
locale={{ | |||
emptyText: selectedDate ? 'No Sessions on ' + selectedDate.format('YYYY-MM-DD') : 'No Sessions', |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nit: Date format would look better like this (and in line with the new tooltips & legends)
selectedDate.year() == dayjs().year() ? 'MMM D' : 'MMM D, YYYY'
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
cool! we should probably util
this some day
@@ -104,6 +104,12 @@ export function SessionsView({ personIds, isPersonPage = false }: SessionsTableP | |||
{ | |||
title: 'Session duration', | |||
render: function RenderDuration(session: SessionType) { | |||
if (session.session_recordings.length > 0) { | |||
const sum = session.session_recordings | |||
.map(({ recording_duration }) => recording_duration) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Not sure if we need to do recording_duration || 0
in case it's null
or undefined
from the backend?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It should always have some value, but to be sure, I added a or 0
in the backend.
I added one fix to also update the session end time according to the recording duration, when it makes sense to do so.
Well, we do |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🚢 !
Unrelated failing tests |
Changes
$snapshot
events, not just regular events like before.Testing locally with some random sessions it does bump a few "1sec" sessions to "~10sec" territory and add a few other minutes here and there:
Before:
After:
Checklist