DataDog / dd-sdk-android

Datadog SDK for Android (Compatible with Kotlin and Java)
Apache License 2.0
140 stars 56 forks source link

RUM-4715:SwitchCompat mapper improvement #2117

Closed ambushwork closed 5 days ago

ambushwork commented 6 days ago

What does this PR do?

Improve the SwitchCompatMapper to make SwitchCompat have similar replay with the real UI.

Main Changes

Motivation

What inspired you to submit this pull request?

Session replay demo

https://mobile-integration.datadoghq.com/rum/replay/sessions/128703cf-1202-45c6-a34a-8a8a2df7275d?applicationId=38030dde-f9f9-4e52-9443-b9804a030080&seed=bd9e3c7b-fbbf-4a75-89b7-a323624f0cd2&ts=1719931750249

New implementation overhead

Since the new implementation of SwitchCompatMapper create ImageWireframe other than ShapeWireframe, some overhead is in the expectation, to measure this, Method called metric is used to measure the total duration of creating a wire frame of each map method, here is the result

old implementation (Shape wireframe) new implementation (Image wireframe)
image image

As we can see the new implementation takes 180us on average, and old implementation takes 120~140us on average, the overhead is nearly 50% percent.

Review checklist (to be filled by reviewers)

codecov-commenter commented 6 days ago

Codecov Report

Attention: Patch coverage is 89.74359% with 8 lines in your changes missing coverage. Please review.

Project coverage is 69.48%. Comparing base (8491d83) to head (a06a585).

Additional details and impacted files ```diff @@ Coverage Diff @@ ## feature/session-replay/compound-button-mappers #2117 +/- ## ================================================================================== + Coverage 69.33% 69.48% +0.15% ================================================================================== Files 715 715 Lines 26620 26602 -18 Branches 4464 4471 +7 ================================================================================== + Hits 18455 18482 +27 + Misses 6942 6879 -63 - Partials 1223 1241 +18 ``` | [Files](https://app.codecov.io/gh/DataDog/dd-sdk-android/pull/2117?dropdown=coverage&src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=DataDog) | Coverage Δ | | |---|---|---| | [...nternal/recorder/mapper/CheckableTextViewMapper.kt](https://app.codecov.io/gh/DataDog/dd-sdk-android/pull/2117?src=pr&el=tree&filepath=features%2Fdd-sdk-android-session-replay%2Fsrc%2Fmain%2Fkotlin%2Fcom%2Fdatadog%2Fandroid%2Fsessionreplay%2Finternal%2Frecorder%2Fmapper%2FCheckableTextViewMapper.kt&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=DataDog#diff-ZmVhdHVyZXMvZGQtc2RrLWFuZHJvaWQtc2Vzc2lvbi1yZXBsYXkvc3JjL21haW4va290bGluL2NvbS9kYXRhZG9nL2FuZHJvaWQvc2Vzc2lvbnJlcGxheS9pbnRlcm5hbC9yZWNvcmRlci9tYXBwZXIvQ2hlY2thYmxlVGV4dFZpZXdNYXBwZXIua3Q=) | `59.26% <ø> (ø)` | | | [...ternal/recorder/mapper/CheckableWireframeMapper.kt](https://app.codecov.io/gh/DataDog/dd-sdk-android/pull/2117?src=pr&el=tree&filepath=features%2Fdd-sdk-android-session-replay%2Fsrc%2Fmain%2Fkotlin%2Fcom%2Fdatadog%2Fandroid%2Fsessionreplay%2Finternal%2Frecorder%2Fmapper%2FCheckableWireframeMapper.kt&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=DataDog#diff-ZmVhdHVyZXMvZGQtc2RrLWFuZHJvaWQtc2Vzc2lvbi1yZXBsYXkvc3JjL21haW4va290bGluL2NvbS9kYXRhZG9nL2FuZHJvaWQvc2Vzc2lvbnJlcGxheS9pbnRlcm5hbC9yZWNvcmRlci9tYXBwZXIvQ2hlY2thYmxlV2lyZWZyYW1lTWFwcGVyLmt0) | `100.00% <ø> (ø)` | | | [...lay/internal/recorder/mapper/SwitchCompatMapper.kt](https://app.codecov.io/gh/DataDog/dd-sdk-android/pull/2117?src=pr&el=tree&filepath=features%2Fdd-sdk-android-session-replay%2Fsrc%2Fmain%2Fkotlin%2Fcom%2Fdatadog%2Fandroid%2Fsessionreplay%2Finternal%2Frecorder%2Fmapper%2FSwitchCompatMapper.kt&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=DataDog#diff-ZmVhdHVyZXMvZGQtc2RrLWFuZHJvaWQtc2Vzc2lvbi1yZXBsYXkvc3JjL21haW4va290bGluL2NvbS9kYXRhZG9nL2FuZHJvaWQvc2Vzc2lvbnJlcGxheS9pbnRlcm5hbC9yZWNvcmRlci9tYXBwZXIvU3dpdGNoQ29tcGF0TWFwcGVyLmt0) | `92.31% <89.74%> (+33.39%)` | :arrow_up: | ... and [29 files with indirect coverage changes](https://app.codecov.io/gh/DataDog/dd-sdk-android/pull/2117/indirect-changes?src=pr&el=tree-more&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=DataDog)