Repository navigation
fix(replay): Measure gesture batch durations on a monotonic clock (JAVA-830) - #6538
Merged
Merged
Conversation
Touch moves are batched and sent as one RRWebInteractionMoveEvent every 500ms. Both the batch timer and each position's timeOffset subtracted wall-clock readings, so a clock step corrupted them: a backward step held the batch back until the clock caught up, and dropped it if the finger lifted first; a forward step sent it at once with offsets stretched by the step. Both now come from one Stopwatch on the converter's MonotonicTicker, started with the first batched position. Without a clock step the output is unchanged. The event timestamps stay on the wall clock; they move to an AnchoredClock in v9. Fixes JAVA-830 Fixes #6523 Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
📲 Install BuildsAndroid
|
runningcode
commented
Nov 10, 2026
runningcode
marked this pull request as ready for review
November 10, 2026 12:58
runningcode
requested review from
0xadam-brown and
romtsn
and removed request for
a team
November 10, 2026 12:58
8 of 9 tasks
3 tasks done
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
📜 Description
This is part of the work to get rid of our uses of wall clocks where we should in fact be using monotonic clocks. Gesture tracking is a definite use case where we should be using monotonic clocks.
We batch gestures every 500ms.
Here's a little table of the two things we're changing in this PR created by my clanker. Note
nowin the chart below isdateProvider.currentTimeMillis.moveBatchfor reference is aio.sentry.time.Stopwatch.now - touchMoveBaseline > 500moveBatch.elapsed(MILLISECONDS) > 500timeOffsetnow - touchMoveBaselinemoveBatch.elapsed(MILLISECONDS)What this PR deliberately does not change
The event timestamps (
timestamp = nowon the move event, and the touch start, end and cancel timestamps) are instants and stay on the wall clock. They move to anAnchoredClockin v9 (JAVA-829).💡 Motivation and Context
Wall clocks are bad since they can move forward and backward and are not the correct tool for batching gestures.
💚 How did you test it?
Existing tests pass and new tests added:
wall clock stepping backwards during a swipe does not hold back the batchwall clock stepping forwards during a swipe does not send the batch early📝 Checklist
sendDefaultPIIis enabled.🔮 Next steps
Move the gesture event timestamps onto an
AnchoredClockin v9 (JAVA-829).🤖 Generated with Claude Code