Conversation
- 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.
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
2f27654 to
2bd87dd
Compare
- 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.
* main: feat: allow attach span context to logs (#460)
2bd87dd to
6e27d9c
Compare
* main: chore: release main (#462)
- 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.
sdk/@launchdarkly/mobile-dotnet/observability/infra/PluginOrchestrator.cs
Outdated
Show resolved
Hide resolved
…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.
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 e47e8aa. Configure here.
| { | ||
| #if ANDROID | ||
| private static readonly LDObserveAndroid.ObservabilityBridge _androidBridge = new(); | ||
| #endif |
There was a problem hiding this comment.
Volatile write before initialization causes unsafe publication
Medium Severity
In LDObserve.Initialize, _service = service (a volatile write) happens before service.Initialize(). The volatile write acts as a release fence for prior stores only, but the writes to _tracer and _nativeLogger inside Initialize() happen after the volatile write, so they aren't covered by it. Another thread reading _service via the volatile field could see a non-null reference whose internal fields haven't been published yet. Swapping the two lines — calling service.Initialize() first, then assigning _service — ensures the volatile write publishes the fully-initialized object.
Additional Locations (1)
Reviewed by Cursor Bugbot for commit e47e8aa. Configure here.


Summary
How did you test this change?
Are there any deployment considerations?
Note
Medium Risk
Moderate risk because it refactors core observability initialization and replaces the tracing/log export path (including new native bindings), which could affect telemetry emission or span/log correlation across iOS/Android.
Overview
Enables trace-log correlation by routing
LDObserve.RecordLogthrough a newObservabilityServicethat can attachtraceId/spanIdfrom eitherActivity.Currentor an explicitActivityContext.Replaces the previous OpenTelemetry
TracerProvider/LDTraceExporterpipeline with aSystem.Diagnostics.ActivitySource+ActivityListenerinLDTracer, exporting stopped activities to the native tracer viaTraceBuilderAdapter, and exposes newLDObserveAPIs (GetActivitySource,StartActiveSpan,StartRootSpan).Adds native logger bindings on both platforms (
getLogger/RealLoggeron Android;ObjcLogger+getObjcLoggeron iOS) and refactors plugin orchestration and hooks to useObservabilityService/SessionReplayService(renaming/removing oldNativeObserve/NativeSessionReplay), with the MAUI sample updated to exercise the new span/log context flow.Reviewed by Cursor Bugbot for commit e47e8aa. Bugbot is set up for automated code reviews on this repo. Configure here.