Skip to main content

Module observe

Module observe 

Source
Expand description

The observation channel’s emission buffer. When an observation statement (Note/Warn/Record) executes, it emits a structured ObsEvent to a per-run thread-local buffer, drained by sinks (the in-memory test sink today; console and wire in Wave 16). This is the SEPARATE observation channel (D0.1) — it never touches program output.

Emission is wait-free from the program’s perspective (a buffer push) and never draws from the scheduler’s entropy, so a run’s SchedTrace is identical with observation on or off.

Structs§

ObsEvent
One emitted observation event.

Enums§

EventKind
What an emitted event IS: a speech-act message, or a trace-span boundary. Spans are lexical (During), so every SpanEnter is matched by exactly one SpanExit.
ObsCat
The speech-act category of a message event (mirrors the language AST’s ObsCategory, kept local so sinks need no AST dependency).

Functions§

capturing
True when a capture buffer is installed (lets emitters skip work otherwise).
drain
Take the captured events and stop capturing.
emit
Emit an event. Honors per-site sampling: with sample = Some(n) and a stable site id, only 1 in every n reaching this site is buffered (the first, then every nth). Sampling is a rendering decision — replay with capture-everything regenerates the full stream.
enter_span
Emit a SpanEnter for a During block (Wave 8).
exit_span
Emit a SpanExit — always paired with its enter_span (the During arm emits it on every exit path, so spans stay balanced).
from_logosobs
Parse a .logosobs stream back to events (the largo trace reader).
install
Begin capturing events for a run (the largo test runner, per test).
to_logosobs
Serialize an event stream to the .logosobs wire form — one JSON object per line, so it appends cheaply and greps line-by-line (columnar batching deferred).