Repository navigation
Conversation
Store the current context keys on every identify and stamp them as `context.contextKeys.<kind>` on all logs, errors, spans and metrics, matching the web SDK. Keys are replaced (not merged) on each identify and are set regardless of identify status, as on web. An identify made before the SDK initializes is buffered and applied in order. The bare `user`/`device` fields on the `LD.identify` log are kept. 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 a770a61. 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/sf4t1/demo-test-output.txtWhat and why
The React Native SDK only put context keys on the
LD.identifylog andLD.trackspans, so you couldn't tie other RN rows to a user or device. Now every identify stores the context keys, and they're stamped ascontext.contextKeys.<kind>(same names as web) on all logs, errors, spans (manual, track, flag, network,console.error) and metrics. This uses the existing shared-attribute processors.InstrumentationManager.setContextKeyAttributesreplaces the stored keys on each call and fillsgetContextKeyAttributes()._LDObserve._setContextKeyscall is buffered before init and goes throughObservabilityClient.setContextKeys.afterIdentifysets the keys first, whatever the identify status, as web does. TheLD.identifylog keeps its bareuser/devicefields for back-compat.Testing
yarn workspace @launchdarkly/observability-react-native test: 18 files, 155 tests pass, including the newsrc/client/ContextKeys.test.ts(12 tests). They cover log, error,console.error, manual/track/flag/XHR spans, all metric kinds, multi-context, re-identify replacing keys, a non-completed identify, and an identify before init being buffered.yarn workspace @launchdarkly/observability-react-native typegen: passes.Open questions
error/shed, to match web. A later identify overwrites them. Should RN only set them oncompleted?🤖 Generated with Claude Code
Opened by
termag askfor vkorolik: an agent run onsf4t1-10292244/observability-sdk, threadcmvu4tz271hq2f7cqjodjfd0a.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 sf4t1-10292244/observability-sdk --thread cmvu4tz271hq2f7cqjodjfd0a "…".Opened from termag
Note
Overview
React Native observability now attaches LaunchDarkly evaluation context to every signal, not only
LD.identify/ track paths. On eachafterIdentify, the plugin pushes context keys through_LDObserve._setContextKeys(buffered before init), which lands inInstrumentationManager.setContextKeyAttributesand replaces the stored snapshot ascontext.contextKeys.<kind>—aligned with the web SDK naming.Those keys merge with global attributes in
getSharedAttributes(), so logs, errors, manual/track/flag/network spans, and metrics pick them up via the existing global-attribute processors. Keys are updated on every identify (including non-completedstatuses, like web); re-identify replaces the set. TheLD.identifylog still includes bareuser/devicefields for back-compat.Adds
ContextKeys.test.ts(store/replace, metrics, plugin identify, multi-context, pre-init buffering, re-identify, failed identify).Reviewed by Cursor Bugbot for commit a770a61. Bugbot is set up for automated code reviews on this repo. Configure here.