Skip to main content

agentsight_capture/runners/
mod.rs

1// SPDX-License-Identifier: MIT
2// Copyright (c) 2026 eunomia-bpf org.
3
4use crate::event::Event;
5use async_trait::async_trait;
6use futures::stream::Stream;
7use std::pin::Pin;
8
9/// Type alias for event streams
10pub type EventStream = Pin<Box<dyn Stream<Item = Event> + Send>>;
11
12/// Type alias for errors that can be sent between threads
13pub type RunnerError = Box<dyn std::error::Error + Send + Sync>;
14
15/// Base trait for all runners that collect observability data
16#[async_trait]
17pub trait Runner: Send + Sync {
18    /// Run the data collection and return a stream of events
19    async fn run(&mut self) -> Result<EventStream, RunnerError>;
20
21    /// Add an analyzer to this runner's processing chain
22    fn add_analyzer(self, analyzer: Box<dyn crate::analyzers::Analyzer>) -> Self
23    where
24        Self: Sized;
25}
26
27pub mod agent;
28pub mod common;
29#[cfg(test)]
30pub mod fake;
31pub mod process;
32pub mod system;
33
34pub use agent::AgentRunner;
35pub use common::BinaryRunner;
36#[cfg(test)]
37pub use fake::FakeRunner;
38pub use process::ProcessRunner;
39pub use system::SystemRunner;