Browse Source

fix(replay): Move timeline frame metric (#74951)

The frame metric was right after the start of the gap was set, which
would cause extra background frames to be tracked. The metric should be
before the start of the timeline gap is set.
Catherine Lee 7 months ago
parent
commit
38fa365205
1 changed files with 5 additions and 5 deletions
  1. 5 5
      static/app/components/replays/breadcrumbs/timelineGaps.tsx

+ 5 - 5
static/app/components/replays/breadcrumbs/timelineGaps.tsx

@@ -29,11 +29,6 @@ export default function TimelineGaps({durationMs, startTimestampMs, frames}: Pro
   let end = -1;
 
   for (const currFrame of frames) {
-    // only considered start of gap if background frame hasn't been found yet
-    if (start === -1 && isBackgroundFrame(currFrame)) {
-      start = currFrame.timestampMs - startTimestampMs;
-    }
-
     // add metrics for frame coming after a background frame to see how often we have bad data
     if (start !== -1) {
       trackAnalytics('replay.frame-after-background', {
@@ -42,6 +37,11 @@ export default function TimelineGaps({durationMs, startTimestampMs, frames}: Pro
       });
     }
 
+    // only considered start of gap if background frame hasn't been found yet
+    if (start === -1 && isBackgroundFrame(currFrame)) {
+      start = currFrame.timestampMs - startTimestampMs;
+    }
+
     // gap only ends if a frame that's not a background frame or error frame has been found
     if (start !== -1 && !isBackgroundFrame(currFrame) && !isErrorFrame(currFrame)) {
       end = currFrame.timestampMs - startTimestampMs;