Skip to content
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

feat(replay): Gap in replay timeline #73475

Merged
merged 7 commits into from
Jul 2, 2024
Merged

feat(replay): Gap in replay timeline #73475

merged 7 commits into from
Jul 2, 2024

Conversation

c298lee
Copy link
Member

@c298lee c298lee commented Jun 27, 2024

Creates gaps in the timeline between App in Background and App in Foreground frames. If there's no App in Foreground frame after App in Background, the gap continues to the end of the replay.

Example gap:
image

Example gap to end of replay:
image

Relates to #71665

@github-actions github-actions bot added the Scope: Frontend Automatically applied to PRs that change frontend components label Jun 27, 2024
Copy link

codecov bot commented Jun 27, 2024

Bundle Report

Changes will decrease total bundle size by 41.91kB ⬇️

Bundle name Size Change
app-webpack-bundle-array-push 27.25MB 41.91kB ⬇️

Copy link

codecov bot commented Jun 27, 2024

Codecov Report

Attention: Patch coverage is 47.36842% with 20 lines in your changes missing coverage. Please review.

Project coverage is 78.06%. Comparing base (0298eef) to head (e78f667).
Report is 160 commits behind head on master.

Additional details and impacted files
@@            Coverage Diff             @@
##           master   #73475      +/-   ##
==========================================
+ Coverage   78.01%   78.06%   +0.04%     
==========================================
  Files        6635     6645      +10     
  Lines      296747   296932     +185     
  Branches    51109    51140      +31     
==========================================
+ Hits       231512   231790     +278     
+ Misses      58851    58827      -24     
+ Partials     6384     6315      -69     
Files Coverage Δ
.../components/replays/breadcrumbs/replayTimeline.tsx 76.92% <100.00%> (+0.92%) ⬆️
static/app/utils/replays/replayReader.tsx 84.37% <100.00%> (+0.24%) ⬆️
static/app/utils/replays/types.tsx 74.46% <100.00%> (+2.37%) ⬆️
...pp/components/replays/breadcrumbs/timelineGaps.tsx 33.33% <33.33%> (ø)

... and 216 files with indirect coverage changes

Copy link
Member

@michellewzhang michellewzhang left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

generally it looks good so far! will leave the floor open for others to comment :)

@c298lee c298lee marked this pull request as ready for review June 28, 2024 20:35
@c298lee c298lee requested a review from a team as a code owner June 28, 2024 20:35
@c298lee c298lee requested a review from michellewzhang June 28, 2024 20:35
Copy link
Member

@michellewzhang michellewzhang left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

new logic & comments look good to me - seems like we have all the cases covered.

  • no background/foreground fames --> skip the big while loop, no gaps rendered.
  • only background frames for some reason --> we'll only set start, and it'll be a gap from start to the end.
  • only foreground frames for some reason --> start never gets set, and we'll reach the end of gapFrames. we don't push anything to gapCol, so we don't render any gaps.
  • mix of background/foreground frames --> iterate through the gapFrames matching up start and end to render the gaps, until we reach one of the cases above

(lmk if any of those sound wrong)

static/app/components/replays/breadcrumbs/timelineGaps.tsx Outdated Show resolved Hide resolved
@michellewzhang
Copy link
Member

michellewzhang commented Jun 28, 2024

would be good to test with a few more replays (especially those with multiple gaps) before merging - you can ping @romtsn or @brustolin or @krystofwoldrich to generate some!

const totalColumns = Math.floor(width / markerWidth);
const framesByCol = getFramesByColumn(
durationMs,
frames.filter(f => isBackgroundFrame(f) || isForegroundFrame(f)),
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This type of filter could be put into ReplayReader and memoized. replayTimeline.tsx could call something like replay.getFooFrames() to fetch just the list we need here.

Comment on lines +196 to +200
export function isBackgroundFrame(frame: ReplayFrame): frame is BreadcrumbFrame {
return frame && 'category' in frame && frame.category === 'app.background';
}

export function isForegroundFrame(frame: ReplayFrame): frame is BreadcrumbFrame {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It could be useful if we had more specific types instead of frame is BreadcrumbFrame

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I get type issues when I try to use BackgroundFrame instead :(

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No. We can iterate on it later

Copy link
Member

@ryan953 ryan953 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Accepting to unblock

@c298lee c298lee merged commit 5d3735a into master Jul 2, 2024
42 of 43 checks passed
@c298lee c298lee deleted the cl/timeline-gap branch July 2, 2024 21:56
@krystofwoldrich
Copy link
Member

krystofwoldrich commented Jul 4, 2024

Here is an Android example replay with multiple app suspensions. Looks good.

@github-actions github-actions bot locked and limited conversation to collaborators Jul 19, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Scope: Frontend Automatically applied to PRs that change frontend components
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants