sentry-java icon indicating copy to clipboard operation
sentry-java copied to clipboard

[SR] Introduce MapObjectReader

Open romtsn opened this issue 1 year ago • 1 comments

#skip-changelog

Add new sentry-android-replay module## :scroll: Description

  • Extract an interface ObjectReader from JsonObjecteReader and introduce a new MapObjectReader analogous to what @markushi has done for the hybrid SDKs in https://github.com/getsentry/sentry-java/pull/2814
    • This is necessary to transform object from Maps to typed object for RRWebEvents since we hold a list of generics and lose their type at runtime.
  • I also think this probably will be useful in the future if hybrid sdks will pass the data to the native ones in form of dictionaries (probably gonna be the case for Flutter session replay)

There are still some rough edges I believe, but it works for the current replay usecase, and I think it should be fine. I'll add some tests but won't cover everything (will fix stuff along-the-way if I find something).

:bulb: Motivation and Context

Next Steps

Add some tests for the MapObjectReader

romtsn avatar Feb 20 '24 23:02 romtsn

Performance metrics :rocket:

  Plain With Sentry Diff
Startup time 356.45 ms 440.81 ms 84.36 ms
Size 1.70 MiB 2.28 MiB 591.11 KiB

Previous results on branch: rz/feat/session-replay-map-object-reader

Startup times

Revision Plain With Sentry Diff
6e79b82a3cf3ee04d56f46c49238e9855a412d5f 354.06 ms 437.15 ms 83.09 ms
8bd0d19603d2760fd17febcad32043e7c9629ce4 370.40 ms 456.58 ms 86.18 ms

App size

Revision Plain With Sentry Diff
6e79b82a3cf3ee04d56f46c49238e9855a412d5f 1.70 MiB 2.28 MiB 591.07 KiB
8bd0d19603d2760fd17febcad32043e7c9629ce4 1.70 MiB 2.28 MiB 591.11 KiB

github-actions[bot] avatar Feb 20 '24 23:02 github-actions[bot]