mirror of
https://github.com/block/buzz.git
synced 2026-11-24 10:12:19 +00:00
feat(mobile): add screen breadcrumbs to diagnostic reports
A hang or error report said what the connection was doing but not where the person was. Reports now carry a trail of the screens they moved to. A NavigatorObserver on the root navigator and on the conversation pane's navigator leaves a breadcrumb through the existing reporter when a page is pushed, replaced, or revealed again by a pop. The app pushes page widgets without route settings, so a route is named by the first listed page widget below it, and any other page is "other". Nothing is read from route settings, arguments or page content, so no channel or community name, ID or pubkey can reach a breadcrumb. Dialogs, sheets and menus leave none. The filter keeps the navigation category and drops any entry whose screen is not on the app's list. A build without a reporting destination does nothing. Co-authored-by: studio <dc2fc481343672df31a689840c09299972e704dac592e0da6f18486646a7ee3e@localhost> Signed-off-by: Tom Brow <tomb@block.xyz>
This commit is contained in:
@@ -20,7 +20,7 @@ A build that is given a [reporting destination](../CONTEXT.md#reporting-destinat
|
||||
4. As a developer, I want a report when the relay rejects something the app sent as invalid, so that client bugs in what we send are found.
|
||||
5. As a developer, I want a report when a Builderlab or push gateway response cannot be understood, so that contract drift is caught.
|
||||
6. As a developer, I want a report when data saved on the device cannot be read back, so that storage corruption and migration bugs surface.
|
||||
7. As a developer, I want each report to carry the trail of recent networking events, so that I can see what the connection was doing before the fault.
|
||||
7. As a developer, I want each report to carry the trail of recent networking events and the screens the person was on, so that I can see what the connection was doing and where the person was before the fault.
|
||||
8. As a developer, I want each report to carry the member's public key, so that I can follow up with the person who hit it.
|
||||
9. As a developer, I want timeouts, disconnects, being offline, rate limits and refused sign-ins counted and not reported as errors, so that the error list contains only bugs someone can fix.
|
||||
10. As a developer, I want every network request and relay connection event counted with its backend, endpoint, outcome and kind of failure, so that I can see which backend and which operation is failing.
|
||||
@@ -46,7 +46,7 @@ A build that is given a [reporting destination](../CONTEXT.md#reporting-destinat
|
||||
- **Networking measurements.** Every request through the app's shared HTTP client and every relay connection event (connected, disconnected, reconnect attempt, request timed out, subscription closed by the relay) is counted with four attributes: backend, endpoint, outcome and kind of failure. The backend is the host name of the server the app was talking to. Endpoints are names from a fixed list, never raw paths. Durations are recorded for requests and for time to connect. HTTP is measured where the app's shared HTTP client already classifies transport failures; relay connections are measured by hand in the relay session, since the SDK documents no WebSocket instrumentation.
|
||||
- **Counts are handed to the SDK as they happen**, including while the network is down. The app does no buffering of its own, and the SDK's default limit on unsent data is kept. Accepted consequence: in a long outage the oldest unsent reports can be dropped.
|
||||
- **No log lines in step one.** The counts carry the member and the time. The first implementation task confirms that the destination can filter counts by member; if it cannot, the fallback is one log line per outage, sent after it ends.
|
||||
- **Breadcrumbs come from a fixed list:** networking events, written by the app, and the app moving to the foreground or background, written by the SDK. The SDK's other automatic breadcrumbs, which could carry content or addresses, are turned off or filtered.
|
||||
- **Breadcrumbs come from a fixed list:** networking events and screen names, written by the app, and the app moving to the foreground or background, written by the SDK. A screen name comes from the app's own list of screens (such as the channel list, a channel, a thread or settings), with any other page called "other". It is never a channel or community name, an ID, a route's settings or anything a screen shows, so a report shows which screens the person was on and not what they were looking at. A breadcrumb is left when the person moves to a page or back to one. Dialogs, sheets and menus leave none. The SDK's other automatic breadcrumbs, which could carry content or addresses, are turned off or filtered.
|
||||
- **Who a report is about.** The member's public key is set as the report's user when a session starts and cleared when it ends. When the session is a Builderlab account, the Builderlab's origin and the account's subject identifier are added, never its email address. Every report also carries the app's own random per-install identifier, created on first launch and kept in a file that device backups and transfers skip, so a phone restored from another gets its own, as a separate field, signed in or not, so reports from one device can be matched to the members who used it, and a member's reports to the devices they used. With no member set, for example before sign-in, the SDK fills the report's user with its own random per-install identifier, on Dart and native reports alike. On iOS, native crash and hang reports also carry the SDK's device app hash: a hash of the identifier iOS gives the app's vendor, the hardware model and the bundle identifier, stable across launches and across a reinstall while another app from the same vendor stays installed. The Dart filter drops it, so Dart reports don't carry it. The SDK also sends session records, so the destination can show a crash-free rate. A session begins each time the app starts or returns after 30 seconds or more in the background. The SDK sends a record when it begins, an update each time an error is counted, and a last record when it ends. Together they carry when the session started, how many errors it had, how it ended (normally, crashed or abnormally), the time from start to end (not time in active use), the release, the environment and the SDK's identifier.
|
||||
- **One filter before anything leaves.** Errors, breadcrumbs and counts from Dart all pass through a single filter that removes URL query strings and fragments, drops any attribute not on the allowed list, replaces every error's own text with fixed wording, drops what the SDK adds about the failing widget or platform call, and keeps only the app, operating system, device and runtime details among the report's contexts, so the SDK's accessibility settings, locale and the device's own name stay on the device. An error keeps its type and stack trace. The SDK's options for sending personal data, screenshots, view hierarchies and session recordings stay off.
|
||||
- **Main-thread hangs** are captured by the SDK's own hang detection, at the SDK's default thresholds. The app's Dart code runs on the platform's main thread, so Dart work that blocks it shows up here. On iOS, the SDK reports the main thread being blocked, fully or mostly, for 2 seconds or more while the app is active, with the main thread's stack taken during the hang, including freezes the app recovers from. A hang that is still going when the app is killed, for example by the system watchdog, is sent on the next launch as a fatal hang. The SDK's separate watchdog-termination tracking also reports, on the next launch, a run that ended while the app was in the foreground with nothing else to explain it; it never reports on simulators or for kills in the background. App hang detection is off while a debugger is attached ([sentry-cocoa 9.35.0](https://github.com/getsentry/sentry-cocoa/blob/9.35.0/Sources/Swift/Integrations/AppHangTracking/SentryHangTrackingIntegration.swift)). On Android the SDK reports only freezes the system itself declared "app not responding". On Android 11 and later it reports only one that ended the process, read from the system's exit records on the next launch: the most recent unreported one, and only when the system kept a usable thread dump. Before Android 11 it reports when the main thread has been blocked for 5 seconds and the system has marked the app not responding, never with a debugger attached ([sentry-java 8.64.0](https://github.com/getsentry/sentry-java/blob/8.64.0/sentry-android-core/src/main/java/io/sentry/android/core/AnrIntegrationFactory.java)). So with these defaults, a freeze the app recovers from is reported on iOS, and on Android only before Android 11 and only once the system has marked the app not responding. Dart frames in a hang's stack are readable only with the Dart code's debug symbols at the destination, the same as for crashes.
|
||||
@@ -74,7 +74,7 @@ A build that is given a [reporting destination](../CONTEXT.md#reporting-destinat
|
||||
- Requests that bypass the shared HTTP client, such as those made by native media players and image loaders.
|
||||
- Alert rules, dashboards and the destination's own configuration, which belong to whoever owns the destination.
|
||||
- Diagnostic reporting in a [public build](../CONTEXT.md#public-build). Nothing prevents it, but what a report carries was chosen for internal builds. Turning it on there first needs the member's public key and the server host names removed, the rest of the list reviewed, and a way to tell people ([ADR 0007](adr/0007-diagnostic-reporting-follows-the-destination.md)). Because identity and every attribute pass through one module, that is a small code change.
|
||||
- Usage or behavior data of any kind, beyond the SDK's session records described above.
|
||||
- Usage or behavior data of any kind, beyond the SDK's session records described above and the trail of screens in a report.
|
||||
- Fixing the bugs the reports will reveal, including one found while planning: a catch-all in account requests presents every error as an outage.
|
||||
|
||||
## Further notes
|
||||
|
||||
Reference in New Issue
Block a user