Skip to content

Conversation

@agrognetti
Copy link
Contributor

@agrognetti agrognetti commented Jan 8, 2026

Summary

Replaces OpenTelemetry log-based session replay export with a new event queue and batch worker system. Introduces transport layer abstractions (EventQueue, BatchWorker, EventExporting, etc.) and payload types for images, interactions, and identify events. Updates ReplayInstrumentation and SessionReplayExporter to use the new transport, improving batching, error handling, and extensibility. Updates tests to use the new event queue item types.

How did you test this change?

Unit tests


Note

Re-architects session replay transport for reliability and extensibility.

  • Introduces transport layer: EventQueue, BatchWorker (interval-driven, flush, backoff/jitter, concurrency limits), FlushableWorker, and EventExporting API
  • Adds payload types ImageItemPayload, InteractionItemPayload, and updates IdentifyItemPayload to implement EventQueueItemPayload with cost/timestamp/exporter metadata
  • Refactors SessionReplayExporter to EventExporting with export(List<EventQueueItem>), internal RRWeb event generation moved off OTel logs; groups by session, initializes sessions, and pushes payloads; extracts capture handling into handleCapture
  • Updates ReplayInstrumentation to enqueue events and drive BatchWorker (start/stop/flush on lifecycle), logs downgraded to debug
  • E2E sample app enables traces/metrics and activityLifecycle
  • Adds/updates unit tests for exporter and new transport components (EventQueue, BatchWorker, FlushableWorker)

Written by Cursor Bugbot for commit 22b1b0a. This will update automatically on new commits. Configure here.

Replaces OpenTelemetry log-based session replay export with a new event queue and batch worker system. Introduces transport layer abstractions (EventQueue, BatchWorker, EventExporting, etc.) and payload types for images, interactions, and identify events. Updates ReplayInstrumentation and SessionReplayExporter to use the new transport, improving batching, error handling, and extensibility. Updates tests to use the new event queue item types.
Added synchronized blocks to start, stop, and flush methods in BatchWorker and FlushableWorker to ensure thread safety.
Replaced System.currentTimeMillis() with SystemClock.elapsedRealtime() for more accurate timing.
Improved error handling in BatchWorker by catching Throwable instead of Exception, and refactored internal state snapshot naming for clarity.
Introduces comprehensive tests for the FlushableWorker class
- Add tests for BatchWorker and EventQueue
- Refactor send() function in EventQueue to avoid acquiring
the lock multiple times when it is called from send(payloads) and rename to sendLocked()
- Rename EventQueue constructor params replacing "size" word by "cost"
- Add docs to earliest and removeFirst functions
@agrognetti agrognetti marked this pull request as ready for review January 13, 2026 22:47
@agrognetti agrognetti requested a review from a team as a code owner January 13, 2026 22:47
Avoids dropping the first item when the queue is empty, matching the total cost check and reducing silent data loss.
@agrognetti agrognetti merged commit 6e072db into main Jan 14, 2026
24 checks passed
@agrognetti agrognetti deleted the agrognetti/O11Y-904 branch January 14, 2026 22:08
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants