Skip to main content

Crate guinea_trace

Crate guinea_trace 

Source
Expand description

What caused what.

Every observable point - an action from the UI, a message sent to an actor, its handling, background work and its result, a publication and each of its deliveries, a reducer update, a navigation - is a Record with an id and the id of the point that caused it. Following parent from any record gives its provenance; following it the other way gives everything it set off.

The cause is carried implicitly on the thread (current) and explicitly wherever work crosses a queue or a thread: an actor’s mailbox, a background task, a hop back onto the UI thread. Cause is Copy + Send for that.

Records go to the observers on the thread that produced them (devtools), and to tracing as one event each: the target names the kind of point, guinea::send, and the fields carry id, parent and what the point holds. guinea::tick=off silences one kind. json writes them, and the application’s own events with the point they happened under, as JSON lines.

Structs§

Cause
One observed point, named for being the cause of what follows it.
Entered
Json
Record
Resumed
Within

Enums§

Bus
Which bus carried a publication.
Point
An observable point, with what identifies it.
StoreOp
How a stored value changed.
Trace
What an observer is told.

Functions§

begin_as
Records point as open, under parent and with an id reserve gave, without making it current: it is current wherever it is resumed, and closes at end.
current
What is happening on this thread right now, if anything is.
end
Closes a point begin_as opened, saying what it took.
enter
Records a point caused by whatever is current, and makes it current until the guard drops.
enter_under
enter, with the cause given rather than taken from the thread.
is_observed
Whether devtools are watching this thread.
is_observed_anywhere
Whether devtools are watching any thread.
is_point_target
Whether target is one [emit] writes points under, so a layer that turns tracing events into points can leave them alone.
is_recorded_anywhere
Whether a point recorded anywhere goes somewhere: to devtools, or to tracing as guinea:: events.
json
A layer writing every event as a JSON object on its own line: ts, level, target, then cause - the point an application’s own event happened under - then the event’s fields with their own types.
mark
Records a point caused by whatever is current, without making it current.
mark_under
Records a point caused by parent, for work that crossed a queue or a thread and brought its cause along.
now
Time since the moment Record::at counts from, on the same monotonic clock.
observe
Hands every record produced on this thread to observer, replacing any observer already set.
reserve
An id for a point recorded later, by begin_as. For a point that is not entered once and left: what happens under it may be recorded before it is, on another thread, and needs its id to say so.
resume
Makes cause current until the guard drops, without recording anything: for code that continues a point recorded elsewhere.
started_at
The wall clock at the moment Record::at counts from.
stop_observing
within
Runs future with cause current on whichever thread polls it.

Type Aliases§

Observer