George3d6 / Inquisitor

An easily extensible, minimal footprint monitoring tool. (Still in the testing phase)
BSD 2-Clause "Simplified" License
30 stars 4 forks source link

Agent Plugin Overhaul #9

Closed Deedasmi closed 6 years ago

Deedasmi commented 6 years ago

This PR overhauls how plugin management is handled on the agent. This new method has a number of key advantages over the original, and the first concept discussed in #4.

  1. Plugins are now crates, which allows them to be distributed on Crates.io, other github repositories, or in a separate location on the local filesystem without any additional work on the agent.
  2. Agent dependencies are now entirely decoupled from plugin dependencies. Both previous iterations of the plugin system required the agent to 'support' any necessary dependencies.
  3. The agent library, containing the AgentPlugin trait and a few utilities, is now a separate crate as well. This crate could be published and added as a dependency allowing plugin authors to keep their own codebase clean of any Inquisitor code or build artifacts.
  4. Plugins can now be versioned, and version management will be handled by cargo directly.

There is some compile time code generation, but the major issue here is the configuration files.

Further discussion to be had:

  1. Configuration management. With this way of installing plugins, default configuration files become more difficult. We could provide a config for the base plugins, or implement some way of plugins generating their own default config at runtime.
  2. Configuration failure. Should an unconfigured plugin be silently ignored or run a default config?

Further work to be done:

  1. Now that we have a vector of all plugins, we can get the time remaining until the next plugin update. This would allow of to sleep the optimum amount of time rather than just 1 second. Would required a change to the AgentPlugin trait.

Overall, we get version management, dependency management, distribution, flexibility, and a cleaner and more streamlined codebase at the cost of the configuration issues mentioned above. So I've decided to go ahead and open this as a PR. No pressure to merge until after the configuration issue it sorted out.