1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
//! Helpers for creating a runnable application based on Alumet, aka an "Alumet agent".
//!
//! # Minimal Example
//!
//! Building an Alumet agent require two key components:
//! - a measurement [pipeline](crate::pipeline)
//! - a [set of plugins](PluginSet).
//!
//! Use the [`Builder`] to combine them and apply other settings.
//!
//! ```no_run
//! use alumet::{agent, pipeline, static_plugins};
//! use alumet::plugin::rust::AlumetPlugin;
//!
//! use std::time::Duration;
//!
//! # use anyhow;
//! # use alumet::plugin::{AlumetPluginStart, ConfigTable};
//! #
//! struct PluginA;
//! impl AlumetPlugin for PluginA {
//! # // Plugin implementation
//! # fn name() -> &'static str {
//! # "a"
//! # }
//! #
//! # fn version() -> &'static str {
//! # "0.1.0"
//! # }
//! #
//! # fn init(_config: ConfigTable) -> anyhow::Result<Box<Self>> {
//! # todo!()
//! # }
//! #
//! # fn start(&mut self, _alumet: &mut AlumetPluginStart) -> anyhow::Result<()> {
//! # todo!()
//! # }
//! #
//! # fn stop(&mut self) -> anyhow::Result<()> {
//! # todo!()
//! # }
//! #
//! # fn default_config() -> anyhow::Result<Option<ConfigTable>> {
//! # Ok(None)
//! # }
//! }
//!
//! // Load the plugin metadata
//! let mut plugins = agent::plugin::PluginSet::from(static_plugins![PluginA]);
//!
//! // Set up the measurement pipeline
//! let mut pipeline = pipeline::Builder::new();
//! pipeline.normal_threads(2); // Example setting: use 2 threads to run async pipeline elements
//!
//! // Build and start the agent
//! let agent = agent::Builder::from_pipeline(plugins, pipeline)
//! .build_and_start()
//! .expect("startup failure");
//!
//! // Run until shutdown (you can use Ctrl+C to initiate shutdown from the terminal)
//! agent.wait_for_shutdown(Duration::MAX).expect("error while running");
//! ```
//!
//! # Configuration Management
//!
//! Use the [`config`] module to manage a TOML configuration file that contains both
//! the general agent options and the configuration of each plugin.
pub use ;