-
Notifications
You must be signed in to change notification settings - Fork 64
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
RUM-1654 Add resourceId to ImageWireframe #1690
Conversation
...c/main/kotlin/com/datadog/android/sessionreplay/internal/recorder/base64/Base64Serializer.kt
Fixed
Show fixed
Hide fixed
b4016ad
to
6e3e917
Compare
.../kotlin/com/datadog/android/sessionreplay/internal/recorder/wrappers/MessageDigestWrapper.kt
Fixed
Show fixed
Hide fixed
...c/main/kotlin/com/datadog/android/sessionreplay/internal/recorder/base64/Base64Serializer.kt
Outdated
Show resolved
Hide resolved
6e3e917
to
f570425
Compare
...c/main/kotlin/com/datadog/android/sessionreplay/internal/recorder/base64/MD5HashGenerator.kt
Show resolved
Hide resolved
f570425
to
c4f1807
Compare
Codecov Report
Additional details and impacted files@@ Coverage Diff @@
## develop #1690 +/- ##
===========================================
- Coverage 83.32% 83.24% -0.08%
===========================================
Files 466 467 +1
Lines 16192 16238 +46
Branches 2413 2425 +12
===========================================
+ Hits 13491 13517 +26
- Misses 2043 2052 +9
- Partials 658 669 +11
|
...c/main/kotlin/com/datadog/android/sessionreplay/internal/recorder/base64/Base64Serializer.kt
Show resolved
Hide resolved
...c/main/kotlin/com/datadog/android/sessionreplay/internal/recorder/base64/Base64Serializer.kt
Outdated
Show resolved
Hide resolved
...c/main/kotlin/com/datadog/android/sessionreplay/internal/recorder/base64/MD5HashGenerator.kt
Outdated
Show resolved
Hide resolved
...c/main/kotlin/com/datadog/android/sessionreplay/internal/recorder/base64/Base64Serializer.kt
Outdated
Show resolved
Hide resolved
...c/main/kotlin/com/datadog/android/sessionreplay/internal/recorder/base64/Base64Serializer.kt
Outdated
Show resolved
Hide resolved
...c/main/kotlin/com/datadog/android/sessionreplay/internal/recorder/base64/Base64Serializer.kt
Outdated
Show resolved
Hide resolved
...c/main/kotlin/com/datadog/android/sessionreplay/internal/recorder/base64/Base64Serializer.kt
Show resolved
Hide resolved
wireframe: MobileSegment.Wireframe.ImageWireframe, | ||
base64SerializerCallback: Base64SerializerCallback? | ||
) { | ||
if (hash.isNotEmpty()) { | ||
wireframe.resourceId = hash |
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.
So what backend does if there is no resourceId
, but other payload like base64
, etc. is there. How resourceId
is used?
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.
at the moment backend is using base64, and eventually will map rssId as the key to pull the binary for use in the replays. In the future when the rss endpoint is done, there will have to be some logic there for ending support for b64 and moving over entirely to rssId (we'll start to send b64 as an empty field in the wireframes and only populate rssId)
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.
So what will be our logic then if we cannot generate resourceId
? We won't send a resource itself then? This 99.999% won't happen (all devices for sure can generate MD5 hash), but I'm just curious.
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.
If we can't generate the hash then I think we'll need to throw away the binary because backend won't be able to use it in a replay. We can check for this in the future by having the rssId inside the recordedDataQueueItem holding the binary and marking it as invalid if the field isn't populated, then the dataQueueHandler can purge the record
c4f1807
to
7bc7710
Compare
e8da3bb
to
3031a68
Compare
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.
lgtm! I left some comments, but they are not blocking.
...src/main/kotlin/com/datadog/android/sessionreplay/internal/recorder/base64/Base64LRUCache.kt
Outdated
Show resolved
Hide resolved
...src/main/kotlin/com/datadog/android/sessionreplay/internal/recorder/base64/Base64LRUCache.kt
Outdated
Show resolved
Hide resolved
) | ||
val resourceId = md5HashGenerator.generate(byteArray) | ||
val hashes = Pair(base64String, resourceId) |
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.
To be precise, base64 is not a hash, but encoding.
...c/main/kotlin/com/datadog/android/sessionreplay/internal/recorder/base64/Base64Serializer.kt
Outdated
Show resolved
Hide resolved
...c/main/kotlin/com/datadog/android/sessionreplay/internal/recorder/base64/Base64Serializer.kt
Outdated
Show resolved
Hide resolved
...test/kotlin/com/datadog/android/sessionreplay/internal/recorder/base64/Base64LRUCacheTest.kt
Outdated
Show resolved
Hide resolved
...test/kotlin/com/datadog/android/sessionreplay/internal/recorder/base64/Base64LRUCacheTest.kt
Outdated
Show resolved
Hide resolved
...test/kotlin/com/datadog/android/sessionreplay/internal/recorder/base64/Base64LRUCacheTest.kt
Outdated
Show resolved
Hide resolved
...st/kotlin/com/datadog/android/sessionreplay/internal/recorder/base64/Base64SerializerTest.kt
Outdated
Show resolved
Hide resolved
...c/main/kotlin/com/datadog/android/sessionreplay/internal/recorder/base64/Base64Serializer.kt
Outdated
Show resolved
Hide resolved
...c/main/kotlin/com/datadog/android/sessionreplay/internal/recorder/base64/Base64Serializer.kt
Outdated
Show resolved
Hide resolved
...st/kotlin/com/datadog/android/sessionreplay/internal/recorder/base64/Base64SerializerTest.kt
Outdated
Show resolved
Hide resolved
2ed95ce
to
b76e2f4
Compare
What does this PR do?
Adds the resourceId property to ImageWireframe, and additionally removes base64 from the MutationResolver diffing.
Motivation
Removing base64 from diffing improved performance on ios and in this PR we align on this change. Additionally, resourceId is a necessary prerequisite for the resource endpoint change.
What inspired you to submit this pull request?
Additional Notes
Anything else we should know when reviewing?
Review checklist (to be filled by reviewers)