Skip to main content

Module trace

Module trace 

Source
Expand description

PO.1 — the plugin boundary-trace substrate (Layer 1 of the observability stack, design fragment docs/dev/architecture/plugin-observability.md).

The host owns the whole Component-Model boundary, so it can record every host↔guest call independent of the guest’s source language. This module is the sink for those records: a per-plugin ring + a boot-wired event publisher, mirroring the LSP logging substrate (LspLogger / LspLogPushed) that already proves the ring + publisher + off-thread-drain shape.

This slice is the pipe only — no seam is instrumented yet (PO.2 / PO.3). Emission stays OFF the editor hot path by contract (design §4): trace is a cheap gate + push + publish; all formatting + buffer append happen off-thread on the drain side (PO.4), never on the UI/actor thread.

Structs§

HotGate
The hot-path verbosity gate — a per-plugin atomic the tracer publishes and the sync grammar trampoline reads once per guest call (design §4: “a single relaxed-atomic per-plugin gate load and a predicted-not-taken branch when off”). The Arc<AtomicU8> is owned by the PluginTracer (its single source of truth for verbosity) and cloned into the trampoline; a :set plugin.trace-level write updates the atomic, so the very next keystroke reads the new level with no lock and no cross-plugin cost.
PluginTracePushed
Fired when PluginTracer::trace appends a record. A register_event! typed event streamed via publish_typed; the trace-buffer views (PO.4) subscribe and drain it off-thread, the LspLogPushed precedent.
PluginTraceRecord
One boundary event. Structured (not a pre-formatted line) so the view owns presentation and filters key on fields. plugin is the host-issued id (the same id SourceLayer::Plugin / Event::PluginCrashed.plugin carry), so Layer-0 crash rows and Layer-1 trace rows join cleanly.
PluginTracer
The boundary-trace sink — the LspLogger analogue. Cheap to trace into (gate → push → publish); everything expensive is deferred to the off-thread drain.

Enums§

Direction
Which way a boundary call crossed.
TraceLevel
Trace verbosity. Ordered least→most verbose; a record at record.level is kept iff record.level <= gate. Records always carry Error..=Trace; Off is a gate-only value (a gate of Off keeps nothing).
TraceOutcome
How a boundary call ended.

Type Aliases§

PluginTracerHandle
Shared handle alias (ServiceRegistry Arc/TypeId rule: register and look up as PluginTracerHandle).