Skip to content

RUM-2708: Enable Resource Endpoint by default#1858

Merged
jonathanmos merged 7 commits into
developfrom
jmoskovich/rum-2708/enable-resource-endpoint
Mar 5, 2024
Merged

RUM-2708: Enable Resource Endpoint by default#1858
jonathanmos merged 7 commits into
developfrom
jmoskovich/rum-2708/enable-resource-endpoint

Conversation

@jonathanmos

@jonathanmos jonathanmos commented Feb 18, 2024

Copy link
Copy Markdown
Member

What does this PR do?

• Renames base64 packages to resources
• Renames resource classes
• Removes base64 from the lrucache
• Remove base64 from places where we populated it (now it will be null)
• Removes the Resource Endpoint feature flag.

NOTE: This is Part 1 of this pr. Part 2 will have everything related to the refactor/splitting of classes

Motivation

Final PR for the Resource Endpoint

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)

@codecov-commenter

codecov-commenter commented Feb 18, 2024

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 96.77419% with 2 lines in your changes missing coverage. Please review.
✅ Project coverage is 83.37%. Comparing base (1e65536) to head (42de51d).
⚠️ Report is 1765 commits behind head on develop.

Files with missing lines Patch % Lines
...y/internal/recorder/resources/ResourcesLRUCache.kt 85.71% 1 Missing ⚠️
...internal/recorder/resources/ResourcesSerializer.kt 97.30% 1 Missing ⚠️
Additional details and impacted files
@@             Coverage Diff             @@
##           develop    #1858      +/-   ##
===========================================
+ Coverage    83.32%   83.37%   +0.05%     
===========================================
  Files          479      477       -2     
  Lines        16928    16875      -53     
  Branches      2527     2511      -16     
===========================================
- Hits         14104    14069      -35     
+ Misses        2135     2121      -14     
+ Partials       689      685       -4     
Files with missing lines Coverage Δ
...adog/android/sessionreplay/SessionReplayPrivacy.kt 100.00% <100.00%> (ø)
...android/sessionreplay/internal/ResourcesFeature.kt 88.89% <ø> (ø)
...oid/sessionreplay/internal/SessionReplayFeature.kt 99.09% <100.00%> (+4.50%) ⬆️
...nreplay/internal/net/ResourceRequestBodyFactory.kt 63.46% <100.00%> (ø)
...ssionreplay/internal/recorder/ViewUtilsInternal.kt 100.00% <ø> (ø)
...order/mapper/BaseAsyncBackgroundWireframeMapper.kt 95.24% <ø> (ø)
...replay/internal/recorder/mapper/ImageViewMapper.kt 94.59% <ø> (ø)
...nternal/recorder/mapper/MaskInputTextViewMapper.kt 80.00% <ø> (ø)
...lay/internal/recorder/mapper/MaskTextViewMapper.kt 100.00% <ø> (ø)
...nreplay/internal/recorder/mapper/TextViewMapper.kt 93.33% <ø> (ø)
... and 10 more

... and 25 files with indirect coverage changes

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@jonathanmos
jonathanmos force-pushed the jmoskovich/rum-2708/enable-resource-endpoint branch 2 times, most recently from 4d660bf to ea5f4a5 Compare February 21, 2024 11:48
@jonathanmos
jonathanmos marked this pull request as ready for review February 21, 2024 11:49
@jonathanmos
jonathanmos requested review from a team as code owners February 21, 2024 11:49

@0xnm 0xnm left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

great work!

}

internal data class CacheData(val base64Encoding: ByteArray, var resourceId: ByteArray?) {
internal data class CacheData(val resourceId: ByteArray) {

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

do we need a class with only single property? seems like we can get rid of it.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

Good point. Removing the base64 indeed removes our need for this container class

@jonathanmos
jonathanmos force-pushed the jmoskovich/rum-2709/record-resources branch from ef39f54 to 7dcc78c Compare February 21, 2024 12:29
@jonathanmos
jonathanmos force-pushed the jmoskovich/rum-2708/enable-resource-endpoint branch from ea5f4a5 to 7c2cf69 Compare February 21, 2024 12:33
@jonathanmos
jonathanmos force-pushed the jmoskovich/rum-2709/record-resources branch from 7dcc78c to 79cacc9 Compare February 21, 2024 13:42
Base automatically changed from jmoskovich/rum-2709/record-resources to develop February 21, 2024 14:43

@Suppress("ReturnCount")
@WorkerThread
private fun serializeBitmap(

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

why is this called serializeBitmap ?

@jonathanmos jonathanmos Feb 25, 2024

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

This is renamed in the next PR to resolveResourceHash in the context of the refactor

return
}

if (!resourceIdsSeen.contains(resourceId)) {

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

shouldn't we do the check before ? Are we computing the byteArray for this resource for nothing if the resource was already seen ?

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

We're calculating the md5 hash from the bytearray, so I'm not sure we can move this earlier in the flow


@Suppress("TooManyFunctions")
internal class Base64Serializer private constructor(
internal class ResourcesSerializer private constructor(

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

I think this class should not be called a serializer ? I think the scope change into something different. For me this class has too many responsibilities now and it is so hard to track the logic inside. We are using it to check if the resource already exists in cache was already solved before and also in the same time to update the queue and mark the wireframe as resolved. These are 2 different responsibilities and should be extracted in separated components. Also there is nothing that suggests that this is a serializer for me here.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

I do not mind if we do this in another PR but I really think we need to do it now and simplify this logic a bit more.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

It's renamed in the next pr to ResourceResolver and some responsibilities are extracted out

@jonathanmos
jonathanmos force-pushed the jmoskovich/rum-2708/enable-resource-endpoint branch from 7c2cf69 to c162aea Compare February 22, 2024 08:59
@jonathanmos
jonathanmos force-pushed the jmoskovich/rum-2708/enable-resource-endpoint branch from c162aea to 7725929 Compare February 22, 2024 09:07
@jonathanmos
jonathanmos force-pushed the jmoskovich/rum-2708/enable-resource-endpoint branch from 7725929 to 098ea45 Compare February 22, 2024 09:22
@jonathanmos
jonathanmos requested a review from 0xnm March 4, 2024 14:02
@jonathanmos
jonathanmos merged commit 30135fa into develop Mar 5, 2024
@jonathanmos
jonathanmos deleted the jmoskovich/rum-2708/enable-resource-endpoint branch March 5, 2024 11:26
@xgouchet xgouchet added this to the 2.7.0 milestone Apr 5, 2024
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.

5 participants