Expand description
Aggregation of Flight Recorder events from several contexts of one client over
[bitwarden_ipc].
Clients with more than one context (browser popup + background, desktop renderer + main) run one context as the collector and the others as forwarders. Once forwarding is enabled, a forwarder sends captured events to the collector and keeps only events from the IPC stack itself locally, since sending those would loop. The collector stores received events in its own buffer, attributed to the sending process, and answers read requests from its forwarders.
Collectors only accept messages from their own clientโs forwarder endpoint. The browser background also receives IPC traffic from web pages, which must not be able to read or inject events.
Structsยง
- Flight
Recorder Batch - Events sent from a forwarder to its collector.
- Forwarder
State ๐ - IpcForward
Sink - Sink that forwards events to a collector over IPC.
- Read
Flight ๐Recorder Handler - RPC handler for
ReadFlightRecorderRequest, answering onlyroleโs forwarder. - Read
Flight Recorder Request - RPC request from a forwarder for the collectorโs events.
- Read
Flight Recorder Response - RPC response for
ReadFlightRecorderRequest. - Reading
Guard ๐ - Marks an aggregated read in flight until dropped, including when the read is cancelled.
Enumsยง
- Flight
Recorder Collector Role - The context that collects events for its client.
- Read
Flight Recorder Error - Why the collector refused a
ReadFlightRecorderRequest.
Constantsยง
- COLLECTOR_
WAIT ๐ - How long a forwarder waits for its collector to answer discover before it keeps events local.
- DEFAULT_
READ_ ๐TIMEOUT - How long an aggregated read waits for the collector when the caller gives no cancellation token.
- DISCOVER_
RETRY_ ๐DELAY - How long a forwarder waits before asking again when the collectorโs discover answer is an error.
- FLUSH_
INTERVAL ๐ - How long a flush waits before draining, so events logged close together share one IPC message.
- UNFORWARDED_
TARGETS ๐ - Target prefixes kept in the forwarderโs local buffer instead of forwarded, as a backstop for
events the IPC stack emits outside
without_flight_recorder(e.g. from tasks it spawns).
Staticsยง
- COLLECTING ๐
- FORWARDER ๐
Functionsยง
- attribute ๐
- collect_
batches ๐ - enable_
flight_ recorder_ collection - Make this context the collector for its client, storing events from
roleโs forwarders and answering their read requests. Only the first successful call has effect. No-op if the Flight Recorder is disabled. - enable_
flight_ recorder_ forwarding - Make this context a forwarder: send captured events to the collector at
destination, except events from the IPC stack itself, which stay in the local buffer. - flush ๐
- is_
closed ๐ - process_
label ๐ - Process label for events received from
source. - read_
flight_ recorder_ aggregated - Read the Flight Recorder events for this client.
- release_
flush ๐ - End a flush that drained an empty buffer. Returns false if the flush must keep running.
- start_
collector ๐ - wait_
for_ ๐collector - Wait until the collector at
destinationanswers discover. Returns false if the local client cannot subscribe.