posthog icon indicating copy to clipboard operation
posthog copied to clipboard

feat: network waterfall view for session replay

Open pauldambra opened this issue 1 year ago â€ĸ 8 comments

#TravelHackathon

We have all the data we need to generate page reports in individual recording's session replay data

We can't make it queryable but we can display it individually, that's already useful so let's do that

Screenshot 2024-05-19 at 22 16 19

TODO

  • [x] react to playlist ID changes
  • [ ] don't mark as viewed?
  • [x] show breakdown of asset types by size
  • [ ] allow filtering to remove asset types from view
  • [ ] make it exportable?
  • [ ] make it work with notebooks
  • [ ] change the URL when e.g. paging so you can share with others
  • [ ] allow public sharing?
  • [ ] make an aggregate view that shows the whole session collapsed by URL with box-plots

pauldambra avatar May 18 '24 08:05 pauldambra

Size Change: +58 B (+0.01%)

Total Size: 1.03 MB

â„šī¸ View Unchanged
Filename Size Change
frontend/dist/toolbar.js 1.03 MB +58 B (+0.01%)

compressed-size-action

github-actions[bot] avatar May 18 '24 08:05 github-actions[bot]

📸 UI snapshots have been updated

2 snapshot changes in total. 0 added, 2 modified, 0 deleted:

  • chromium: 0 added, 2 modified, 0 deleted (diff for shard 1)
  • webkit: 0 added, 0 modified, 0 deleted

Triggered by this commit.

👉 Review this PR's diff of snapshots.

posthog-bot avatar May 18 '24 14:05 posthog-bot

📸 UI snapshots have been updated

2 snapshot changes in total. 0 added, 2 modified, 0 deleted:

  • chromium: 0 added, 2 modified, 0 deleted (diff for shard 1)
  • webkit: 0 added, 0 modified, 0 deleted

Triggered by this commit.

👉 Review this PR's diff of snapshots.

posthog-bot avatar May 18 '24 14:05 posthog-bot

@daibhin thought I'd put something up you can play with to get UX feedback - am already thinking it should be called "page report" not "network view"

pauldambra avatar May 19 '24 08:05 pauldambra

pulled out

  • https://github.com/PostHog/posthog/pull/22355
  • https://github.com/PostHog/posthog/pull/22352

pauldambra avatar May 19 '24 16:05 pauldambra

Walkthrough

This update introduces a comprehensive enhancement to the session recordings feature by adding a network view for performance events. The changes include new components, logic, and utilities for displaying network-related data, as well as updates to existing logic to incorporate these new features. Additionally, feature flags are used to control the visibility of the network view.

Changes

File Path Change Summary
frontend/src/lib/constants.tsx Added SESSION_REPLAY_NETWORK_VIEW to FEATURE_FLAGS.
frontend/src/scenes/session-recordings/SessionRecordings.tsx Added new components (Header, Warnings, MainPanel, PageTabs).
frontend/src/scenes/session-recordings/apm/NetworkView.tsx Introduced components and logic for network-related performance events.
frontend/src/scenes/session-recordings/apm/components/AssetProportions.tsx Added AssetProportions component for asset breakdown.
frontend/src/scenes/session-recordings/apm/components/PerformanceCard.tsx Added components for displaying performance metrics.
frontend/src/scenes/session-recordings/apm/networkViewLogic.ts Introduced logic for managing network view data.
frontend/src/scenes/session-recordings/apm/performance-event-utils.test.ts Updated import path for matchNetworkEvents.
frontend/src/scenes/session-recordings/apm/performance-event-utils.ts Added functions and constants for performance event handling.
frontend/src/scenes/session-recordings/apm/performanceEventDataLogic.ts Added logic for performance event data handling.
frontend/src/scenes/session-recordings/apm/playerInspector/ItemPerformanceEvent.tsx Added StatusTag and MethodTag functions.
frontend/src/scenes/session-recordings/apm/waterfall/NetworkBar.tsx Introduced NetworkBar component for waterfall view.
frontend/src/scenes/session-recordings/apm/waterfall/TimeLineView.tsx Added imports and modified function parameters for waterfall view.
frontend/src/scenes/session-recordings/apm/waterfall/TimingBar.tsx Added and modified entities for performance timing bars.
frontend/src/scenes/session-recordings/player/inspector/components/NavigationItem.tsx Refactored rendering of performance summary cards.
frontend/src/scenes/session-recordings/player/inspector/components/PlayerInspectorListItem.tsx Moved import of ItemPerformanceEvent.
frontend/src/scenes/session-recordings/player/inspector/components/Timing/NetworkRequestTiming.tsx Removed and added imports and functions.
frontend/src/scenes/session-recordings/player/inspector/playerInspectorLogic.ts Updated imports and logic related to performance events.
frontend/src/scenes/session-recordings/player/sessionRecordingDataLogic.ts Modified logic for snapshot handling.
frontend/src/scenes/session-recordings/playlist/SessionRecordingsPlaylist.tsx Restructured logic for conditional rendering.
frontend/src/scenes/session-recordings/playlist/sessionRecordingsPlaylistLogic.ts Added ReplayTabs import and currentTab property.
frontend/src/scenes/session-recordings/sessionRecordingsLogic.ts Updated tabs selector to consider feature flags for NetworkView.
frontend/src/types.ts Added NetworkView to ReplayTabs enum.

🐇 In the code where sessions play, Network views now have their say. Waterfalls and timings bright, Performance metrics in clear sight. Flags will guide what users see, Enhancing views with APM spree. đŸ–Ĩī¸âœ¨


Thank you for using CodeRabbit. We offer it for free to the OSS community and would appreciate your support in helping us grow. If you find it useful, would you consider giving us a shout-out on your favorite social media?

Share
Tips

Chat

There are 3 ways to chat with CodeRabbit:

  • Review comments: Directly reply to a review comment made by CodeRabbit. Example:
    • I pushed a fix in commit <commit_id>.
    • Generate unit testing code for this file.
    • Open a follow-up GitHub issue for this discussion.
  • Files and specific lines of code (under the "Files changed" tab): Tag @coderabbitai in a new review comment at the desired location with your query. Examples:
    • @coderabbitai generate unit testing code for this file.
    • @coderabbitai modularize this function.
  • PR comments: Tag @coderabbitai in a new PR comment to ask questions about the PR branch. For the best results, please provide a very specific query, as very limited context is provided in this mode. Examples:
    • @coderabbitai generate interesting stats about this repository and render them as a table.
    • @coderabbitai show all the console.log statements in this repository.
    • @coderabbitai read src/utils.ts and generate unit testing code.
    • @coderabbitai read the files in the src/scheduler package and generate a class diagram using mermaid and a README in the markdown format.

Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments.

CodeRabbit Commands (invoked as PR comments)

  • @coderabbitai pause to pause the reviews on a PR.
  • @coderabbitai resume to resume the paused reviews.
  • @coderabbitai review to trigger a review. This is useful when automatic reviews are disabled for the repository.
  • @coderabbitai resolve resolve all the CodeRabbit review comments.
  • @coderabbitai help to get help.

Additionally, you can add @coderabbitai ignore anywhere in the PR description to prevent this PR from being reviewed.

CodeRabbit Configration File (.coderabbit.yaml)

  • You can programmatically configure CodeRabbit by adding a .coderabbit.yaml file to the root of your repository.
  • Please see the configuration documentation for more information.
  • If your editor has YAML language server enabled, you can add the path at the top of this file to enable auto-completion and validation: # yaml-language-server: $schema=https://coderabbit.ai/integrations/schema.v2.json

Documentation and Community

  • Visit our Documentation for detailed information on how to use CodeRabbit.
  • Join our Discord Community to get help, request features, and share feedback.
  • Follow us on X/Twitter for updates and announcements.

coderabbitai[bot] avatar May 19 '24 21:05 coderabbitai[bot]

This feels cool. Great to give people another means of analysing their data. I made two larger changes:

  • Put the contents into a table for easier formatting
  • Cleaned up the asset proportions to hide text on smaller screens

I think the main question I took away from it all was why this is a separate tab to the recordings? I'd imagine it would be quite annoying to have to switch between the two tabs and find a recording again if you want to look at the waterfall view.

Do we expect someone to use this while analysing a recording or is it something they'd intentionally come to do? Could this be a different view on the existing recording that you can toggle to? Or maybe it could just be another tab in the inspector?

daibhin avatar May 20 '24 15:05 daibhin

I think the main question I took away from it all was why this is a separate tab to the recordings?

Yeah, I think eventually you'd want to be able to visit individual page reports, share them, export them.

It was separate mostly just cos I was figuring it out as I go. And a way to promote the feature more easily.


I don't think it should live only in the inspector. It feels too restricted.


I'd be keen to get it in behind a flag so we can see the display with some production data to sense check that.

pauldambra avatar May 20 '24 16:05 pauldambra

super confused why moving the initiator type color mapping has broken all uses of color in js tests đŸĢ 

pauldambra avatar May 20 '24 16:05 pauldambra

📸 UI snapshots have been updated

3 snapshot changes in total. 0 added, 3 modified, 0 deleted:

  • chromium: 0 added, 3 modified, 0 deleted (diff for shard 2)
  • webkit: 0 added, 0 modified, 0 deleted

Triggered by this commit.

👉 Review this PR's diff of snapshots.

posthog-bot avatar May 23 '24 16:05 posthog-bot

📸 UI snapshots have been updated

4 snapshot changes in total. 0 added, 4 modified, 0 deleted:

Triggered by this commit.

👉 Review this PR's diff of snapshots.

posthog-bot avatar May 24 '24 09:05 posthog-bot

📸 UI snapshots have been updated

1 snapshot changes in total. 0 added, 1 modified, 0 deleted:

  • chromium: 0 added, 1 modified, 0 deleted (diff for shard 1)
  • webkit: 0 added, 0 modified, 0 deleted

Triggered by this commit.

👉 Review this PR's diff of snapshots.

posthog-bot avatar May 24 '24 09:05 posthog-bot