Skip to content
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] Introduce MapObjectReader #3215

Conversation

romtsn
Copy link
Member

@romtsn romtsn commented Feb 20, 2024

#skip-changelog

Add new sentry-android-replay module## 📜 Description

  • Extract an interface ObjectReader from JsonObjecteReader and introduce a new MapObjectReader analogous to what @markushi has done for the hybrid SDKs in Add API to retrieve Android scope data #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).

💡 Motivation and Context

Next Steps

Add some tests for the MapObjectReader

@romtsn romtsn changed the title Introduce MapObjectReader [SR] Introduce MapObjectReader Feb 20, 2024
Copy link
Contributor

github-actions bot commented Feb 20, 2024

Performance metrics 🚀

  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
6e79b82 354.06 ms 437.15 ms 83.09 ms
8bd0d19 370.40 ms 456.58 ms 86.18 ms

App size

Revision Plain With Sentry Diff
6e79b82 1.70 MiB 2.28 MiB 591.07 KiB
8bd0d19 1.70 MiB 2.28 MiB 591.11 KiB

@@ -86,8 +86,7 @@ public static Breadcrumb fromMap(
switch (entry.getKey()) {
case JsonKeys.TIMESTAMP:
if (value instanceof String) {
Date deserializedDate =
JsonObjectReader.dateOrNull((String) value, options.getLogger());
Date deserializedDate = ObjectReader.dateOrNull((String) value, options.getLogger());
Copy link
Member

Choose a reason for hiding this comment

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

Suggested change
Date deserializedDate = ObjectReader.dateOrNull((String) value, options.getLogger());
final Date deserializedDate = ObjectReader.dateOrNull((String) value, options.getLogger());

Copy link
Member

@markushi markushi left a comment

Choose a reason for hiding this comment

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

LGTM, nice!

@romtsn romtsn merged commit 4db19e0 into rz/feat/session-replay-envelopes Feb 28, 2024
21 checks passed
@romtsn romtsn deleted the rz/feat/session-replay-map-object-reader branch February 28, 2024 11:17
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants