feat: Tracing API polishing + Distributed tracing Docs#464
Merged
abelonogov-ld merged 30 commits intomainfrom Apr 9, 2026
Merged
feat: Tracing API polishing + Distributed tracing Docs#464abelonogov-ld merged 30 commits intomainfrom
abelonogov-ld merged 30 commits intomainfrom
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.
- 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.
- 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.
* andrey/maui-network: feat: MAUI trace log correlation (#461)
…ft` for future iOS-native URL session instrumentation
…n ObservabilityService
…ting a new activity in ObservabilityService
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 5f9a9ff. Configure here.
…ice to handle stopped states
Vadman97
approved these changes
Apr 9, 2026
abelonogov-ld
added a commit
that referenced
this pull request
Apr 14, 2026
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
StartRootActivityto always restoreActivity.Currentafter creating the root activity, preventing permanent loss of the ambient activity context.Problem
StartRootActivitysavesActivity.Currentintopreviousand sets it tonullto create a parentless activity. However, it only restoredpreviouswhenStartActivityreturnednull. On success,Activity.Currentwas left pointing to the new root activity — and when that activity was later disposed,Activity.Currentreverted to its parent (null), permanently losing the original ambient context.This made
StartRootActivitybehave differently fromStartRootSpan, which usesDeactivateNewSpanto leaveActivity.Currentuntouched. The README documents these as "equivalent," but they had different side effects on ambient context.Fix
Unconditionally restore
Activity.Current = previousafter creating the activity, matching the behavior ofStartRootSpan.Test plan
Activity.Currentis preserved after callingStartRootActivityStartRootActivityandStartRootSpanbehave equivalently with respect to ambient contextNote
Medium Risk
Adds new public tracing surface area (
Activity/ActivitySourceand parent-context span overloads) and changes ambientActivity.Currenthandling inStartRootActivity, which could affect trace correlation if incorrect.Overview
Tracing API polish + distributed tracing docs.
LDObservenow supports starting spans with an explicit parentSpanContext(and optionalSpanKind) to enable manual context propagation across threads, and it exposes a .NET-nativeActivityAPI (GetActivitySource,StartActivity,StartRootActivity).StartRootActivityis fixed to always restore the previousActivity.Currentafter creating a root activity, avoiding accidental loss of ambient context. Documentation is expanded with a newdocs/distributed-tracing.mdcookbook and README updates (log/span context examples,span.AddEvent, root spans/activities), and the sample app adds a polling demo that creates child spans from captured context.Reviewed by Cursor Bugbot for commit 7caf8e9. Bugbot is set up for automated code reviews on this repo. Configure here.