feat: client-side sampleRate to Android session replay#660
Merged
Conversation
Mirror iOS SessionReplayOptions.sampleRate: ReplayOptions gains sampleRate, SessionReplaySampling gates capture per enable cycle, and SessionReplayService tracks isEnabled vs isRunning so sampled-out sessions do not record. Co-authored-by: Cursor <cursoragent@cursor.com>
Gate identifySession on isRunning so sampled-out sessions do not send replay identify payloads, matching tracks and collectors. Co-authored-by: Cursor <cursoragent@cursor.com>
4 tasks
Vadman97
approved these changes
Jun 30, 2026
Use paths-filter so turbo test runs only when files outside observability-android, mobile-dotnet, and android e2e workflows change. Co-authored-by: Cursor <cursoragent@cursor.com>
There was a problem hiding this comment.
Cursor Bugbot has reviewed your changes using default effort and found 1 potential issue.
Reviewed by Cursor Bugbot for commit 9e399f7. Configure here.
| // Sampled-out sessions are enabled but not recording; skip identify like tracks/collectors. | ||
| if (!_isRunning.value) { | ||
| return | ||
| } |
There was a problem hiding this comment.
Sampled-out replay drops identify
Medium Severity
When replay is enabled but excluded by sampleRate, identifySession returns immediately without caching the payload. That differs from the disabled path, which stores pending identify for the next start. After a later stop/start that wins sampling, recording can begin without the user context that was already identified.
Reviewed by Cursor Bugbot for commit 9e399f7. Configure here.
abelonogov-ld
pushed a commit
that referenced
this pull request
Jun 30, 2026
🤖 I have created a release *beep* *boop* --- <details><summary>launchdarkly-observability-android: 0.60.0</summary> ## [0.60.0](launchdarkly-observability-android-0.59.0...launchdarkly-observability-android-0.60.0) (2026-06-30) ### Features * client-side sampleRate to Android session replay ([#660](#660)) ([44b0e44](44b0e44)) </details> --- 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** > Version and changelog-only changes from Release Please; no new code in this diff. > > **Overview** > Release Please bumps **`launchdarkly-observability-android`** from **0.59.0** to **0.60.0** in `.release-please-manifest.json` and `gradle.properties`, and adds the matching **0.60.0** changelog entry. > > The release ships the already-merged feature from [#660](#660): **client-side `sampleRate`** on Android session replay (`ReplayOptions`), so apps can probabilistically start capture when replay is enabled (decision once per enable cycle; default remains full sampling). > > <sup>Reviewed by [Cursor Bugbot](https://cursor.com/bugbot) for commit 68d1f96. Bugbot is set up for automated code reviews on this repo. Configure [here](https://www.cursor.com/dashboard/bugbot).</sup> <!-- /CURSOR_SUMMARY -->
abelonogov-ld
added a commit
that referenced
this pull request
Jun 30, 2026
…act Native (#661) ## Summary - Expose `frameRate`, `scale`, `minimumAlpha`, and `sampleRate` on RN `SessionReplayOptions` and forward them through the iOS and Android native adapters. - Add client-side `sampleRate` to Android session replay (mirroring iOS), including sampling gating and skipping identify export when sampled out. - Add unit tests for JS passthrough, Android adapter mapping, and Android sampling logic. ## Dependency Merge and publish the Android library changes first ([#660](#660)). This branch includes the same `observability-android` updates inline; after #660 lands, rebase and bump `launchdarkly-observability-android` in the RN podspec/Gradle dependency if needed. ## Test plan - [x] `yarn test` in `react-native-ld-session-replay` - [x] `./gradlew :lib:testDebugUnitTest` in `observability-android` - [ ] Verify `createSessionReplayPlugin({ frameRate, scale, sampleRate })` on iOS and Android - [ ] Confirm sampled-out sessions (`sampleRate: 0`) do not record or export identify events Made with [Cursor](https://cursor.com) --------- Co-authored-by: Cursor <cursoragent@cursor.com>
abelonogov-ld
added a commit
that referenced
this pull request
Jun 30, 2026
* main: (39 commits) chore: release main (#666) feat: Propagate session replay frameRate, scale, and sampleRate in React Native (#661) ci: skip yarn test for .NET/Python/Ruby plugin-only changes (#664) chore: release main (#663) chore: Skip yarn test for Android and MAUI, Flutter PRs (#662) feat: client-side sampleRate to Android session replay (#660) chore: release main (#659) feat(observability-react-native): expose LDTracer with withSpan via getTracer() (#658) chore: release main (#657) feat(ruby): boot-time OTel auto-instrumentation; keep it working on Rails 7.0 (#643) feat: add GraphQL operation attributes to instrumented spans (#644) chore: release main (#656) feat(observability-react-native): accept plain nested dictionaries in track (#650) chore: release main (#655) fix: backendurl and otlpendpoind pass through (#648) feat(session-replay-react-native): support React Native legacy architecture (RN 0.75+) (#653) fix: MAUI - drop OTel activity instrumentation dependency (#651) chore: release main (#652) feat: supporting advanced trace cases (#645) chore: release main (#649) ... # Conflicts: # sdk/@launchdarkly/flutter/packages/observability/ios/launchdarkly_flutter_observability.podspec # sdk/@launchdarkly/flutter/packages/observability/ios/launchdarkly_flutter_observability/Package.swift
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.


Summary
sampleRatetoReplayOptions, mirroring iOSSessionReplayOptions.sampleRate(probability from 0.0–1.0 that replay starts when enabled).SessionReplaySampling/SessionReplaySamplingSessionto evaluate sampling once per enable cycle and reset on stop.SessionReplayServiceto separate user intent (isEnabled) from active recording (isRunning), gating collectors and capture on the latter.Test plan
./gradlew :lib:testDebugUnitTestinobservability-androidsampleRate = 0.0never recordssampleRate = 1.0records as beforeMade with Cursor