pub fn spawn_server(
dir: PathBuf,
stats: Arc<RwLock<MonitordStats>>,
state: Arc<Mutex<ReportState>>,
) -> Result<JoinHandle<()>>Expand description
Run the report server on its own thread with a current-thread runtime.
Public so library users with their own collection loop (e.g. monitord-exporter) can serve their stats and state too. A failure is logged and ends only the server thread, never collection.
The socket-activated fd is claimed and marked close-on-exec here, on the calling thread before this returns, so no process spawned after the call can inherit it. Call it before starting collection.