Telemetry and shortcuts
Telemetry gives the desktop app a consent-based way to report crashes and selected performance timings. Native shortcuts let users control the window and port forwards without opening the app, while the desktop process keeps those actions tied to saved configurations. See the observability and user controls parent page for the wider settings model, HTTP logging and network monitoring for network diagnostics, and desktop native orchestration for the desktop process that runs these facilities.
Telemetry system
The telemetry system spans the Rust process and each application webview. The Rust side owns stored consent and process-level reporting, while each webview starts its own reporting client only after it receives an allowed context. This keeps consent changes consistent across the main and log windows.
Consent model
Consent is split into crash reports and performance data because they serve different purposes. The first choice is stored as unset until the user answers. The consent dialog starts with crash reports enabled and performance data disabled, but “No thanks” turns both off. Users can change the choices later in settings.
| Choice | Purpose | Default in the first prompt |
|---|---|---|
| Crash reports | Send a reduced error report when the app fails | On |
| Performance data | Send timing data for selected app operations | Off |
The Rust commands save each choice and broadcast the new value to every webview. A webview therefore changes its reporting behavior without a restart, including when the choice changed in another window. References: frontend/…/index.tsx• L22-75, crates/…/telemetry.rs• L9-75
Telemetry initialization
Telemetry initialization starts early in the Rust process and then runs independently in the main and log webviews. Each webview listens for consent changes before it reads its initial context, so a recent change cannot be replaced by an older startup value.
The Rust context tells the webview whether reporting is allowed and supplies release, target, and run information. When no reporting endpoint is available, the webview does not start its reporting client. This covers builds and environments where reporting is disabled.
flowchart TD
A[Desktop process starts] --> B[Load telemetry setting]
B --> C[Main webview and log webview start]
C --> D[Listen for consent changes]
D --> E[Read telemetry context]
E --> F{Reporting allowed?}
F -->|No| G[No webview reporting client]
F -->|Yes| H[Start crash and performance filters]
I[User changes consent] --> J[Save choice]
J --> K[Broadcast change]
K --> D
The process startup path initializes the Rust telemetry service and loads its saved setting. The two webview entry points call the same initialization routine, which gives both windows the same consent behavior. References: crates/…/main.rs• L138-145, crates/…/main.rs• L185-222, frontend/…/main.tsx• L4-25, frontend/…/logs.tsx• L4-25, frontend/…/telemetry.ts• L189-255
Data filtering
Telemetry filters data before it leaves the app. Crash reports keep the error type and stack locations from the app bundle, but remove the error message and other page context. This prevents cluster addresses, resource names, browser details, and unrelated script locations from entering a crash report.
Performance reports keep operation timing and trace relationships. They do not keep request details, breadcrumbs, or span data that could contain operation arguments. Invoke timings are sampled only while performance consent is enabled, so turning the choice off stops later timings.
Failed desktop commands use a fixed error type and a command-based grouping key. The rejected message is not attached because it can contain cluster or resource names. References: frontend/…/telemetry.ts• L54-79, frontend/…/telemetry.ts• L81-180, frontend/…/telemetry.ts• L217-255, frontend/…/telemetry.test.ts• L79-188, frontend/…/telemetry.test.ts• L313-356
Native shortcut system
The native shortcut system gives the desktop app global keyboard controls for its window and port-forward actions. The shortcut manager keeps saved definitions, native registrations, and action targets aligned while platform managers receive key events and send them to the matching action.
Shortcut lifecycle
The app creates the shortcut manager during desktop setup. It loads enabled definitions from storage and registers them with the active platform manager. Changes made by the shortcut settings screen update storage and the live registration together, while failed changes attempt to keep the prior binding in place.
flowchart LR
A[Shortcut settings] -->|create or update| B[Desktop command]
B --> C[Stored shortcut definition]
C --> D[Shortcut manager]
D --> E[Platform registration]
E --> F[Keyboard trigger]
F --> G[Action registry]
G --> H[Window change or port-forward operation]
H --> I[Desktop notification]
The manager also exposes platform status and a permission repair path. It unregisters old bindings before a rebind and refreshes action targets when saved definitions change. This keeps a key from running stale configuration data after an edit or configuration removal. References: crates/…/manager.rs• L97-125, crates/…/manager.rs• L179-266, crates/…/manager.rs• L312-371, crates/…/shortcuts.rs• L59-109, frontend/…/useGlobalShortcuts.ts• L11-80
Platform behavior
The platform layer gives Linux, macOS, and Windows the same registration and action contract while adapting to each system's global input rules. macOS and Windows use native global-hotkey support. Windows performs manager operations on a dedicated thread so registration calls use the required platform context.
Linux selects input handling from the session and available permissions. X11 uses global-hotkey support. Wayland uses direct input-device access when the user can read keyboard devices, and otherwise falls back to limited compatibility behavior. The status path tells the UI whether input permissions need repair.
When a supported platform receives a press, it resolves the native event to a shortcut ID and executes the action registered for that ID. Unsupported or fallback modes can retain saved definitions without producing working key events, so platform availability must be treated separately from whether a definition is stored. References: crates/…/linux.rs• L40-103, crates/…/linux.rs• L172-214, crates/…/linux.rs• L558-717, crates/…/macos.rs• L31-49, crates/…/macos.rs• L151-233, crates/…/windows.rs• L35-90, crates/…/windows.rs• L192-315
Shortcut actions
Shortcut actions provide a small control layer over the window and port-forward state. Actions that target configurations carry configuration IDs, while global actions operate on all saved configurations or on the main window.
| Action group | User result | Configuration scope |
|---|---|---|
| Toggle window | Show or hide the main window | None |
| Start or stop all | Change every eligible port forward | All saved configurations |
| Start, stop, or toggle selected | Change only the chosen port forwards | Selected configuration IDs |
Each port-forward action checks current state before it acts. It skips work that is already complete, reports partial success, and shows a desktop notification with the counts. A failed item does not hide successful work from the result. The shortcut manager now keeps the action registry in step with edits and removals, so a trigger uses the current action data. References: frontend/…/actions.ts• L1-30, crates/…/shortcuts.rs• L198-269, crates/…/shortcuts.rs• L271-418, crates/…/shortcuts.rs• L420-659, crates/…/shortcuts.rs• L686-831, crates/…/manager.rs• L255-277, crates/…/manager.rs• L312-335
Shortcut validation
Shortcut creation uses a normalized key format and checks for conflicts before a definition is accepted. The UI can list actions, select configurations, and edit existing definitions, while the native side remains the source of truth for validity and platform support.
Configuration links are carried as action data and as an optional configuration ID. If a definition refers to missing or invalid action data, the action cannot identify its targets and returns a failure instead of silently acting on another configuration. References: frontend/…/ShortcutFormModal.tsx• L35-120, frontend/…/actions.ts• L32-57, crates/…/shortcuts.rs• L10-57, crates/…/shortcuts.rs• L102-124, crates/…/shortcuts.rs• L173-204
Change checklist
When these files or sections are changed, remember to consider these:
- Keep the telemetry consent names, stored settings, broadcast event names, and webview listeners aligned.
- Keep the telemetry scrub rules aligned with any new error or performance fields so user data does not bypass filtering.
- Keep the shortcut action names and configuration-data shape aligned between the shortcut editor and native action handlers.
- Keep shortcut manager startup ahead of shortcut commands and preserve the platform status and permission repair paths for Linux input access.
- Keep port-forward result counts and notifications aligned when action outcomes change.
- Keep the parser's accepted key names aligned with every platform's key map.
- Keep native registration and event handling on the platform context required by each operating system.
Important failure modes
| Trigger | Consequence | Guard |
|---|---|---|
| The reporting context has no endpoint | The webview does not report errors or timings | The client is not started when the context has no DSN |
| A consent change reaches only one webview | Another window can keep reporting with stale consent | The Rust command broadcasts every change |
| A shortcut key is invalid or already used | The shortcut cannot be registered reliably | Normalize, validate, and check conflicts before save |
| Linux Wayland input access is missing | Saved shortcuts can exist but key presses do not trigger actions | Report the limited platform mode and offer the input permission repair path |
| A selected configuration is missing or has bad action data | The action fails without changing an unintended configuration | Require target IDs and resolve them against current saved configurations |
| Some port-forward operations fail in a batch | A partial operation can look like a full success | Count successes and failures separately and report both |
| A platform key map does not match the shared parser | A shortcut passes general validation but cannot register on that platform | Keep accepted key names covered by each platform mapping |
Key files
| File | Why to read it |
|---|---|
| frontend/…/telemetry.ts | Defines webview telemetry startup, consent updates, and data filtering |
| crates/…/telemetry.rs | Defines stored consent, cross-window broadcasts, and the webview context |
| frontend/…/index.tsx | Shows the user-facing consent choices and their defaults |
| crates/…/manager.rs | Coordinates saved definitions, platform bindings, action targets, and lifecycle changes |
| crates/…/linux.rs | Shows Linux session selection, input permissions, and event handling |
| crates/…/macos.rs | Shows native macOS registration and event dispatch |
| crates/…/windows.rs | Shows Windows registration through its platform thread and event dispatch |
| crates/…/shortcuts.rs | Connects native shortcut triggers to window and port-forward actions |
| crates/…/shortcuts.rs | Defines the desktop command interface for shortcut settings |
| frontend/…/actions.ts | Defines the action choices shown in the shortcut editor |
| frontend/…/useGlobalShortcuts.ts | Connects the shortcut settings UI to desktop commands and platform status |
| crates/…/main.rs | Shows process startup and registration of the telemetry and shortcut command surfaces |