sentry-java
sentry-java copied to clipboard
[SR] Add screenshot recorder
#skip-changelog
This is just a dump of the PoC phase more-or-less, so a lot will be refactored and made pretty, but you're welcome to review nonetheless. I've tried to left TODOs where I see changes forthcoming
Relates to:
- https://github.com/getsentry/sentry/issues/63255
Performance metrics :rocket:
| Plain | With Sentry | Diff | |
|---|---|---|---|
| Startup time | 392.73 ms | 459.08 ms | 66.35 ms |
| Size | 1.70 MiB | 2.27 MiB | 584.69 KiB |
Previous results on branch: rz/feat/session-replay-sources
Startup times
| Revision | Plain | With Sentry | Diff |
|---|---|---|---|
| acb8705ef99a1c3688ac0b162a689a2cca7ce17b | 340.75 ms | 368.17 ms | 27.42 ms |
| 6d9e7219d2967e62137d57065c4be8d13a75eef5 | 383.10 ms | 458.98 ms | 75.88 ms |
| 268db42f1e6683e36c29715675888242fc947c90 | 415.38 ms | 481.70 ms | 66.31 ms |
| 4ffa796c967b2035a46915c67733bc77f5d25558 | 382.90 ms | 445.32 ms | 62.42 ms |
| 007a5ae1fd25674f1b5a8bc3c38a3424bf7c7728 | 383.88 ms | 455.89 ms | 72.02 ms |
| 6c0fe2905a1bb768656e117efce4933f37cbbb51 | 381.20 ms | 444.18 ms | 62.98 ms |
App size
| Revision | Plain | With Sentry | Diff |
|---|---|---|---|
| acb8705ef99a1c3688ac0b162a689a2cca7ce17b | 1.70 MiB | 2.27 MiB | 584.69 KiB |
| 6d9e7219d2967e62137d57065c4be8d13a75eef5 | 1.70 MiB | 2.27 MiB | 584.69 KiB |
| 268db42f1e6683e36c29715675888242fc947c90 | 1.70 MiB | 2.27 MiB | 584.69 KiB |
| 4ffa796c967b2035a46915c67733bc77f5d25558 | 1.70 MiB | 2.27 MiB | 584.69 KiB |
| 007a5ae1fd25674f1b5a8bc3c38a3424bf7c7728 | 1.70 MiB | 2.27 MiB | 584.69 KiB |
| 6c0fe2905a1bb768656e117efce4933f37cbbb51 | 1.70 MiB | 2.27 MiB | 584.69 KiB |
Not much to review for me here, because, as you're saying, "This is just a dump of the PoC".
I'd be interested to see the refactored version that would be usable from outside sentry-java
You got to tell me what do you want to have exposed then :)
You got to tell me what do you want to have exposed then :)
I imagine the code that captures images is going to be separate from the code that produces the video, at least from your description how it's going to be done in two steps in order to avoid loses during crashes. In order to use that from another SDK, we'd need an interface that allows constructing this envelope, i.e. creating the video (from bitmaps), adding replay events ans such. I assume sending the envelope is no different than any other envelope so that should be already done.
i.e. creating the video (from bitmaps)
Yeah, this makes sense, I'll create a new method in SimpleVideoEncoder that creates a video out of a bitmap list. But this:
we'd need an interface that allows constructing this envelope
I'm not sure. Don't we usually do that on the hybrid SDK level and then just pass the envelope bytes to captureEnvelope? https://github.com/getsentry/sentry-dart/blob/732a7b44ad1624e75967be2227665c066ef0154e/dart/lib/src/sentry_envelope.dart
i.e. creating the video (from bitmaps)
Yeah, this makes sense, I'll create a new method in SimpleVideoEncoder that creates a video out of a bitmap list. But this:
we'd need an interface that allows constructing this envelope
I'm not sure. Don't we usually do that on the hybrid SDK level and then just pass the envelope bytes to
captureEnvelope? https://github.com/getsentry/sentry-dart/blob/732a7b44ad1624e75967be2227665c066ef0154e/dart/lib/src/sentry_envelope.dart
In this case we won't be creating the envelope in dart due to the cost of transferring the data. Instead, sentry-dart has a native kotlin binding that would call native functions to create and send the envelope.
i.e. creating the video (from bitmaps)
Yeah, this makes sense, I'll create a new method in SimpleVideoEncoder that creates a video out of a bitmap list. But this:
we'd need an interface that allows constructing this envelope
I'm not sure. Don't we usually do that on the hybrid SDK level and then just pass the envelope bytes to
captureEnvelope? getsentry/sentry-dart@732a7b4/dart/lib/src/sentry_envelope.dartIn this case we won't be creating the envelope in dart due to the cost of transferring the data. Instead, sentry-dart has a native kotlin binding that would call native functions to create and send the envelope.
Alright, let me give it a stab for the Android SDK first and then we can discuss in the following PR what has to be changed and so on. I imagine this is all the glue code I'm gonna write to connect recording and envelopes that is the most valuable for you.