-
-
Notifications
You must be signed in to change notification settings - Fork 428
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
[SR] Capture gestures/motion events #3390
base: rz/feat/session-replay
Are you sure you want to change the base?
[SR] Capture gestures/motion events #3390
Conversation
* to change the menu param from non null to nullable to avoid runtime null check crashes. Issue: | ||
* https://issuetracker.google.com/issues/188568911 | ||
*/ | ||
public class FixedWindowCallback implements Window.Callback { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I know we have WindowCallbackAdapter, but I don't wanna depend on sentry-android-core just for that single class, so I've added another one (enhanced, as it fixes an NPE actually)
Performance metrics 🚀
|
Revision | Plain | With Sentry | Diff |
---|---|---|---|
54ce31d | 356.89 ms | 426.10 ms | 69.21 ms |
9576d82 | 413.17 ms | 484.73 ms | 71.56 ms |
a3367a7 | 364.14 ms | 460.69 ms | 96.54 ms |
8e7260f | 367.84 ms | 445.06 ms | 77.22 ms |
9bab4f1 | 418.92 ms | 474.58 ms | 55.67 ms |
03fdaa2 | 364.22 ms | 448.15 ms | 83.92 ms |
4905abb | 394.22 ms | 532.53 ms | 138.31 ms |
App size
Revision | Plain | With Sentry | Diff |
---|---|---|---|
54ce31d | 1.70 MiB | 2.31 MiB | 627.54 KiB |
9576d82 | 1.70 MiB | 2.31 MiB | 627.54 KiB |
a3367a7 | 1.70 MiB | 2.32 MiB | 635.88 KiB |
8e7260f | 1.70 MiB | 2.31 MiB | 627.54 KiB |
9bab4f1 | 1.70 MiB | 2.32 MiB | 635.88 KiB |
03fdaa2 | 1.70 MiB | 2.32 MiB | 635.88 KiB |
4905abb | 1.70 MiB | 2.31 MiB | 627.54 KiB |
) : FixedWindowCallback(delegate) { | ||
override fun dispatchTouchEvent(event: MotionEvent?): Boolean { | ||
if (event != null) { | ||
val copy: MotionEvent = MotionEvent.obtain(event) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
sweet, that's the way!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
btw. there's also a obtainNoHistory()
which should be a bit more performant: https://developer.android.com/reference/android/view/MotionEvent#obtainNoHistory(android.view.MotionEvent)
@@ -60,6 +71,11 @@ internal abstract class BaseCaptureStrategy( | |||
override val currentSegment = AtomicInteger(0) | |||
override val replayCacheDir: File? get() = cache?.replayCacheDir | |||
|
|||
protected val currentEvents = CopyOnWriteArrayList<RRWebEvent>() |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Not sure if CopyOnWriteArrayList
is a good strategy here, as there will be many inserts and deletes to this.
final RRWebEventType type = RRWebEventType.values()[(int) value]; | ||
switch (type) { | ||
case IncrementalSnapshot: | ||
Map<String, Object> incrementalData = |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nit
Map<String, Object> incrementalData = | |
@Nullable Map<String, Object> incrementalData = |
Map<String, Object> data = (Map<String, Object>) eventMap.get("data"); | ||
if (data == null) { | ||
data = Collections.emptyMap(); | ||
Map<String, Object> customData = (Map<String, Object>) eventMap.get("data"); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Map<String, Object> customData = (Map<String, Object>) eventMap.get("data"); | |
@Nullable Map<String, Object> customData = (Map<String, Object>) eventMap.get("data"); |
#skip-changelog
📜 Description
WindowRecorder
MouseInteraction
source with typeTouchStart
/TouchCancel
/TouchEnd
TouchMove
source with a list of positionsHere's an example event but playback not yet working: https://sentry-sdks.sentry.io/replays/d297a781640d4f8f966dd0cba27cf142/?project=5428559&query=&referrer=%2Freplays%2F%3AreplaySlug%2F&statsPeriod=1h&t_main=breadcrumbs&yAxis=count%28%29&t=0
💡 Motivation and Context
Part of getsentry/sentry#70065