Skip to content

Tracing with quoin-devtools

How-to Guide1 min read
Edit page

You will instrument a running application to see what its reactive core is doing: signal creations, read-triggering mutations, update requests, and task spawns, completions, and aborts. quoin-devtools wraps any adapter’s context — GPUI, Leptos, Dioxus, Xilem, Floem, or the testkit context.

Prerequisites: the devtools feature (or a direct dependency on quoin-devtools).

Instrumented::wrap is a drop-in wrapper: keep using the wrapped context everywhere you used the raw one.

use quoin_devtools::Instrumented;
let raw_ctx = /* any adapter context */;
let ctx = Instrumented::wrap(raw_ctx, "app");

Recording is gated so that shipping the wiring costs nothing when disabled — with tracing off, each call is one relaxed atomic load and nothing is allocated.

Terminal
QUOIN_TRACE=1 ./myapp # or QUOIN_TRACE=on

Alternatively enable it programmatically: quoin_devtools::enable() (and disable() / enabled() to inspect the state).

The global EventLog is a ring buffer (default capacity 4096 events) with three aggregate views:

quoin_devtools::global_log().dump(); // stderr table
quoin_devtools::global_log().hot_signals(); // ranked mutation counts
quoin_devtools::global_log().events(); // raw snapshot of Event values

Call them from a debug hotkey, a drop-down panel, or on exit. Each event carries an EventKind (updates, spawns, mutations, …) and the label you passed to Instrumented::wrap.

The counter-xilem example renders trace counts next to the counter and dumps the session when the window closes:

Terminal
cargo run --manifest-path examples/counter-xilem/Cargo.toml

For a headless tour of the tracing session itself, run just trace-demo (it drives devtools-demo with QUOIN_TRACE=1).

The optional tracing feature forwards events into the tracing ecosystem instead of (or in addition to) the built-in log.