-
Notifications
You must be signed in to change notification settings - Fork 63
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
RUMM-2775 Add Session Replay Uploader #1063
RUMM-2775 Add Session Replay Uploader #1063
Conversation
dd-sdk-android/src/main/kotlin/com/datadog/android/core/internal/net/DataOkHttpUploaderV2.kt
Outdated
Show resolved
Hide resolved
return if (body == null || originalRequest.header(HEADER_ENCODING) != null) { | ||
return if (body == null || | ||
originalRequest.header(HEADER_ENCODING) != null || | ||
body is MultipartBody |
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.
we skip Gzip compression, because body is already Gzipped in this case? shouldn't we then add a header (encoding?) saying that it is gzipped? because generally speaking MultipartBody
(not from SR) can be in plain as well.
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.
yeah I was actually thinking to this but then I will have to change a bit more this logic to go through all the multipart bodies. Let me see if I can do something about it.
...rc/main/kotlin/com/datadog/android/sessionreplay/internal/net/SessionReplayOkHttpUploader.kt
Outdated
Show resolved
Hide resolved
internal class BatchesToSegmentsMapper { | ||
|
||
fun map(batchData: List<ByteArray>): List<Pair<MobileSegment, JsonObject>> { | ||
return groupBatchDataIntoSegments(batchData) |
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.
minor: probably can just inline groupBatchDataIntoSegments
here. This method does nothing else than calling another method.
...rc/test/kotlin/com/datadog/android/sessionreplay/utils/forge/EnrichedRecordForgeryFactory.kt
Outdated
Show resolved
Hide resolved
BytesCompressor.CHECKSUM_FLAG_SIZE_IN_BYTES | ||
) | ||
) | ||
decompressor.finished() |
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.
why do we need this call? per documentation it seems it doesn't modify anything, just returns the state.
...src/test/kotlin/com/datadog/android/sessionreplay/internal/net/BatchesToSegmentMapperTest.kt
Outdated
Show resolved
Hide resolved
...src/test/kotlin/com/datadog/android/sessionreplay/internal/net/BatchesToSegmentMapperTest.kt
Outdated
Show resolved
Hide resolved
...src/test/kotlin/com/datadog/android/sessionreplay/internal/net/BatchesToSegmentMapperTest.kt
Outdated
Show resolved
Hide resolved
Codecov Report
@@ Coverage Diff @@
## feature/session-replay-vo #1063 +/- ##
=============================================================
- Coverage 83.36% 82.35% -1.01%
=============================================================
Files 343 346 +3
Lines 10791 11042 +251
Branches 1792 1814 +22
=============================================================
+ Hits 8995 9093 +98
- Misses 1239 1385 +146
- Partials 557 564 +7
|
7b3ed5b
to
294ab95
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.
I've added some new comments (plus there are some comments from the previous round), but overall seems good! Just few final edits are needed.
dd-sdk-android/src/main/kotlin/com/datadog/android/core/internal/net/DataOkHttpUploaderV2.kt
Outdated
Show resolved
Hide resolved
...rc/main/kotlin/com/datadog/android/sessionreplay/internal/net/SessionReplayOkHttpUploader.kt
Outdated
Show resolved
Hide resolved
/** Maps a batch to a List<Pair<MobileSegment, SerializedMobileSegment>> for uploading. | ||
* This class is meant for internal usage. | ||
*/ |
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.
A bit of formatting
/** Maps a batch to a List<Pair<MobileSegment, SerializedMobileSegment>> for uploading. | |
* This class is meant for internal usage. | |
*/ | |
/** | |
* Maps a batch to a List<Pair<MobileSegment, SerializedMobileSegment>> for uploading. | |
* This class is meant for internal usage. | |
*/ |
/** Compresses the payload data using the ZIP compression algorithm. | ||
* This class is meant for internal usage. | ||
*/ |
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.
/** Compresses the payload data using the ZIP compression algorithm. | |
* This class is meant for internal usage. | |
*/ | |
/** | |
* Compresses the payload data using the ZIP compression algorithm. | |
* This class is meant for internal usage. | |
*/ |
...roid-session-replay/src/main/kotlin/com/datadog/android/sessionreplay/net/BytesCompressor.kt
Show resolved
Hide resolved
294ab95
to
477ff88
Compare
477ff88
to
e0418fe
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!
What does this PR do?
In this PR we are adding the logic for reading the Session Replay batches, group them into Segments by RUM context and send them as separated payloads.
Note for reviewers: We are using an intermediary hack for now to use the new SDK V2
RequestFactory
->SessionReplayOkHttpUploader
. This class and the logic inside will be eventually migrated in theSessionReplayRequestFactory
once thebatch to multiple requests
feature will be available in SDK v2.Motivation
What inspired you to submit this pull request?
Additional Notes
Anything else we should know when reviewing?
Review checklist (to be filled by reviewers)