Repository navigation
Conversation
…sion.previous_id When a JS load starts a new session in place of a persisted one (the previous session timed out, or the app cold started), keep the replaced session's ID and report it as `session.previous_id` in the session attributes. They are spread onto the OTel Resource, so every span, log, error and metric of the new session carries it, and sessions can be chained across cold starts. Resumed sessions and first-ever launches omit it. Mirrors the browser SDK's `session.previous_id`. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Generated-by: termag
Contributor
Author
|
bugbot run |
There was a problem hiding this comment.
✅ Bugbot reviewed your changes and found no new issues!
Comment @cursor review or bugbot run to trigger another review on this PR
Reviewed by Cursor Bugbot for commit 7c3a515. Configure here.
Vadman97
marked this pull request as ready for review
October 30, 2026 06:07
Vadman97
enabled auto-merge (squash)
October 30, 2026 06:07
Vadman97
disabled auto-merge
October 30, 2026 16:48
This branch has not been deployed
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.
Demo (test transcript):
team-o11y:artifacts/sf8t4/test-output.txtOn React Native, every cold start (and every load after the 15-minute inactivity timeout) begins a new session, so a user journey that crosses a relaunch, such as tapping an email link, is split. With this change, when a JS load starts a new session in place of a persisted one,
SessionManagerkeeps the replaced session's ID and addssession.previous_idto the session attributes. Those are spread onto the OTel Resource, so every span, log, error and metric of the new session carries it. Resumed sessions and first launches omit it. The attribute name and semantics match the browser SDK'ssession.previous_id(#857).Testing
yarn workspace @launchdarkly/observability-react-native test: 17 files, 149 tests passyarn workspace @launchdarkly/observability-react-native typegen: cleanSessionManager.test.ts(stale session, cold start, resume, nothing persisted) andObservabilityClient.test.ts(attribute present/absent on the Resource). 5 of them fail with theSessionManagerchange reverted.Notes for the reviewer
ObservabilityClientsets'highlight.session_id': sessionAttributes.sessionId, andgetSessionAttributes()has nosessionIdkey, so that resource attribute is alwaysundefined. Worth fixing separately if anything still reads it.🤖 Generated with Claude Code
Opened by
termag askfor vkorolik: an agent run onsf8t4-10292244/observability-sdk, threadcmvu4uwxn1hz8f7cqs2fo6mak.The run worked in its own clone of the committed code. termag checked its commits before pushing (descends from the base, no protected paths, authored by the asker, no secret-shaped strings); review the change as you would any other before marking it ready.
Follow-ups on the thread push here:
termag ask sf8t4-10292244/observability-sdk --thread cmvu4uwxn1hz8f7cqs2fo6mak "…".Opened from termag
Note
Overview
When a React Native JS load starts a new session instead of resuming a persisted one (inactivity timeout or cold start),
SessionManagernow remembers the replaced session ID and exposes it assession.previous_idingetSessionAttributes(), alongside existingsession.idandsession.start_time.That attribute is omitted when the session is resumed within the resume window or when nothing was stored. Init failures clear the link.
getPreviousSessionId()is added for direct access. BecauseObservabilityClientmerges session attributes onto the OTel Resource, the new field applies to spans, logs, errors, and metrics for the whole new session—matching browser SDK semantics for stitching journeys across relaunches.Coverage adds SessionManager cases (stale, cold start, resume, empty store) and ObservabilityClient Resource assertions for presence/absence of
session.previous_id.Reviewed by Cursor Bugbot for commit 7c3a515. Bugbot is set up for automated code reviews on this repo. Configure here.