Example of a custom Alumet agent.
This is a Rust workspace managed by Cargo.
It contains two projects: agent-example and plugin-42.
It creates a binary app, defined in src/main.rs.
Cargo.tomldeclares a dependency onalumet(Alumet core), some Alumet plugins, and some third-party libraries.main.rsperforms a complete setup of Alumet, as it:- loads the plugins
- loads the configuration file
- applies default configs if needed
- creates the measurement pipeline
- runs until you press Ctrl+C (or send SIGTERM in another way).
Command-line arguments are not provided. To do that, we suggest you to have a look at clap or other libraries.
- Add your plugin as a dependency of the project, for instance with
cargo add. - Import the plugin's struct in
main.rs. - Add the plugin's type to the list of plugins (the
static_plugins!macro) inmain.rs. - Compile everything together with
cargo build. The binary is generated intarget/. Note that, by default, you are indebug(unoptimized) mode.
Pro-tip: you can compile and run quickly with cargo run. To pass arguments to the Alumet agent, use --. For instance, cargo run -- plugins list.
The plugin is a Rust library, whose main file is lib.rs.
For more information on plugins, read the Alumet Developer Book.