Overview#
Flashduty RUM's session replay functionality is integrated into the RUM SDK. By simply configuring sampling rates and privacy rules, you can quickly enable replay functionality.Enable Collection#
Automatic Collection#
The replay SDK is already integrated into the RUM SDK. Configure the sampling rate to enable replay functionality.Sampling Method: When the client SDK initializes a session, it generates a random number between 0-1 and compares it with rate/100
. If it falls within the range, that session will be collected as a sample, and replay data will be collected and reported within the session cycle.Based on sampled session, the session will be
Based on the session being sampled, the session replay sampling rate (sessionReplaySampleRate
) will be applied for a second round of calculation and sampling.
By default, after configuring the sampling rate, automatic collection will be enabled after RUM.init()
is executed. If you want to manually control the collection timing (such as collecting data after user login), you can first enable the manual collection switch, then manually call the record method.After enabling collection, you can stop collection using the stopSessionReplayRecording()
method.Force Enable#
In certain scenarios, even if the sampling rate is not hit, you may still want to collect data for that session (such as monitoring newly launched features, or capturing subsequent operations after an exception), you can force enable replay by calling the startSessionReplayRecording({ force: true })
method.Note: Force enable will only take effect when the current session is sampled but sessionReplay is not sampled. If the session itself is not sampled, even forcing replay enable will be ineffective.
Disable Collection#
If you need to disable the collection functionality, adjust the corresponding replay sampling rate to 0 or simply remove the configuration item.How It Works#
The session replay SDK is implemented based on rrweb.During the recording phase, the recording SDK takes snapshots of the current DOM and CSS styles, and collects corresponding events when user behaviors occur (DOM changes, mouse movements, clicks, form inputs, etc.). Data is reported after serialization, compression, and removal of sensitive information.During the replay phase, the playback SDK reconstructs the DOM based on snapshots and converts event behaviors to DOM changes for display at appropriate times.Before data reporting, the SDK performs data compression in advance and executes this CPU-intensive operation in a web worker, which does not affect main thread rendering.The SDK compatibility is consistent with the RUM SDK, supporting browsers above IE11.Next Steps#