Skip to content

feat(session-replay): embed sessionId at creation time in push event payloads#189

Merged
abelonogov-ld merged 9 commits into
mainfrom
feature/o11y-964
May 27, 2026
Merged

feat(session-replay): embed sessionId at creation time in push event payloads#189
abelonogov-ld merged 9 commits into
mainfrom
feature/o11y-964

Conversation

@mario-launchdarkly
Copy link
Copy Markdown
Contributor

@mario-launchdarkly mario-launchdarkly commented Apr 16, 2026

Attach sessionId to IdentifyItemPayload, ImageItemPayload, TouchInteraction, and PressInteraction at object creation time rather than at export time.

Injects a @sendable () -> String sessionIdProvider closure through InputCaptureCoordinator and CaptureManager so each interaction and frame captures the live session ID the moment it is created, correctly tracking session rotations that occur while capture is running continuously.


Note

Medium Risk
Changes how session replay batches attribute events across session boundaries; incorrect wiring could mis-route payloads, but scope is observability/replay data paths rather than auth or secrets.

Overview
Session replay and UI interaction events now carry sessionId when each payload is created, instead of relying on the exporter’s current session at push time.

SessionManaging exposes a sessionIdProvider closure; InputCaptureCoordinator and CaptureManager call it when touches, presses, and frames are captured (main thread for UI). TouchInteraction, PressInteraction, IdentifyItemPayload, and ImageItemPayload all store that id and pass it through interpreters and the event queue. UserInteractionManager and SessionReplayService wire the provider from sessionManager.

This keeps replay events aligned with the session that was active when the user acted or the frame was taken, including background timeout session resets while capture keeps running.

Reviewed by Cursor Bugbot for commit ba192eb. Bugbot is set up for automated code reviews on this repo. Configure here.

…payloads

Attach sessionId to IdentifyItemPayload, ImageItemPayload, TouchInteraction,
and PressInteraction at object creation time rather than at export time.

Injects a @sendable () -> String sessionIdProvider closure through
InputCaptureCoordinator and CaptureManager so each interaction and frame
captures the live session ID the moment it is created, correctly tracking
session rotations that occur while capture is running continuously.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Comment thread Sources/LaunchDarklyObservability/UIInteractions/InputCaptureCoordinator.swift Outdated
Comment thread Sources/LaunchDarklyObservability/UIInteractions/InputCaptureCoordinator.swift Outdated
Comment thread Sources/LaunchDarklySessionReplay/BenchMark/CompressionBenchmarkRunner.swift Outdated
Comment thread Sources/LaunchDarklyObservability/UIInteractions/InputCaptureCoordinator.swift Outdated
Updated TouchSample to include a sessionId parameter at initialization, ensuring that the session ID is captured at the time of touch event creation. Adjusted TouchInterpreter to utilize the sessionId from TouchSample, streamlining the processing of touch interactions.
… for efficiency

Moved the sessionId retrieval outside of the touch event loop in InputCaptureCoordinator to enhance performance and maintainability. This change ensures that the sessionId is captured once per event rather than multiple times during iteration.
…ouch events

Moved the sessionId retrieval outside of the touch event loop in InputCaptureCoordinator to improve efficiency. This change ensures that the sessionId is captured once per event, enhancing performance and maintainability.
Copy link
Copy Markdown

@cursor cursor Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Cursor Bugbot has reviewed your changes and found 1 potential issue.

Fix All in Cursor

❌ Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, have a team admin enable autofix in the Cursor dashboard.

Reviewed by Cursor Bugbot for commit 0d23f7a. Configure here.

@abelonogov-ld abelonogov-ld enabled auto-merge (squash) May 27, 2026 02:31
@abelonogov-ld abelonogov-ld merged commit cafefbf into main May 27, 2026
6 checks passed
@abelonogov-ld abelonogov-ld deleted the feature/o11y-964 branch May 27, 2026 02:36
abelonogov-ld pushed a commit that referenced this pull request May 28, 2026
🤖 I have created a release *beep* *boop*
---


##
[0.36.0](0.35.0...0.36.0)
(2026-05-28)


### Features

* session replay control with sampling and state management
([#200](#200))
([0fc7e85](0fc7e85))
* **session-replay:** embed sessionId at creation time in push event
payloads
([#189](#189))
([cafefbf](cafefbf))

---
This PR was generated with [Release
Please](https://github.com/googleapis/release-please). See
[documentation](https://github.com/googleapis/release-please#release-please).

<!-- CURSOR_SUMMARY -->
---

> [!NOTE]
> **Low Risk**
> Mechanical version and changelog updates with no runtime code changes
in this PR.
> 
> **Overview**
> Bumps the monorepo release from **0.35.0** to **0.36.0** across
Release Please (`release-please-manifest.json`), **CHANGELOG** (new
`0.36.0` section), CocoaPods specs (`LaunchDarklyObservability`,
`LaunchDarklySessionReplay`), and `sdkVersion` in `Version.swift`.
> 
> The changelog entries for this release (not modified in this diff
beyond being added) document **session replay control** (sampling and
state management) and **sessionId embedded at push event creation** for
session replay payloads.
> 
> <sup>Reviewed by [Cursor Bugbot](https://cursor.com/bugbot) for commit
fd5aad6. Bugbot is set up for automated
code reviews on this repo. Configure
[here](https://www.cursor.com/dashboard/bugbot).</sup>
<!-- /CURSOR_SUMMARY -->
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.

2 participants