metrics_server
Note: this lib is NOT stable. The API might change before v1.0
A hassle-free, single-responsibility, safe HTTP server used to easily expose metrics in an application.
This crate provides a thread safe, minimalstic HTTP server used to buffer metrics and serve them via a standard /metrics
endpoint. It's aim is to remove the boilerplate needed to create such simple mechanisms. It is currently somewhat oppinionated and naive in order to maintain little complexity.
Usage
Include the lib in your Cargo.toml
dependencies:
[]
= "0.4"
HTTP
use MetricsServer;
// Create a new HTTP server and start listening for requests in the background.
let server = new;
// Publish you application metrics.
let bytes = server.update;
assert_eq!;
HTTPS
Note: there is currently no option to skip TLS cert verification.
use MetricsServer;
// Load TLS config.
let cert = include_bytes!.to_vec;
let key = include_bytes!.to_vec;
// Create a new HTTPS server and start listening for requests in the background.
let server = https;
// Publish you application metrics.
let bytes = server.update;
assert_eq!;
For more comprehensive usage, see the included examples.