Commit 5e11cf7
authored
fix: Fix event sorting in session replay export (#392)
## Summary
Moved event sorting from SessionReplayExporter.export() to
SessionReplayApiService.pushPayload() to fix incorrect chronological
ordering of replay events.
Events were being sorted by timestamp too early in the export pipeline
inside SessionReplayExporter.export(), before they were processed and
grouped by session. At that stage, sorting by EventQueueItem.timestamp
could reorder items in a way that broke the processing logic (e.g., an
interaction event could be processed before the capture it relates to).
<!-- CURSOR_SUMMARY -->
---
> [!NOTE]
> **Medium Risk**
> Changes the ordering of session replay events sent to the backend and
makes `Event.timestamp` non-nullable, which could affect payload
serialization/compatibility and replay correctness if upstream producers
ever omit timestamps.
>
> **Overview**
> Fixes session replay chronological ordering by **moving event sorting
to the network boundary**: `SessionReplayApiService.pushPayload()` now
sorts `events` by `Event.timestamp`, and
`SessionReplayExporter.export()` no longer sorts `EventQueueItem`s
before transforming/grouping them by session.
>
> Tightens the replay protocol model by making
`ReplaySessionProtocol.Event.timestamp` **required** (non-null),
ensuring all exported replay events can be consistently ordered. Several
Android e2e tests for traces/error/span sampling/disablement are marked
`@Ignore`, reducing CI coverage for those scenarios.
>
> <sup>Written by [Cursor
Bugbot](https://cursor.com/dashboard?tab=bugbot) for commit
04b5f93. This will update automatically
on new commits. Configure
[here](https://cursor.com/dashboard?tab=bugbot).</sup>
<!-- /CURSOR_SUMMARY -->1 parent 0a6582c commit 5e11cf7
3 files changed
Lines changed: 3 additions & 4 deletions
File tree
- sdk/@launchdarkly/observability-android/lib/src/main/kotlin/com/launchdarkly/observability/replay
- exporter
Lines changed: 1 addition & 1 deletion
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
228 | 228 | | |
229 | 229 | | |
230 | 230 | | |
231 | | - | |
| 231 | + | |
232 | 232 | | |
233 | 233 | | |
234 | 234 | | |
| |||
Lines changed: 1 addition & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
110 | 110 | | |
111 | 111 | | |
112 | 112 | | |
| 113 | + | |
113 | 114 | | |
114 | 115 | | |
115 | 116 | | |
| |||
Lines changed: 1 addition & 3 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
79 | 79 | | |
80 | 80 | | |
81 | 81 | | |
82 | | - | |
83 | | - | |
84 | | - | |
| 82 | + | |
85 | 83 | | |
86 | 84 | | |
87 | 85 | | |
| |||
0 commit comments