DataDog / dd-sdk-android

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

RUM-3458: Fix time drift in RecordedDataQueueHandler #2075

Closed jonathanmos closed 2 weeks ago

jonathanmos commented 1 month ago

What does this PR do?

Fixes an issue in the RecordedDataQueueHandler where the "current" time was being passed in to the loop, but never updated inside it. This could lead to the time drifting when the queue was very long, leading to items being considered out of date.

Motivation

We have telemetry indicating numerous DataQueueItems are being dropped for being out of date.

Additional Notes

Anything else we should know when reviewing?

Review checklist (to be filled by reviewers)

codecov-commenter commented 1 month ago

Codecov Report

All modified and coverable lines are covered by tests :white_check_mark:

Project coverage is 83.16%. Comparing base (ee23810) to head (5e3f8b3). Report is 42 commits behind head on develop.

Additional details and impacted files ```diff @@ Coverage Diff @@ ## develop #2075 +/- ## ============================================ + Coverage 67.39% 83.16% +15.77% ============================================ Files 733 495 -238 Lines 27028 17752 -9276 Branches 4574 2684 -1890 ============================================ - Hits 18213 14762 -3451 + Misses 7587 2250 -5337 + Partials 1228 740 -488 ``` | [Files](https://app.codecov.io/gh/DataDog/dd-sdk-android/pull/2075?dropdown=coverage&src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=DataDog) | Coverage Δ | | |---|---|---| | [...nreplay/internal/async/RecordedDataQueueHandler.kt](https://app.codecov.io/gh/DataDog/dd-sdk-android/pull/2075?src=pr&el=tree&filepath=features%2Fdd-sdk-android-session-replay%2Fsrc%2Fmain%2Fkotlin%2Fcom%2Fdatadog%2Fandroid%2Fsessionreplay%2Finternal%2Fasync%2FRecordedDataQueueHandler.kt&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=DataDog#diff-ZmVhdHVyZXMvZGQtc2RrLWFuZHJvaWQtc2Vzc2lvbi1yZXBsYXkvc3JjL21haW4va290bGluL2NvbS9kYXRhZG9nL2FuZHJvaWQvc2Vzc2lvbnJlcGxheS9pbnRlcm5hbC9hc3luYy9SZWNvcmRlZERhdGFRdWV1ZUhhbmRsZXIua3Q=) | `97.50% <100.00%> (-0.63%)` | :arrow_down: | | [...sionreplay/internal/async/RecordedDataQueueItem.kt](https://app.codecov.io/gh/DataDog/dd-sdk-android/pull/2075?src=pr&el=tree&filepath=features%2Fdd-sdk-android-session-replay%2Fsrc%2Fmain%2Fkotlin%2Fcom%2Fdatadog%2Fandroid%2Fsessionreplay%2Finternal%2Fasync%2FRecordedDataQueueItem.kt&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=DataDog#diff-ZmVhdHVyZXMvZGQtc2RrLWFuZHJvaWQtc2Vzc2lvbi1yZXBsYXkvc3JjL21haW4va290bGluL2NvbS9kYXRhZG9nL2FuZHJvaWQvc2Vzc2lvbnJlcGxheS9pbnRlcm5hbC9hc3luYy9SZWNvcmRlZERhdGFRdWV1ZUl0ZW0ua3Q=) | `100.00% <100.00%> (ø)` | | | [...nreplay/internal/recorder/SessionReplayRecorder.kt](https://app.codecov.io/gh/DataDog/dd-sdk-android/pull/2075?src=pr&el=tree&filepath=features%2Fdd-sdk-android-session-replay%2Fsrc%2Fmain%2Fkotlin%2Fcom%2Fdatadog%2Fandroid%2Fsessionreplay%2Finternal%2Frecorder%2FSessionReplayRecorder.kt&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=DataDog#diff-ZmVhdHVyZXMvZGQtc2RrLWFuZHJvaWQtc2Vzc2lvbi1yZXBsYXkvc3JjL21haW4va290bGluL2NvbS9kYXRhZG9nL2FuZHJvaWQvc2Vzc2lvbnJlcGxheS9pbnRlcm5hbC9yZWNvcmRlci9TZXNzaW9uUmVwbGF5UmVjb3JkZXIua3Q=) | `96.80% <100.00%> (+0.19%)` | :arrow_up: | ... and [288 files with indirect coverage changes](https://app.codecov.io/gh/DataDog/dd-sdk-android/pull/2075/indirect-changes?src=pr&el=tree-more&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=DataDog)