Repository navigation
feat(android): add setAttributes and removeAttributes - #860
Open
abelonogov-ld wants to merge 4 commits into
Open
abelonogov-ld wants to merge 4 commits into
abelonogov-ld wants to merge 4 commits into
Conversation
Co-authored-by: Cursor <cursoragent@cursor.com>
This was referenced Oct 28, 2026
Co-authored-by: Cursor <cursoragent@cursor.com>
Co-authored-by: Cursor <cursoragent@cursor.com>
Co-authored-by: Cursor <cursoragent@cursor.com>
This was referenced Oct 29, 2026
Vadman97
approved these changes
Oct 29, 2026
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.
Summary
Adds a global attributes API to the Android observability SDK. This is one of a set of matching PRs across SDKs that share the same semantics (see #858, #859, #861, #856, #863, launchdarkly/swift-launchdarkly-observability#290).
LDObserve.setAttributes(Attributes)andLDObserve.setAttributes(Map<String, Any?>)merge attributes by key into one in-memory, process-wide map;LDObserve.removeAttributes(Collection<String>)removes keys.OtelRumConfig.setGlobalAttributesis intentionally not used, because its appenders overwrite per-call values. Instead, internal span and log processors are registered ahead of the SDK's sampling and export processors, and metric record methods merge globals under per-call values.session.idandhighlight.session_idare ignored (a warning is logged).How did you test this change?
GlobalAttributesStoreTest,GlobalAttributesPipelineTest): merge/remove, re-setting a key with a different value type, reserved keys, per-call precedence, concurrent writers, set-before-init throughLDObserve, globals captured at span start, and globals reaching exported spans, logs and metric data points through real OpenTelemetry providers wired like the SDK../gradlew :lib:compileDebugKotlin :lib:testpasses (559 tests, debug and release).Are there any deployment considerations?
ObservabilityOptionsis unchanged. The only API change is three new methods onObserve(inherited byLDObserveand its companion), with default implementations, so Kotlin implementers need no changes.LDObserve.Companion.setAttributes(...)/removeAttributes(...), like the otherLDObservemethods. feat(maui): add SetAttributes and RemoveAttributes #863 (MAUI) is stacked on this PR.Note
Overview
Adds process-wide global attributes on the Android observability SDK via
LDObserve.setAttributes(OTelAttributesor plain map) andLDObserve.removeAttributes.Globals are stored in a singleton
GlobalAttributesStoreso calls before SDK init still apply once the pipeline starts. They are merged into spans (snapshot at span start), logs (via new processors registered ahead of sampling/export), and metrics (including launch-time histograms), with per-call attributes winning over globals and reserved session keys ignored with a warning. README and the compose e2e app document/repro UTM-style globals and precedence.Reviewed by Cursor Bugbot for commit 7e24d72. Bugbot is set up for automated code reviews on this repo. Configure here.