Skip to content

Conversation

@michellewzhang
Copy link
Member

@michellewzhang michellewzhang commented Nov 6, 2025

related to: #102897

backend PR for filtering out events that occur before the replay start time, so we don't have to generate log messages for those. we filter out these events on the frontend as well -- they aren't shown as breadcrumbs.

also fix some timestamp inconsistencies in tests

@michellewzhang michellewzhang requested a review from a team as a code owner November 6, 2025 23:14
@github-actions github-actions bot added the Scope: Backend Automatically applied to PRs that change backend components label Nov 6, 2025
Copy link
Contributor

@cursor cursor bot left a comment

Choose a reason for hiding this comment

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

Bug: Prematurely Emitting Pre-Start Error Events

Remaining error events are yielded without checking if they occurred before replay_start_ms. After processing all segment events, the code yields all remaining errors regardless of their timestamps, allowing error messages from before the replay started to appear in the logs.

src/sentry/replays/usecases/summarize.py#L310-L320

# Yield any remaining error messages
while error_idx < len(error_events):
error = error_events[error_idx]
if error["category"] == "error":
yield generate_error_log_message(error)
elif error["category"] == "feedback":
yield generate_feedback_log_message(error)
error_idx += 1

Fix in Cursor Fix in Web


Copy link
Contributor

@cursor cursor bot left a comment

Choose a reason for hiding this comment

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

Bug: Feedback breadcrumb timestamp in seconds causes filtering error

The feedback breadcrumb timestamp in the test is in seconds instead of milliseconds. The timestamp field should be float((now - timedelta(minutes=3)).timestamp() * 1000) to match the expected millisecond format for segment events, causing this feedback to be incorrectly filtered out as occurring before the replay start.

tests/sentry/replays/usecases/test_summarize.py#L1404-L1405

self.store_replay(dt=now - timedelta(minutes=10), segment_id=0, trace_ids=[trace_id])

Fix in Cursor Fix in Web


@codecov
Copy link

codecov bot commented Nov 6, 2025

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ All tests successful. No failed tests found.

Additional details and impacted files
@@             Coverage Diff              @@
##           master   #102931       +/-   ##
============================================
+ Coverage   65.88%    80.70%   +14.81%     
============================================
  Files        9226      9027      -199     
  Lines      394039    393500      -539     
  Branches    25103     24958      -145     
============================================
+ Hits       259610    317559    +57949     
+ Misses     130896     75544    -55352     
+ Partials     3533       397     -3136     

@michellewzhang michellewzhang merged commit fc6bfca into master Nov 18, 2025
66 checks passed
@michellewzhang michellewzhang deleted the mz/filter-be-replay-logs branch November 18, 2025 16:16
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Scope: Backend Automatically applied to PRs that change backend components

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants