RUM-10064: Read RUM context in Session Replay in non-blocking manner#2666
Merged
Conversation
0xnm
force-pushed
the
nogorodnikov/rum-10064/read-rum-context-in-non-blocking-manner-in-session-replay
branch
from
May 21, 2025 12:58
aa32f36 to
3eadf7d
Compare
0xnm
marked this pull request as ready for review
May 21, 2025 13:16
Codecov Report❌ Patch coverage is Additional details and impacted files@@ Coverage Diff @@
## nogorodnikov/rum-8170/feature-context-sync #2666 +/- ##
==============================================================================
+ Coverage 70.08% 70.09% +0.02%
==============================================================================
Files 820 819 -1
Lines 30630 30620 -10
Branches 5118 5119 +1
==============================================================================
- Hits 21464 21462 -2
+ Misses 7754 7731 -23
- Partials 1412 1427 +15
🚀 New features to boost your workflow:
|
0xnm
deleted the
nogorodnikov/rum-10064/read-rum-context-in-non-blocking-manner-in-session-replay
branch
May 22, 2025 14:07
mariusc83
reviewed
Jun 11, 2025
|
|
||
| override fun onStop() { | ||
| stopRecording() | ||
| sdkCore.removeContextUpdateReceiver(Feature.RUM_FEATURE_NAME, rumContextProvider) |
Member
There was a problem hiding this comment.
isn't there a mistake here ? I think you are not using the same key right to register and remove ?
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What does this PR do?
The main goal of this PR is to move away from the
getFeatureContext()calls in Session Replay to read RUM context, because it will become a blocking call and we cannot allow ourselves waiting in case if this call happens on the main thread.This is achieved by listening to the RUM context updates instead and this is the same way iOS Session Replay it taking RUM context (link).
It can be a bit of the miss when associating Session Replay wireframes to the RUM views due to the following:
However, it is not a problem, because a miss will be very small and is not visible in the Session Replay player when switching between RUM views on the timeline.
Moreover, even with the current approach (by using
getFeatureContext()) such mismatch is possible due to the concurrent nature of the event processing.In general, this cannot be solved, because Session Replay and RUM tracking strategies are using different callbacks to report the data, so it cannot be aligned perfectly.
Also this PR does a minor change to the context update subscription mechanism: if there is a context available for the feature, it will be immediately emitted to the listener upon subscription.
Review checklist (to be filled by reviewers)