swactor/src/process_observer.rs
Zachery Aaron Shores-Chmielewski 52394a8e2d refactor(distribution): prune diagnostics subsystem
Strip the collector/aggregator/postproc/snapshot, vastai sampler+shipper,
host/iroh/subprocess/swim introspection, relay observability, sink/spool, and the diag
binaries; drop the t_diag_* tests. Remove DiagEvent emission from iroh_driver. Add
datastream emit/wire (mux + NoopSink/UdpFrameSink/ClusterFrameSink) and rewire the
dashboard onto datastream_source.


Signed-off-by: Zachery Aaron Shores-Chmielewski <zacheryasc@gmail.com>
2026-06-06 21:53:25 +04:00

20 lines
1.1 KiB
Rust

//! Per-runtime hook for observing output from processes spawned through the
//! process facility.
//!
//! This trait lives in swactor rather than `swactor-process` so the runtime can
//! store an observer without a dependency cycle: `swactor-process` depends on
//! swactor, and a telemetry emitter (which lives even higher up) implements this
//! trait. The runtime is merely the carrier — it never interprets the bytes.
//!
//! The observer is per-node (per-runtime), installed via
//! [`Runtime::set_process_output_observer`](crate::runtime::Runtime::set_process_output_observer).
//! The process facility hands every managed process's output to it automatically,
//! labeled by the process's command basename, so a node taps all of its managed
//! processes with no per-spawn wiring.
/// Observes every chunk of stdout/stderr from processes the runtime spawns.
pub trait ProcessOutputObserver: Send + Sync {
/// `label` identifies the process (its command basename); `is_stderr`
/// selects the stream; `data` is one raw output chunk.
fn on_output(&self, label: &str, is_stderr: bool, data: &[u8]);
}