A hassle-free, single-responsibility, safe HTTP server used to easily expose metrics in an application.
Include the lib in your Cargo.toml
dependencies:
[dependencies]
metrics_server = "0.2"
In your application:
use metrics_server::MetricsServer;
// Create a new server and start it in the background.
let server = MetricsServer::new();
server.serve("localhost:8001");
// Publish you application metrics periodically.
let bytes = server.update(Vec::from([1, 2, 3, 4]));
assert_eq!(bytes, 4);
For more comprehensive usage, check out the included examples.