-
Notifications
You must be signed in to change notification settings - Fork 24
feat(uniffi): add logging callback for mobile observability #627
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Conversation
|
Great job! No new security vulnerabilities introduced in this pull request |
🔍 SDK Breaking Change Detection StatusSDK Version: Results will be updated when workflow completes. View SDK workflow |
Codecov Report❌ Patch coverage is Additional details and impacted files@@ Coverage Diff @@
## main #627 +/- ##
==========================================
+ Coverage 78.87% 79.07% +0.19%
==========================================
Files 283 285 +2
Lines 29680 29805 +125
==========================================
+ Hits 23410 23568 +158
+ Misses 6270 6237 -33 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
cee9fbf to
b072562
Compare
2efef50 to
26a4f0a
Compare
Adds an optional LogCallback trait that mobile clients can implement to receive SDK log events for forwarding to Flight Recorder or other observability systems. The callback integrates with the existing tracing infrastructure from PM-26930 using a custom Layer that forwards INFO+ events to registered callbacks. The implementation includes CallbackLayer for event forwarding, MessageVisitor for extracting log data, and error handling to ensure callback failures don't crash the SDK. The callback parameter is optional to maintain backward compatibility with existing clients. Comprehensive test coverage includes unit tests and integration tests in separate processes to validate thread safety, error handling, and multi-level log forwarding without Once initialization conflicts.
Adds a reusable GitHub action that removes unused toolchains and packages before running tests on ubuntu-24.04 runners. The cleanup frees approximately 30GB by removing .NET SDKs, Android SDK, Swift toolchain, Java JDKs, and other pre-installed software not needed for Rust compilation. This prevents "No space left on device" errors that occur when compiling the integration test suite alongside the full SDK workspace. The action runs only on Linux runners since macOS and Windows have sufficient disk space.
26a4f0a to
68a6590
Compare

🎟️ Tracking
📔 Objective
This PR introduces an optional UNIFFI logging callback that enables mobile clients to receive SDK trace events and forward them to Flight Recorder observability systems.
The changes add a new
LogCallbacktrait that allows mobile teams to register a callback duringClient::new()initialization. When registered, the SDK forwards all INFO+ log events through this callback alongside existing platform loggers (oslog, android_logger). The callback is completely optional - existing SDK clients continue functioning without code changes.Documentation
Please review
crates/bitwarden-uniffi/docs/logging-callback.mdfor comprehensive details including:The documentation is the authoritative reference for this feature. You can also find a tech breakdown linked in the Tracking section.
Side Effect: CI Disk Cleanup
This PR also adds a disk cleanup action for Ubuntu test runners (
.github/actions/free-ubuntu-runner-disk-space/). The integration test suite compiles 5 separate test binaries alongside the full SDK workspace, requiring a lot of disk space. Without cleanup, Ubuntu runners exhaust available disk during compilation.Demo
Also included is an example showing how to use the callback. It, alongside the tests, are the assertions that the whole thing works. Here is a screenshot showing the output of the example:
⏰ Reminders before review
team
🦮 Reviewer guidelines
:+1:) or similar for great changes:memo:) or ℹ️ (:information_source:) for notes or general info:question:) for questions:thinking:) or 💭 (:thought_balloon:) for more open inquiry that's not quite a confirmedissue and could potentially benefit from discussion
:art:) for suggestions / improvements:x:) or:warning:) for more significant problems or concerns needing attention:seedling:) or ♻️ (:recycle:) for future improvements or indications of technical debt:pick:) for minor or nitpick changes