Merged
Conversation
sdk/@launchdarkly/mobile-dotnet/observability/infra/PluginOrchestrator.cs
Outdated
Show resolved
Hide resolved
sdk/@launchdarkly/mobile-dotnet/observability/bridge/LogBuilderAdapter.cs
Outdated
Show resolved
Hide resolved
sdk/@launchdarkly/mobile-dotnet/observability/observe/api/LDObserve.cs
Outdated
Show resolved
Hide resolved
2bd87dd to
6e27d9c
Compare
sdk/@launchdarkly/mobile-dotnet/observability/infra/PluginOrchestrator.cs
Outdated
Show resolved
Hide resolved
- Introduced `triggerLogWithContext` method in ViewModel to log messages with OpenTelemetry span context. - Added a button in MainActivity to trigger the new logging functionality, enhancing observability in detached threads.
- Cleaned up imports in `LDObserve.kt`, `ObservabilityHookExporter.kt`, `ViewModel.kt`, `ObservabilityServiceTasks.kt`, `SamplingE2ETest.kt`, and `DisablingConfigOptionsE2ETest.kt` by removing the unused `recordLog` import. - Updated `recordLog` method signature in `Observe.kt` to provide default values for attributes and spanContext, simplifying its usage.
- Introduced a new button in MainPage.xaml to trigger logging with OpenTelemetry span context. - Implemented OnTriggerLogWithContextClicked method in MainPage.xaml.cs to log messages with associated span context. - Updated LDObserve to support optional span context in the RecordLog method, enhancing trace-log correlation capabilities.
…ization logic - Renamed the TryInitializeAll method to InitializeAll for clarity. - Updated the initialization logic to only call LDObserve.Initialize if observability options are enabled. - Adjusted the Register method to call the renamed InitializeAll method.
e47e8aa to
c39ec78
Compare
There was a problem hiding this comment.
Cursor Bugbot has reviewed your changes and found 1 potential issue.
❌ 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 c39ec78. Configure here.
sdk/@launchdarkly/mobile-dotnet/observability/observe/plugin/ObservabilityService.cs
Show resolved
Hide resolved
Vadman97
approved these changes
Apr 9, 2026
abelonogov-ld
added a commit
that referenced
this pull request
Apr 9, 2026
* andrey/maui-network: feat: MAUI trace log correlation (#461)
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
ObservabilityService— a new internal service class that consolidates all native bridge calls (logging, errors, metrics, tracing) and owns theLDTracerlifecycle. Replaces the deletedNativeObserveclass and eliminates scattered#if IOS / ANDROIDdirectives fromLDObserve.RecordLognow accepts an optionalSpanContextparameter, forwardingtraceId/spanIdto the native logger. Falls back to the ambientActivity.Currentwhen no explicit context is provided.RealLoggeron Android andObjcLoggeron iOS — new native wrappers obtained viaLDObserveBridgeAdapter.getLogger()/LDObserveBridge.getObjcLogger(), replacing the oldrecordLogmethod onObservabilityBridge.NativeSessionReplay→SessionReplayServiceandNativeObserve→ObservabilityServicethroughout the plugin layer for consistent naming.LDTracernon-singleton — constructor now takesserviceName, created and owned byObservabilityServiceduring initialization.LDObservestatic facade — all methods delegate toObservabilityServicevia a volatile reference; safe no-op behavior before initialization. AddStartRootSpan,RecordError(Exception)overload.LDObservabilityOptions,LDPrivacyOptions,LDSessionReplayOptionsmoved fromObservabilityBridge.ktinto a dedicatedOptionsBridge.kt.RecordError(Exception)overload; route span creation throughLDObserve.StartRootSpan.Test plan
RealLogger,ObjcLogger)traceId/spanIdin the backendLDObservemethods are no-ops before plugin registration (no crashes)RecordError(Exception)sends both message and full stack traceNote
Medium Risk
Medium risk due to refactoring the observability facade and plugin initialization flow, plus new native bindings (
ObjcLogger/RealLogger) that must compile and behave consistently on both iOS and Android.Overview
Adds trace-log correlation and centralizes native observability calls. Introduces an internal
ObservabilityServicethat ownsLDTracerlifecycle and routes logs/errors/metrics/spans through platform-native bridges, replacing the deletedNativeObserveand removing per-call#if IOS/ANDROIDbranching fromLDObserve.LDObserve.RecordLognow accepts an optional OpenTelemetrySpanContext(falling back toActivity.Current) and forwardstraceId/spanIdto a new native logger interface; iOS binding addsObjcLogger/getObjcLogger, Android addsRealLogger/getLoggerand moves Kotlin option DTOs intoOptionsBridge.kt.Plugin wiring is updated to use
ObservabilityService/SessionReplayService(renamed fromNativeSessionReplay), withPluginOrchestratorinitializingLDNativeand then callingLDObserve.Initializewhen observability is enabled. Sample app is updated to demonstrate "Log with Context",RecordError(Exception), andStartRootSpanusage.Reviewed by Cursor Bugbot for commit d798511. Bugbot is set up for automated code reviews on this repo. Configure here.