Skip to main content

Module collector

Module collector 

Source
Expand description

Gathering what one request did, and only that request.

The instrumentation bus is global: every query in the process dispatches to the same subscribers. A debug bar needs the opposite — the queries this request made, so the number on the page belongs to the page.

A task-local does that. Every request is a task, everything the handler awaits stays on it, and so a collector installed for the task sees that request’s events and nobody else’s. Work moved off the task with tokio::spawn is not collected, which is the honest limit of the approach and is stated on the bar rather than hidden.

Structs§

Collected
Everything collected for one request.
Collector
Installs itself on the bus and routes events to whichever request is running.
Timing
One thing that happened, in the order it happened.