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

RUM-1654 Add resourceId to ImageWireframe #1690

Merged
merged 2 commits into from
Dec 6, 2023

Conversation

jonathanmos
Copy link
Member

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)

  • Feature or bugfix MUST have appropriate tests (unit, integration, e2e)
  • Make sure you discussed the feature or bugfix with the maintaining team in an Issue
  • Make sure each commit and the PR mention the Issue number (cf the CONTRIBUTING doc)

@jonathanmos jonathanmos force-pushed the jmoskovich/rum-1654/base64-diffing branch from b4016ad to 6e3e917 Compare November 8, 2023 15:07
@jonathanmos jonathanmos force-pushed the jmoskovich/rum-1654/base64-diffing branch from 6e3e917 to f570425 Compare November 9, 2023 12:17
@jonathanmos jonathanmos force-pushed the jmoskovich/rum-1654/base64-diffing branch from f570425 to c4f1807 Compare November 12, 2023 09:24
@codecov-commenter
Copy link

codecov-commenter commented Nov 12, 2023

Codecov Report

Merging #1690 (b76e2f4) into develop (99ddc9a) will decrease coverage by 0.08%.
Report is 9 commits behind head on develop.
The diff coverage is 75.51%.

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     
Files Coverage Δ
...ssionreplay/internal/processor/MutationResolver.kt 89.27% <100.00%> (ø)
...roid/sessionreplay/internal/utils/DrawableUtils.kt 98.44% <100.00%> (-0.02%) ⬇️
...eplay/internal/recorder/base64/Base64Serializer.kt 96.64% <92.59%> (+7.01%) ⬆️
...eplay/internal/recorder/base64/MD5HashGenerator.kt 53.33% <53.33%> (ø)
...nreplay/internal/recorder/base64/Base64LRUCache.kt 62.71% <48.00%> (-12.90%) ⬇️

... and 22 files with indirect coverage changes

@jonathanmos jonathanmos marked this pull request as ready for review November 13, 2023 08:57
@jonathanmos jonathanmos requested a review from a team as a code owner November 13, 2023 08:57
wireframe: MobileSegment.Wireframe.ImageWireframe,
base64SerializerCallback: Base64SerializerCallback?
) {
if (hash.isNotEmpty()) {
wireframe.resourceId = hash
Copy link
Member

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?

Copy link
Member Author

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)

Copy link
Member

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.

Copy link
Member Author

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

@jonathanmos jonathanmos force-pushed the jmoskovich/rum-1654/base64-diffing branch from c4f1807 to 7bc7710 Compare November 21, 2023 12:49
@jonathanmos jonathanmos requested a review from a team as a code owner November 21, 2023 12:49
@jonathanmos jonathanmos force-pushed the jmoskovich/rum-1654/base64-diffing branch 6 times, most recently from e8da3bb to 3031a68 Compare December 3, 2023 11:46
@jonathanmos jonathanmos requested review from 0xnm and mariusc83 December 4, 2023 10:04
Copy link
Member

@0xnm 0xnm left a 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.

)
val resourceId = md5HashGenerator.generate(byteArray)
val hashes = Pair(base64String, resourceId)
Copy link
Member

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.

@jonathanmos jonathanmos requested a review from 0xnm December 5, 2023 12:22
@jonathanmos jonathanmos requested a review from 0xnm December 5, 2023 15:25
@jonathanmos jonathanmos force-pushed the jmoskovich/rum-1654/base64-diffing branch from 2ed95ce to b76e2f4 Compare December 5, 2023 15:56
@jonathanmos jonathanmos merged commit f38f6be into develop Dec 6, 2023
@jonathanmos jonathanmos deleted the jmoskovich/rum-1654/base64-diffing branch December 6, 2023 09:18
@xgouchet xgouchet added this to the 2.4.0 milestone Dec 13, 2023
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.

6 participants